hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ed1dbf530b5ecd66ca7b075965de5e986c3c20be | 3,441 | pl | Perl | tools/perl/lib/unicode/is/bidil.pl | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
]
| 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | tools/perl/lib/unicode/is/bidil.pl | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
]
| 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | tools/perl/lib/unicode/is/bidil.pl | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
]
| 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is built by mktables.PL from e.g. Unicode.301.
# Any changes made here will be lost!
return <<'END';
0041 005a
0061 007a
00aa
00b5
00ba
00c0 00d6
00d8 00f6
00f8 021f
0222 0233
0250 02ad
02b0 02b8
02bb 02c1
02d0 02d1
02e0 02e4
02ee
037a
0386
0388 038a
038c
038e 03a1
03a3 03ce
03d0 03d7
03da 03f3
0400 0482
048c 04c4
04c7 04c8
04cb 04cc
04d0 04f5
04f8 04f9
0531 0556
0559 055f
0561 0587
0589
0903
0905 0939
093d 0940
0949 094c
0950
0958 0961
0964 0970
0982 0983
0985 098c
098f 0990
0993 09a8
09aa 09b0
09b2
09b6 09b9
09be 09c0
09c7 09c8
09cb 09cc
09d7
09dc 09dd
09df 09e1
09e6 09f1
09f4 09fa
0a05 0a0a
0a0f 0a10
0a13 0a28
0a2a 0a30
0a32 0a33
0a35 0a36
0a38 0a39
0a3e 0a40
0a59 0a5c
0a5e
0a66 0a6f
0a72 0a74
0a83
0a85 0a8b
0a8d
0a8f 0a91
0a93 0aa8
0aaa 0ab0
0ab2 0ab3
0ab5 0ab9
0abd 0ac0
0ac9
0acb 0acc
0ad0
0ae0
0ae6 0aef
0b02 0b03
0b05 0b0c
0b0f 0b10
0b13 0b28
0b2a 0b30
0b32 0b33
0b36 0b39
0b3d 0b3e
0b40
0b47 0b48
0b4b 0b4c
0b57
0b5c 0b5d
0b5f 0b61
0b66 0b70
0b83
0b85 0b8a
0b8e 0b90
0b92 0b95
0b99 0b9a
0b9c
0b9e 0b9f
0ba3 0ba4
0ba8 0baa
0bae 0bb5
0bb7 0bb9
0bbe 0bbf
0bc1 0bc2
0bc6 0bc8
0bca 0bcc
0bd7
0be7 0bf2
0c01 0c03
0c05 0c0c
0c0e 0c10
0c12 0c28
0c2a 0c33
0c35 0c39
0c41 0c44
0c60 0c61
0c66 0c6f
0c82 0c83
0c85 0c8c
0c8e 0c90
0c92 0ca8
0caa 0cb3
0cb5 0cb9
0cbe
0cc0 0cc4
0cc7 0cc8
0cca 0ccb
0cd5 0cd6
0cde
0ce0 0ce1
0ce6 0cef
0d02 0d03
0d05 0d0c
0d0e 0d10
0d12 0d28
0d2a 0d39
0d3e 0d40
0d46 0d48
0d4a 0d4c
0d57
0d60 0d61
0d66 0d6f
0d82 0d83
0d85 0d96
0d9a 0db1
0db3 0dbb
0dbd
0dc0 0dc6
0dcf 0dd1
0dd8 0ddf
0df2 0df4
0e01 0e30
0e32 0e33
0e40 0e46
0e4f 0e5b
0e81 0e82
0e84
0e87 0e88
0e8a
0e8d
0e94 0e97
0e99 0e9f
0ea1 0ea3
0ea5
0ea7
0eaa 0eab
0ead 0eb0
0eb2 0eb3
0ebd
0ec0 0ec4
0ec6
0ed0 0ed9
0edc 0edd
0f00 0f17
0f1a 0f34
0f36
0f38
0f3e 0f47
0f49 0f6a
0f7f
0f85
0f88 0f8b
0fbe 0fc5
0fc7 0fcc
0fcf
1000 1021
1023 1027
1029 102a
102c
1031
1038
1040 1057
10a0 10c5
10d0 10f6
10fb
1100 1159
115f 11a2
11a8 11f9
1200 1206
1208 1246
1248
124a 124d
1250 1256
1258
125a 125d
1260 1286
1288
128a 128d
1290 12ae
12b0
12b2 12b5
12b8 12be
12c0
12c2 12c5
12c8 12ce
12d0 12d6
12d8 12ee
12f0 130e
1310
1312 1315
1318 131e
1320 1346
1348 135a
1361 137c
13a0 13f4
1401 1676
1681 169a
16a0 16f0
1780 17b6
17be 17c5
17c7 17c8
17d4 17da
17dc
17e0 17e9
1810 1819
1820 1877
1880 18a8
1e00 1e9b
1ea0 1ef9
1f00 1f15
1f18 1f1d
1f20 1f45
1f48 1f4d
1f50 1f57
1f59
1f5b
1f5d
1f5f 1f7d
1f80 1fb4
1fb6 1fbc
1fbe
1fc2 1fc4
1fc6 1fcc
1fd0 1fd3
1fd6 1fdb
1fe0 1fec
1ff2 1ff4
1ff6 1ffc
200e
207f
2102
2107
210a 2113
2115
2119 211d
2124
2126
2128
212a 212d
212f 2131
2133 2139
2160 2183
2336 237a
2395
249c 24e9
3005 3007
3021 3029
3031 3035
3038 303a
3041 3094
309d 309e
30a1 30fa
30fc 30fe
3105 312c
3131 318e
3190 31b7
3200 321c
3220 3243
3260 327b
327f 32b0
32c0 32cb
32d0 32fe
3300 3376
337b 33dd
33e0 33fe
3400 4db5
4e00 9fa5
a000 a48c
ac00 d7a3
d800 db7f
db80 dbff
dc00 dfff
e000 f8ff
f900 fa2d
fb00 fb06
fb13 fb17
ff21 ff3a
ff41 ff5a
ff66 ffbe
ffc2 ffc7
ffca ffcf
ffd2 ffd7
ffda ffdc
f0000 ffffd
100000 10fffd
END
| 10.555215 | 59 | 0.70154 |
73ed6e9473d03403de20cea50831fdddb02e3933 | 16,042 | pm | Perl | cgi-bin/SGX/CSV.pm | gbonilla18/segex | 5d781d8ad20d3cadd72aca6f5dc8a23364fd271b | [
"Artistic-2.0"
]
| null | null | null | cgi-bin/SGX/CSV.pm | gbonilla18/segex | 5d781d8ad20d3cadd72aca6f5dc8a23364fd271b | [
"Artistic-2.0"
]
| null | null | null | cgi-bin/SGX/CSV.pm | gbonilla18/segex | 5d781d8ad20d3cadd72aca6f5dc8a23364fd271b | [
"Artistic-2.0"
]
| 1 | 2021-06-22T18:23:38.000Z | 2021-06-22T18:23:38.000Z | package SGX::CSV;
use strict;
use warnings;
require File::Temp;
require Text::CSV;
use Benchmark qw/timediff timestr/;
use SGX::Util qw/build_matchp car/;
use SGX::Abstract::Exception ();
#=== FUNCTION ================================================================
# NAME: bind_handle
# PURPOSE:
# PARAMETERS: ????
# RETURNS: ????
# DESCRIPTION: ????
# THROWS: no exceptions
# COMMENTS:
#
# :TODO:10/21/2011 00:49:20:es: Use Text::CSV types:
# http://search.cpan.org/~makamaka/Text-CSV-1.21/lib/Text/CSV.pm#types
#
# SEE ALSO: n/a
#===============================================================================
sub bind_handle {
my $handle = shift;
my $csv = eval { Text::CSV->new( { eol => "\r\n", sep_char => "," } ); }
or do {
my $exception = Exception::Class->caught();
my $msg = "$exception" || 'Unknown error';
SGX::Exception::Internal->throw(
error => "Can't load Text::CSV: $msg" );
};
return sub {
return $csv->print( $handle, shift || [] );
};
}
#=== CLASS METHOD ============================================================
# CLASS: CSV
# METHOD:
# PARAMETERS: ????
# RETURNS: ????
# DESCRIPTION:
# THROWS: no exceptions
# COMMENTS: none
# SEE ALSO: n/a
#===============================================================================
sub delegate_fileUpload {
my %args = @_;
my $self = $args{delegate};
my $sql = $args{statements};
my $validators = $args{validators};
my $parameters = $args{parameters};
my $index_for_count = $args{index_for_count};
my $filename = $args{filename};
# will use last return code by default (index -1)
my $return_code_to_report =
exists( $args{return_code_to_report} )
? $args{return_code_to_report}
: -1;
my $success_message =
exists( $args{success_message} ) ? $args{success_message} : 1;
my $dbh = $self->{_dbh};
my @statements = map { $dbh->prepare($_) } @$sql;
my $old_AutoCommit = $dbh->{AutoCommit};
$dbh->{AutoCommit} = 0;
my $t0 = Benchmark->new();
my @return_codes;
eval {
foreach my $sth (@statements)
{
my $param = shift @$parameters;
my @proc_param =
map { ( ref($_) eq 'CODE' ) ? $_->() : $_ } @$param;
push @return_codes, 0 + $sth->execute(@proc_param);
$sth->finish();
if ( defined $validators ) {
my $validator = shift @$validators;
$validator->( \@return_codes ) if defined $validator;
}
}
1;
} or do {
my $exception;
if ( $exception =
Exception::Class->caught('Exception::Class::DBI::STH') )
{
# catch dbi::sth exceptions. note: this block catches duplicate
# key record exceptions.
$self->add_message( {}, 'No changes to the database were stored' );
$self->add_message(
{ -class => 'error' },
sprintf(
'DBI Error %d: %s',
$exception->err, $exception->errstr
)
);
}
elsif ( $exception = Exception::Class->caught() ) {
my $msg =
eval { $exception->error } || "$exception" || 'Unknown error';
$self->add_message( {}, 'No changes to the database were stored' );
$self->add_message( { -class => 'error' }, $msg );
}
else {
$self->add_message( {},
'Unknown error occured when loading data into the database. No changes to the database were stored.'
);
}
$dbh->rollback;
unlink $filename if defined $filename;
$_->finish() for @statements;
$dbh->{AutoCommit} = $old_AutoCommit;
return;
};
$dbh->commit;
$_->finish() for @statements;
$dbh->{AutoCommit} = $old_AutoCommit;
my $t1 = Benchmark->new();
unlink $filename if defined $filename;
my $records_added = $return_codes[$return_code_to_report];
my $time_diff = timestr( timediff( $t1, $t0 ) );
if ($success_message) {
my $msg =
"Success! Added $records_added entries to the database. The operation took $time_diff.";
$self->add_message( { -class => 'success' }, $msg );
}
return 1;
}
#=== CLASS METHOD ============================================================
# CLASS: CSV
# METHOD: sanitizeUploadWithMessages
# PARAMETERS: ????
# RETURNS: ????
# DESCRIPTION:
# THROWS: no exceptions
# COMMENTS: none
# SEE ALSO: n/a
#===============================================================================
sub sanitizeUploadWithMessages {
my ( $delegate, $inputField, %args ) = @_;
my $q = $delegate->{_cgi};
# field separator character
$args{csv_in_opts} ||= {};
$args{csv_in_opts}->{sep_char} = ( car( $q->param('separator') ) || "\t" )
if not defined $args{csv_in_opts}->{sep_char};
# whether first line is a header or not
$args{header} = ( defined( $q->param('header') ) ? 1 : 0 )
if not defined $args{header};
my $recordsValid = 0;
my $outputFileNames =
eval { sanitizeUploadFile( $q, $inputField, \$recordsValid, %args ); }
|| [];
my $exception;
if ( $exception = Exception::Class->caught('SGX::Exception::User') ) {
# Notify user of User exception; rethrow Internal and other types of
# exceptions.
$delegate->add_message( { -class => 'error' },
'There was a problem with your input: ' . $exception->error );
}
elsif ( $exception = Exception::Class->caught() ) {
$exception->rethrow();
}
elsif ( $recordsValid == 0 ) {
$delegate->add_message( { -class => 'error' },
'No valid records were uploaded.' );
}
return ( $outputFileNames, $recordsValid );
}
#=== CLASS METHOD ============================================================
# CLASS: CSV
# METHOD: sanitizeUploadFile
# PARAMETERS: $outputFileName - Name of the temporary file to write to
# RETURNS: Number of valid records found
# DESCRIPTION: validate and rewrite the uploaded file
# THROWS: SGX::Exception::Internal, SGX::Exception::User
# COMMENTS: # :TODO:07/08/2011 12:55:45:es: Make headers optional
# SEE ALSO: n/a
#===============================================================================
sub sanitizeUploadFile {
my ( $q, $inputField, $recordsValid, %args ) = @_;
# This is where we put the temp file we will import. UNLINK option to
# File::Temp constructor means that the File::Temp destructor will try to
# unlink the temporary file on its own (we don't need to worry about
# unlinking). Because we are initializing an instance of File::Temp in the
# namespace of this function, the temporary file will be deleted when the
# function exists (when the reference to File::Temp will go out of context).
my $rewrite = ( exists $args{rewrite} ) ? $args{rewrite} : 1;
# The is the file handle of the uploaded file.
my $uploadedFile = $q->upload($inputField)
or SGX::Exception::User->throw( error => "Failed to upload file.\n" );
#Open file we are writing to server.
my @outputFileName;
my @OUTPUTTOSERVER;
for ( my $i = 0 ; $i < $rewrite ; $i++ ) {
my $outputFileName = File::Temp->new(
SUFFIX => '.txt',
UNLINK => 1
)->filename();
open my $OUTPUTTOSERVER, '>', $outputFileName ## no critic
or SGX::Exception::Internal->throw(
error => "Could not open $outputFileName for writing: $!\n" );
push @outputFileName, $outputFileName;
push @OUTPUTTOSERVER, $OUTPUTTOSERVER;
}
$$recordsValid =
eval { csv_rewrite( $uploadedFile, \@OUTPUTTOSERVER, %args ); }
|| 0;
if ( my $exception = Exception::Class->caught() ) {
# In case of error, close files first and rethrow the exception
close($_) for @OUTPUTTOSERVER;
if ( eval { $exception->can('rethrow') } ) {
$exception->rethrow();
}
else {
# Internal error details do not diplay to browser window
SGX::Exception::Internal->throw( error => "$exception\n" );
}
}
elsif ( $$recordsValid < 1 ) {
SGX::Exception::User->throw(
error => "No records found in input file\n" );
}
return \@outputFileName;
}
#=== FUNCTION ================================================================
# NAME: csv_rewrite
# PURPOSE: Validate user-uploaded microarray data and rewrite the file
# provided into a new file for safe slurp-mode loading into the
# database. The original idea was to input a tab-separated file,
# validate it, and rewrite it as a pipe-separated file.
# PARAMETERS: Required:
# $in - ARRAY reference to input file contents split by lines
# $out - output file handle
# $parse - array of functions to validate input fields
#
# Optional (named) with default values:
# header => 0 - whether input contains a header
# csv_in_opts => {} - Input Text::CSV options, e.g.
# csv_in_opts => { sep_char => "\t" }
# csv_out_opts => {} - Output Text::CSV options, e.g.
# csv_out_opts => {
# eol => "\n",
# sep_char => ','
# }
# RETURNS: True value on success; raises exception on failure
# DESCRIPTION: Takes in a CSV-formatted plain-text file (either with header
# present or not) such that the first column is a string "key"
# and the first n columns after it are numeric. Rewrites this
# file while dropping the header. The following options should be
# used for MySQL LOAD DATA INFILE statement:
#
# FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
# LINES TERMINATED BY '\n' STARTING BY ''
#
# THROWS: SGX::Exception::User
# COMMENTS: n/a
#
# SEE ALSO: perldoc Text::CSV
# http://search.cpan.org/~makamaka/Text-CSV-1.21/lib/Text/CSV.pm
#===============================================================================
sub csv_rewrite {
my ( $uploadedFile, $out, %args ) = @_;
# Read uploaded file in "slurp" mode (at once), and break it on the
# following combinations of line separators in respective order: (1) CRLF
# (Windows), (2) LF (Unix), and (3) CR (Mac).
my @lines = split(
/\r\n|\n|\r/,
do { local $/ = <$uploadedFile> }
);
# upload file should get deleted automatically on close
close $uploadedFile;
# whether input file contains a header
my $header =
( exists $args{header} )
? $args{header}
: 0; # default: no header
# Default value for sep_char is as indicated below unless overridden by
# $args{csv_out_opts}. Also, other Text::CSV options can be set through
# $args{csv_out_opts}.
my %csv_in_opts = (
sep_char => "\t",
allow_whitespace => 1,
%{ $args{csv_in_opts} || {} }
);
# Default values for sep_char and eol are as indicated below unless
# overridden by $args{csv_out_opts}. Also, other Text::CSV options can be
# set through $args{csv_out_opts}.
my %csv_out_opts = (
sep_char => ',',
eol => "\n",
%{ $args{csv_out_opts} || {} }
);
my $csv_in = Text::CSV->new( \%csv_in_opts );
my $csv_out = Text::CSV->new( \%csv_out_opts );
my $record_num = 0; # record is a non-empty line
# Generate a custom function that will check whether array consists of
# elements we consider to be empty. When "allow_whitespace" is set during
# parsing, white space will be stripped off automatically from value bounds
# by Text::CSV, in which case we define "empty" to mean empty string. When
# "allow_whitespace" is not set, we define "empty" to mean any combination
# of space characters *or* an empty string. In addition, we ignore undefined
# values (they are equivalent to empty fields).
my $is_empty = build_matchp(
(
$csv_in_opts{allow_whitespace}
? qr/^$/
: qr/^\s*$/
),
ignore_undef => 1
);
#---------------------------------------------------------------------------
# default process routine
#---------------------------------------------------------------------------
my $parser = $args{parser} || [];
my $min_field_count = $args{required_fields};
$min_field_count = @$parser if not defined $min_field_count;
my @sub_print;
foreach my $fh (@$out) {
push @sub_print, sub { $csv_out->print( $fh, \@_ ) };
}
my $process = $args{process} || sub {
my $printfun = shift;
my $line_num = shift;
my $fields = shift;
# check total number of fields present
if ( @$fields < $min_field_count ) {
SGX::Exception::User->throw(
error => sprintf(
"Only %d field(s) found (%d required) on line %d\n",
scalar(@$fields), $min_field_count, $line_num
)
);
}
# perform validation on each column
eval {
$printfun->[0]->(
map { ## no critic
my $val = shift @$fields;
( defined $_ ) ? $_->( $val, $line_num ) : ()
} @$parser
);
1;
} or do {
my $exception;
if ( $exception = Exception::Class->caught('SGX::Exception::Skip') )
{
# only skip 'Skip' exception (which means: skip line)
}
elsif ( $exception = Exception::Class->caught() ) {
if ( eval { $exception->can('rethrow') } ) {
$exception->rethrow();
}
else {
# Internal error details do not diplay to browser window
SGX::Exception::Internal->throw( error => "$exception\n" );
}
}
};
return 1;
};
#---------------------------------------------------------------------------
# main loop
#---------------------------------------------------------------------------
for ( my $line_num = 1 ; $csv_in->parse( shift @lines ) ; $line_num++ ) {
my @fields = $csv_in->fields();
# skip blank lines
next if $is_empty->(@fields);
# skip header if requested to
$record_num++;
next if $record_num == 1 and $header;
$process->( \@sub_print, $line_num, \@fields );
}
# check for errors
my ( $err_code, $err_string, $err_pos ) = $csv_in->error_diag();
if ($err_code) {
SGX::Exception::User->throw( error =>
"Text::CSV error code $err_code ($err_string), position $err_pos. Records written: $record_num"
);
}
# return number of records written
return $record_num;
}
1;
__END__
#===============================================================================
#
# FILE: CSV.pm
#
# DESCRIPTION: Routines for handling CSV files
#
# FILES: ---
# BUGS: ---
# NOTES:
#
# AUTHOR: Eugene Scherba (es), escherba@gmail.com
# COMPANY: Boston University
# VERSION: 1.0
# CREATED: 07/09/2011 16:22:21
# REVISION: ---
#===============================================================================
| 35.179825 | 100 | 0.504426 |
ed064d45c53e6abf4c139f8bfb7f27cb60c6b961 | 787 | t | Perl | t/UNUSEDEzsigndocumentEditObjectV1ResponseTest.t | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | t/UNUSEDEzsigndocumentEditObjectV1ResponseTest.t | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | t/UNUSEDEzsigndocumentEditObjectV1ResponseTest.t | eZmaxinc/eZmax-SDK-perl | 7d92a5915dec1c4ccfafb76d20c1b956bf68f535 | [
"MIT"
]
| null | null | null | =begin comment
eZmax API Definition
This API expose all the functionnalities for the eZmax and eZsign applications.
The version of the OpenAPI document: 1.1.3
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
=end comment
=cut
#
# NOTE: This class is auto generated by the OpenAPI Generator
# Please update the test cases below to test the model.
# Ref: https://openapi-generator.tech
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('EzmaxApi::Object::UNUSEDEzsigndocumentEditObjectV1Response');
# uncomment below and update the test
#my $instance = EzmaxApi::Object::UNUSEDEzsigndocumentEditObjectV1Response->new();
#
#isa_ok($instance, 'EzmaxApi::Object::UNUSEDEzsigndocumentEditObjectV1Response');
| 22.485714 | 82 | 0.775095 |
ed1bf1aa0e0a71f773c025c334b8b3940a666b72 | 510 | pm | Perl | modules/LRG/API/FeatureUp.pm | sanjay-boddu/lrg-code | bc333826006e2155b259c0d5f7840d6f47923949 | [
"Apache-2.0"
]
| 2 | 2016-06-07T13:16:31.000Z | 2019-11-27T10:49:09.000Z | modules/LRG/API/FeatureUp.pm | sanjay-boddu/lrg-code | bc333826006e2155b259c0d5f7840d6f47923949 | [
"Apache-2.0"
]
| null | null | null | modules/LRG/API/FeatureUp.pm | sanjay-boddu/lrg-code | bc333826006e2155b259c0d5f7840d6f47923949 | [
"Apache-2.0"
]
| 4 | 2017-04-11T09:11:18.000Z | 2021-02-26T12:58:44.000Z | use strict;
use warnings;
package LRG::API::FeatureUp;
use LRG::API::Base;
# Inherit from Base class
our @ISA = "LRG::API::Base";
sub initialize {
my $self = shift;
my ($gene) = @_;
$self->gene($gene,'LRG::API::GeneUp',1);
}
sub _permitted {
return [
'gene'
];
}
sub remap {
my $self = shift;
my $mapping = shift;
my $destination_coordinate_system = shift;
$self->SUPER::remap($mapping);
map {$_->remap($mapping,$destination_coordinate_system)} @{$self->gene() || []};
}
1;
| 15 | 82 | 0.615686 |
ed036b8d7cbde0ddba9b0da26e55a9b517660528 | 1,106 | t | Perl | xt/author/00-compile.t | gitpan/Class-Load-XS | c7bdaf5fded6f90d42657039165fb6a3eb0cabf7 | [
"Artistic-2.0"
]
| null | null | null | xt/author/00-compile.t | gitpan/Class-Load-XS | c7bdaf5fded6f90d42657039165fb6a3eb0cabf7 | [
"Artistic-2.0"
]
| null | null | null | xt/author/00-compile.t | gitpan/Class-Load-XS | c7bdaf5fded6f90d42657039165fb6a3eb0cabf7 | [
"Artistic-2.0"
]
| null | null | null | use 5.006;
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
use Test::More 0.94;
plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'Class/Load/XS.pm'
);
# no fake home requested
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
use File::Spec;
use IPC::Open3;
use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', explain(\@warnings) if $ENV{AUTHOR_TESTING};
BAIL_OUT("Compilation problems") if !Test::More->builder->is_passing;
| 21.269231 | 92 | 0.614828 |
ed13273f111c8c211f25bae6e5269544d84467a8 | 16,986 | pm | Perl | Git/usr/share/perl5/core_perl/feature.pm | DalalBassam/myrecipeswebsite | 1ac6e97b6bac19b6d8a06d8ebf36e1f1b79a18f4 | [
"MIT"
]
| 279 | 2015-01-10T22:22:27.000Z | 2022-03-11T00:00:26.000Z | Git/usr/share/perl5/core_perl/feature.pm | DalalBassam/myrecipeswebsite | 1ac6e97b6bac19b6d8a06d8ebf36e1f1b79a18f4 | [
"MIT"
]
| 38 | 2015-07-12T20:06:59.000Z | 2022-02-01T09:23:58.000Z | Git/usr/share/perl5/core_perl/feature.pm | DalalBassam/myrecipeswebsite | 1ac6e97b6bac19b6d8a06d8ebf36e1f1b79a18f4 | [
"MIT"
]
| 31 | 2015-02-18T14:55:57.000Z | 2022-02-24T16:53:19.000Z | # -*- buffer-read-only: t -*-
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is built by regen/feature.pl.
# Any changes made here will be lost!
package feature;
our $VERSION = '1.47';
our %feature = (
fc => 'feature_fc',
say => 'feature_say',
state => 'feature_state',
switch => 'feature_switch',
bitwise => 'feature_bitwise',
evalbytes => 'feature_evalbytes',
array_base => 'feature_arybase',
signatures => 'feature_signatures',
current_sub => 'feature___SUB__',
refaliasing => 'feature_refaliasing',
postderef_qq => 'feature_postderef_qq',
unicode_eval => 'feature_unieval',
declared_refs => 'feature_myref',
unicode_strings => 'feature_unicode',
);
our %feature_bundle = (
"5.10" => [qw(array_base say state switch)],
"5.11" => [qw(array_base say state switch unicode_strings)],
"5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)],
"5.23" => [qw(current_sub evalbytes fc postderef_qq say state switch unicode_eval unicode_strings)],
"all" => [qw(array_base bitwise current_sub declared_refs evalbytes fc postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)],
"default" => [qw(array_base)],
);
$feature_bundle{"5.12"} = $feature_bundle{"5.11"};
$feature_bundle{"5.13"} = $feature_bundle{"5.11"};
$feature_bundle{"5.14"} = $feature_bundle{"5.11"};
$feature_bundle{"5.16"} = $feature_bundle{"5.15"};
$feature_bundle{"5.17"} = $feature_bundle{"5.15"};
$feature_bundle{"5.18"} = $feature_bundle{"5.15"};
$feature_bundle{"5.19"} = $feature_bundle{"5.15"};
$feature_bundle{"5.20"} = $feature_bundle{"5.15"};
$feature_bundle{"5.21"} = $feature_bundle{"5.15"};
$feature_bundle{"5.22"} = $feature_bundle{"5.15"};
$feature_bundle{"5.24"} = $feature_bundle{"5.23"};
$feature_bundle{"5.25"} = $feature_bundle{"5.23"};
$feature_bundle{"5.26"} = $feature_bundle{"5.23"};
$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
my %noops = (
postderef => 1,
lexical_subs => 1,
);
our $hint_shift = 26;
our $hint_mask = 0x1c000000;
our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 );
# This gets set (for now) in $^H as well as in %^H,
# for runtime speed of the uc/lc/ucfirst/lcfirst functions.
# See HINT_UNI_8_BIT in perl.h.
our $hint_uni8bit = 0x00000800;
# TODO:
# - think about versioned features (use feature switch => 2)
=head1 NAME
feature - Perl pragma to enable new features
=head1 SYNOPSIS
use feature qw(say switch);
given ($foo) {
when (1) { say "\$foo == 1" }
when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
when ($_ > 100) { say "\$foo > 100" }
default { say "None of the above" }
}
use feature ':5.10'; # loads all features available in perl 5.10
use v5.10; # implicitly loads :5.10 feature bundle
=head1 DESCRIPTION
It is usually impossible to add new syntax to Perl without breaking
some existing programs. This pragma provides a way to minimize that
risk. New syntactic constructs, or new semantic meanings to older
constructs, can be enabled by C<use feature 'foo'>, and will be parsed
only when the appropriate feature pragma is in scope. (Nevertheless, the
C<CORE::> prefix provides access to all Perl keywords, regardless of this
pragma.)
=head2 Lexical effect
Like other pragmas (C<use strict>, for example), features have a lexical
effect. C<use feature qw(foo)> will only make the feature "foo" available
from that point to the end of the enclosing block.
{
use feature 'say';
say "say is available here";
}
print "But not here.\n";
=head2 C<no feature>
Features can also be turned off by using C<no feature "foo">. This too
has lexical effect.
use feature 'say';
say "say is available here";
{
no feature 'say';
print "But not here.\n";
}
say "Yet it is here.";
C<no feature> with no features specified will reset to the default group. To
disable I<all> features (an unusual request!) use C<no feature ':all'>.
=head1 AVAILABLE FEATURES
=head2 The 'say' feature
C<use feature 'say'> tells the compiler to enable the Perl 6 style
C<say> function.
See L<perlfunc/say> for details.
This feature is available starting with Perl 5.10.
=head2 The 'state' feature
C<use feature 'state'> tells the compiler to enable C<state>
variables.
See L<perlsub/"Persistent Private Variables"> for details.
This feature is available starting with Perl 5.10.
=head2 The 'switch' feature
B<WARNING>: Because the L<smartmatch operator|perlop/"Smartmatch Operator"> is
experimental, Perl will warn when you use this feature, unless you have
explicitly disabled the warning:
no warnings "experimental::smartmatch";
C<use feature 'switch'> tells the compiler to enable the Perl 6
given/when construct.
See L<perlsyn/"Switch Statements"> for details.
This feature is available starting with Perl 5.10.
=head2 The 'unicode_strings' feature
C<use feature 'unicode_strings'> tells the compiler to use Unicode rules
in all string operations executed within its scope (unless they are also
within the scope of either C<use locale> or C<use bytes>). The same applies
to all regular expressions compiled within the scope, even if executed outside
it. It does not change the internal representation of strings, but only how
they are interpreted.
C<no feature 'unicode_strings'> tells the compiler to use the traditional
Perl rules wherein the native character set rules is used unless it is
clear to Perl that Unicode is desired. This can lead to some surprises
when the behavior suddenly changes. (See
L<perlunicode/The "Unicode Bug"> for details.) For this reason, if you are
potentially using Unicode in your program, the
C<use feature 'unicode_strings'> subpragma is B<strongly> recommended.
This feature is available starting with Perl 5.12; was almost fully
implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>;
and extended further in Perl 5.26 to cover L<the range
operator|perlop/Range Operators>.
=head2 The 'unicode_eval' and 'evalbytes' features
Together, these two features are intended to replace the legacy string
C<eval> function, which behaves problematically in some instances. They are
available starting with Perl 5.16, and are enabled by default by a
S<C<use 5.16>> or higher declaration.
C<unicode_eval> changes the behavior of plain string C<eval> to work more
consistently, especially in the Unicode world. Certain (mis)behaviors
couldn't be changed without breaking some things that had come to rely on
them, so the feature can be enabled and disabled. Details are at
L<perlfunc/Under the "unicode_eval" feature>.
C<evalbytes> is like string C<eval>, but operating on a byte stream that is
not UTF-8 encoded. Details are at L<perlfunc/evalbytes EXPR>. Without a
S<C<use feature 'evalbytes'>> nor a S<C<use v5.16>> (or higher) declaration in
the current scope, you can still access it by instead writing
C<CORE::evalbytes>.
=head2 The 'current_sub' feature
This provides the C<__SUB__> token that returns a reference to the current
subroutine or C<undef> outside of a subroutine.
This feature is available starting with Perl 5.16.
=head2 The 'array_base' feature
This feature supports the legacy C<$[> variable. See L<perlvar/$[> and
L<arybase>. It is on by default but disabled under C<use v5.16> (see
L</IMPLICIT LOADING>, below).
This feature is available under this name starting with Perl 5.16. In
previous versions, it was simply on all the time, and this pragma knew
nothing about it.
=head2 The 'fc' feature
C<use feature 'fc'> tells the compiler to enable the C<fc> function,
which implements Unicode casefolding.
See L<perlfunc/fc> for details.
This feature is available from Perl 5.16 onwards.
=head2 The 'lexical_subs' feature
In Perl versions prior to 5.26, this feature enabled
declaration of subroutines via C<my sub foo>, C<state sub foo>
and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details.
This feature is available from Perl 5.18 onwards. From Perl 5.18 to 5.24,
it was classed as experimental, and Perl emitted a warning for its
usage, except when explicitly disabled:
no warnings "experimental::lexical_subs";
As of Perl 5.26, use of this feature no longer triggers a warning, though
the C<experimental::lexical_subs> warning category still exists (for
compatibility with code that disables it). In addition, this syntax is
not only no longer experimental, but it is enabled for all Perl code,
regardless of what feature declarations are in scope.
=head2 The 'postderef' and 'postderef_qq' features
The 'postderef_qq' feature extends the applicability of L<postfix
dereference syntax|perlref/Postfix Dereference Syntax> so that postfix array
and scalar dereference are available in double-quotish interpolations. For
example, it makes the following two statements equivalent:
my $s = "[@{ $h->{a} }]";
my $s = "[$h->{a}->@*]";
This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it
was classed as experimental, and Perl emitted a warning for its
usage, except when explicitly disabled:
no warnings "experimental::postderef";
As of Perl 5.24, use of this feature no longer triggers a warning, though
the C<experimental::postderef> warning category still exists (for
compatibility with code that disables it).
The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable
postfix dereference syntax outside double-quotish interpolations. In those
versions, using it triggered the C<experimental::postderef> warning in the
same way as the 'postderef_qq' feature did. As of Perl 5.24, this syntax is
not only no longer experimental, but it is enabled for all Perl code,
regardless of what feature declarations are in scope.
=head2 The 'signatures' feature
B<WARNING>: This feature is still experimental and the implementation may
change in future versions of Perl. For this reason, Perl will
warn when you use the feature, unless you have explicitly disabled the
warning:
no warnings "experimental::signatures";
This enables unpacking of subroutine arguments into lexical variables
by syntax such as
sub foo ($left, $right) {
return $left + $right;
}
See L<perlsub/Signatures> for details.
This feature is available from Perl 5.20 onwards.
=head2 The 'refaliasing' feature
B<WARNING>: This feature is still experimental and the implementation may
change in future versions of Perl. For this reason, Perl will
warn when you use the feature, unless you have explicitly disabled the
warning:
no warnings "experimental::refaliasing";
This enables aliasing via assignment to references:
\$a = \$b; # $a and $b now point to the same scalar
\@a = \@b; # to the same array
\%a = \%b;
\&a = \&b;
foreach \%hash (@array_of_hash_refs) {
...
}
See L<perlref/Assigning to References> for details.
This feature is available from Perl 5.22 onwards.
=head2 The 'bitwise' feature
B<WARNING>: This feature is still experimental and the implementation may
change in future versions of Perl. For this reason, Perl will
warn when you use the feature, unless you have explicitly disabled the
warning:
no warnings "experimental::bitwise";
This makes the four standard bitwise operators (C<& | ^ ~>) treat their
operands consistently as numbers, and introduces four new dotted operators
(C<&. |. ^. ~.>) that treat their operands consistently as strings. The
same applies to the assignment variants (C<&= |= ^= &.= |.= ^.=>).
See L<perlop/Bitwise String Operators> for details.
This feature is available from Perl 5.22 onwards.
=head2 The 'declared_refs' feature
B<WARNING>: This feature is still experimental and the implementation may
change in future versions of Perl. For this reason, Perl will
warn when you use the feature, unless you have explicitly disabled the
warning:
no warnings "experimental::declared_refs";
This allows a reference to a variable to be declared with C<my>, C<state>,
our C<our>, or localized with C<local>. It is intended mainly for use in
conjunction with the "refaliasing" feature. See L<perlref/Declaring a
Reference to a Variable> for examples.
This feature is available from Perl 5.26 onwards.
=head1 FEATURE BUNDLES
It's possible to load multiple features together, using
a I<feature bundle>. The name of a feature bundle is prefixed with
a colon, to distinguish it from an actual feature.
use feature ":5.10";
The following feature bundles are available:
bundle features included
--------- -----------------
:default array_base
:5.10 say state switch array_base
:5.12 say state switch unicode_strings array_base
:5.14 say state switch unicode_strings array_base
:5.16 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
:5.18 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
:5.20 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
:5.22 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
:5.24 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
postderef_qq
:5.26 say state switch unicode_strings
unicode_eval evalbytes current_sub fc
postderef_qq
The C<:default> bundle represents the feature set that is enabled before
any C<use feature> or C<no feature> declaration.
Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
no effect. Feature bundles are guaranteed to be the same for all sub-versions.
use feature ":5.14.0"; # same as ":5.14"
use feature ":5.14.1"; # same as ":5.14"
=head1 IMPLICIT LOADING
Instead of loading feature bundles by name, it is easier to let Perl do
implicit loading of a feature bundle for you.
There are two ways to load the C<feature> pragma implicitly:
=over 4
=item *
By using the C<-E> switch on the Perl command-line instead of C<-e>.
That will enable the feature bundle for that version of Perl in the
main compilation unit (that is, the one-liner that follows C<-E>).
=item *
By explicitly requiring a minimum Perl version number for your program, with
the C<use VERSION> construct. That is,
use v5.10.0;
will do an implicit
no feature ':all';
use feature ':5.10';
and so on. Note how the trailing sub-version
is automatically stripped from the
version.
But to avoid portability warnings (see L<perlfunc/use>), you may prefer:
use 5.010;
with the same effect.
If the required version is older than Perl 5.10, the ":default" feature
bundle is automatically loaded instead.
=back
=cut
sub import {
shift;
if (!@_) {
croak("No features specified");
}
__common(1, @_);
}
sub unimport {
shift;
# A bare C<no feature> should reset to the default bundle
if (!@_) {
$^H &= ~($hint_uni8bit|$hint_mask);
return;
}
__common(0, @_);
}
sub __common {
my $import = shift;
my $bundle_number = $^H & $hint_mask;
my $features = $bundle_number != $hint_mask
&& $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
if ($features) {
# Features are enabled implicitly via bundle hints.
# Delete any keys that may be left over from last time.
delete @^H{ values(%feature) };
$^H |= $hint_mask;
for (@$features) {
$^H{$feature{$_}} = 1;
$^H |= $hint_uni8bit if $_ eq 'unicode_strings';
}
}
while (@_) {
my $name = shift;
if (substr($name, 0, 1) eq ":") {
my $v = substr($name, 1);
if (!exists $feature_bundle{$v}) {
$v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
if (!exists $feature_bundle{$v}) {
unknown_feature_bundle(substr($name, 1));
}
}
unshift @_, @{$feature_bundle{$v}};
next;
}
if (!exists $feature{$name}) {
if (exists $noops{$name}) {
next;
}
unknown_feature($name);
}
if ($import) {
$^H{$feature{$name}} = 1;
$^H |= $hint_uni8bit if $name eq 'unicode_strings';
} else {
delete $^H{$feature{$name}};
$^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';
}
}
}
sub unknown_feature {
my $feature = shift;
croak(sprintf('Feature "%s" is not supported by Perl %vd',
$feature, $^V));
}
sub unknown_feature_bundle {
my $feature = shift;
croak(sprintf('Feature bundle "%s" is not supported by Perl %vd',
$feature, $^V));
}
sub croak {
require Carp;
Carp::croak(@_);
}
1;
# ex: set ro:
| 32.170455 | 163 | 0.69469 |
ed0698028e278f4060f5b582ecba18e1845b5db6 | 696 | pm | Perl | t/lib/EvalTest.pm | gugod/self | 056d2a4af085376279b96dfd7867088c76116799 | [
"MIT"
]
| 3 | 2015-11-25T09:17:50.000Z | 2021-04-19T13:46:22.000Z | t/lib/EvalTest.pm | gugod/self | 056d2a4af085376279b96dfd7867088c76116799 | [
"MIT"
]
| 1 | 2016-02-01T23:10:49.000Z | 2016-02-01T23:10:49.000Z | t/lib/EvalTest.pm | gugod/self | 056d2a4af085376279b96dfd7867088c76116799 | [
"MIT"
]
| 1 | 2016-02-01T16:24:27.000Z | 2016-02-01T16:24:27.000Z | use strict;
use warnings;
package EvalTest;
use self;
sub new {
return bless {}, self;
}
sub in {
my ($n) = args;
self->{n} = $n;
}
sub out {
return self->{n}
}
sub out2 {
return eval {
return self->{n}
};
}
sub out3 {
return eval "self->{n}";
}
sub out4 {
return eval {
eval 'self->{n}';
};
}
sub out5 {
eval {
eval {
self->{n}
}
}
}
sub out6 {
eval q{eval 'self->{n}'};
}
sub out7 {
eval q{eval {self->{n}}};
}
my $depth = 20;
sub out8 {
if ($depth == 0) {
return eval {
self->{n};
}
}
$depth--;
return eval {
self->out8;
}
}
1;
| 10.38806 | 29 | 0.429598 |
ed0813a1b99bf818e54bb89c2b7f20797722d118 | 2,172 | pl | Perl | extlib/bin/bamToGBrowse.pl | joelchaconcastillo/srnalightnxtg | a14d50d08a90ce7b3b2d0ea200046ad7a719cdc0 | [
"Apache-2.0"
]
| 32 | 2017-02-23T17:51:26.000Z | 2017-02-26T16:49:23.000Z | plugins/jbrowse/extlib/bin/bamToGBrowse.pl | irusri/geniesys | 701209ba9ae27f4f075a59a0f2df06b16e76a454 | [
"BSD-3-Clause"
]
| 4 | 2016-12-12T21:10:15.000Z | 2019-06-02T12:49:44.000Z | plugins/jbrowse/extlib/bin/bamToGBrowse.pl | irusri/geniesys | 701209ba9ae27f4f075a59a0f2df06b16e76a454 | [
"BSD-3-Clause"
]
| 27 | 2017-02-24T12:47:43.000Z | 2017-05-02T18:39:32.000Z | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use Bio::DB::Sam;
use Bio::DB::Sam::SamToGBrowse;
my $has_bigwig = eval {require Bio::DB::BigFile;1};
@ARGV >= 1 or die <<USAGE;
Usage: $0 <directory_path> [<ref.fa>]
Given the path to a directory and the fasta file for the reference
sequence, do the following:
1. Find all SAM files in the indicated directory and convert them
into BAM. These must end in one of the extensions ".sam" or ".sam.gz".
A series of <base>.bam files will be created. This step will be
skipped if SAM files are absent or the corresponding BAM files
are already present.
2. Sort the newly created BAM files, creating a series of files named
<base>_sorted.bam.
3. Index BAM files that need indexing. This step will look for
files named <base>_sorted.bam
4. Create a set of BigWig files representing the coverage graph. These
will be named <base>.bw.
5. Create a skeletal GBrowse config file named "gbrowse.conf" that
serves as a starting point for viewing these files. Previous versions
of this file will be appended to.
You can prepopulate the directory with sorted and indexed BAM files,
in which case the script will not attempt to resort or reindex them.
Unless the Fasta file is explicitly provided, this script will look in
the designated directory for ONE .fa file to use.
Note that you will need temporary space in the directory equivalent to
the size of the largest SAM file being processed.
This script takes a long time to run and uses significant amounts of
RAM when generating the coverage graphs. To improve both performance
and memory consumption, you can install the following C binaries:
bedGraphToBigWig -- download from http://hgdownload.cse.ucsc.edu/admin/exe
or build from source downloadable from
http;//hgdownload.cse.ucsc.edu/admin/jksrc.zip
Place these executables into your path, e.g. /usr/local/bin or ~/bin.
USAGE
;
my($dir,$fasta) = @ARGV;
my $converter = Bio::DB::Sam::SamToGBrowse->new($dir,$fasta,'verbose');
$converter->run();
exit 0;
| 34.47619 | 77 | 0.721455 |
73edfeee837142daca12a6411eef1c86722d6ebc | 1,988 | t | Perl | t/regression/chartsheet03.t | lcorbasson/excel-writer-xlsx | c8f60933dffdffd8a4a65360a88a4e206310916a | [
"Artistic-1.0-Perl"
]
| 1 | 2020-08-18T17:23:15.000Z | 2020-08-18T17:23:15.000Z | t/regression/chartsheet03.t | lcorbasson/excel-writer-xlsx | c8f60933dffdffd8a4a65360a88a4e206310916a | [
"Artistic-1.0-Perl"
]
| null | null | null | t/regression/chartsheet03.t | lcorbasson/excel-writer-xlsx | c8f60933dffdffd8a4a65360a88a4e206310916a | [
"Artistic-1.0-Perl"
]
| null | null | null | ###############################################################################
#
# Tests the output of Excel::Writer::XLSX against Excel generated files.
#
# Copyright 2000-2020, John McNamara, jmcnamara@cpan.org
#
use lib 't/lib';
use TestFunctions qw(_compare_xlsx_files _is_deep_diff);
use strict;
use warnings;
use Test::More tests => 1;
###############################################################################
#
# Tests setup.
#
my $filename = 'chartsheet03.xlsx';
my $dir = 't/regression/';
my $got_filename = $dir . "ewx_$filename";
my $exp_filename = $dir . 'xlsx_files/' . $filename;
my $ignore_members = [];
my $ignore_elements = { 'xl/workbook.xml' => ['<workbookView'] };
###############################################################################
#
# Test the worksheet properties of an Excel::Writer::XLSX chartsheet file.
#
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( $got_filename );
my $worksheet = $workbook->add_worksheet();
my $chart = $workbook->add_chart( type => 'bar' );
# For testing, copy the randomly generated axis ids in the target xlsx file.
$chart->{_chart}->{_axis_ids} = [ 43794816, 43796352 ];
my $data = [
[ 1, 2, 3, 4, 5 ],
[ 2, 4, 6, 8, 10 ],
[ 3, 6, 9, 12, 15 ],
];
$worksheet->write( 'A1', $data );
$chart->add_series( values => '=Sheet1!$A$1:$A$5' );
$chart->add_series( values => '=Sheet1!$B$1:$B$5' );
$chart->add_series( values => '=Sheet1!$C$1:$C$5' );
# Chartsheet test.
$chart->hide();
$workbook->close();
###############################################################################
#
# Compare the generated and existing Excel files.
#
my ( $got, $expected, $caption ) = _compare_xlsx_files(
$got_filename,
$exp_filename,
$ignore_members,
$ignore_elements,
);
_is_deep_diff( $got, $expected, $caption );
###############################################################################
#
# Cleanup.
#
unlink $got_filename;
__END__
| 22.850575 | 79 | 0.511569 |
ed1583ac3dadb4f86983e683307a9988db211f7f | 1,073 | pl | Perl | code.old/dsl/procedures/performanceMetrics/steps/licenseUsage.pl | electric-cloud-community/EC-Admin | 4e1bdd187e442cdec146ad22847fb8467cd1d016 | [
"Apache-2.0"
]
| null | null | null | code.old/dsl/procedures/performanceMetrics/steps/licenseUsage.pl | electric-cloud-community/EC-Admin | 4e1bdd187e442cdec146ad22847fb8467cd1d016 | [
"Apache-2.0"
]
| 30 | 2019-02-27T13:16:22.000Z | 2020-02-14T14:19:24.000Z | code.old/dsl/procedures/performanceMetrics/steps/licenseUsage.pl | electric-cloud-community/EC-Admin | 4e1bdd187e442cdec146ad22847fb8467cd1d016 | [
"Apache-2.0"
]
| 3 | 2019-02-27T14:53:05.000Z | 2019-09-16T05:56:00.000Z | $[/myProject/scripts/perlHeaderJson]
my $res=$ec->getLicenseUsage()->{responses}->[0]->{licenseUsage};
print Dumper($res);
my $str="";
#
# Concurrent Resources
#
if ($res->{concurrentResources}->{maxHosts} ne 'unlimited') {
$str .= sprintf("%d of %d hosts\n", $res->{concurrentResources}->{inUseHosts}, $res->{concurrentResources}->{maxHosts});
}
if ($res->{concurrentResources}->{maxProxiedHosts} ne 'unlimited') {
$str .= sprintf("%d of %d proxies\n", $res->{concurrentResources}->{inUseProxiedHosts}, $res->{concurrentResources}->{maxProxiedHosts});
}
print $res->{concurrentSteps}->{maxConcurrentSteps};
#
# Concurrent Steps
#
if ($res->{concurrentSteps}->{maxConcurrentSteps} ne 'unlimited') {
$str .= sprintf("%d of %d steps\n", $res->{concurrentSteps}->{runningSteps}, $res->{concurrentSteps}->{maxConcurrentSteps});
}
#
# Concurrent users
#
if ($res->{concurrentUsers}->{maxLicenses} != 999999) {
$str .= sprintf("%d of %d users\n", $res->{concurrentUsers}->{inUseLicenses}, $res->{concurrentUsers}->{maxLicenses});
}
$ec->setProperty("summary", $str);
| 33.53125 | 138 | 0.681267 |
73d9cc33fd1d38e0001d35a591db12cefeda9bf6 | 4,281 | pm | Perl | auto-lib/Azure/TimeSeriesInsights.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/TimeSeriesInsights.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/TimeSeriesInsights.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| 1 | 2021-04-08T15:26:39.000Z | 2021-04-08T15:26:39.000Z | package Azure::TimeSeriesInsights;
use Moose;
with 'Azure::API::Service', 'Azure::API::Caller', 'Azure::API::BearerAuth';
sub CreateOrUpdateAccessPolicies {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::CreateOrUpdateAccessPolicies', { @_ });
}
sub CreateOrUpdateEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::CreateOrUpdateEnvironments', { @_ });
}
sub CreateOrUpdateEventSources {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::CreateOrUpdateEventSources', { @_ });
}
sub CreateOrUpdateReferenceDataSets {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::CreateOrUpdateReferenceDataSets', { @_ });
}
sub DeleteAccessPolicies {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::DeleteAccessPolicies', { @_ });
}
sub DeleteEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::DeleteEnvironments', { @_ });
}
sub DeleteEventSources {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::DeleteEventSources', { @_ });
}
sub DeleteReferenceDataSets {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::DeleteReferenceDataSets', { @_ });
}
sub GetAccessPolicies {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::GetAccessPolicies', { @_ });
}
sub GetEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::GetEnvironments', { @_ });
}
sub GetEventSources {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::GetEventSources', { @_ });
}
sub GetReferenceDataSets {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::GetReferenceDataSets', { @_ });
}
sub ListByEnvironmentAccessPolicies {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::ListByEnvironmentAccessPolicies', { @_ });
}
sub ListByEnvironmentEventSources {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::ListByEnvironmentEventSources', { @_ });
}
sub ListByEnvironmentReferenceDataSets {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::ListByEnvironmentReferenceDataSets', { @_ });
}
sub ListByResourceGroupEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::ListByResourceGroupEnvironments', { @_ });
}
sub ListBySubscriptionEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::ListBySubscriptionEnvironments', { @_ });
}
sub ListOperations {
my $self = shift;
return $self->do_call(undef,'Azure::TimeSeriesInsights::ListOperations', { @_ });
}
sub UpdateAccessPolicies {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::UpdateAccessPolicies', { @_ });
}
sub UpdateEnvironments {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::UpdateEnvironments', { @_ });
}
sub UpdateEventSources {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::UpdateEventSources', { @_ });
}
sub UpdateReferenceDataSets {
my $self = shift;
return $self->do_call('subscriptionId','Azure::TimeSeriesInsights::UpdateReferenceDataSets', { @_ });
}
sub operations { qw/CreateOrUpdateAccessPolicies CreateOrUpdateEnvironments CreateOrUpdateEventSources CreateOrUpdateReferenceDataSets DeleteAccessPolicies DeleteEnvironments DeleteEventSources DeleteReferenceDataSets GetAccessPolicies GetEnvironments GetEventSources GetReferenceDataSets ListByEnvironmentAccessPolicies ListByEnvironmentEventSources ListByEnvironmentReferenceDataSets ListByResourceGroupEnvironments ListBySubscriptionEnvironments ListOperations UpdateAccessPolicies UpdateEnvironments UpdateEventSources UpdateReferenceDataSets / }
1;
| 43.683673 | 552 | 0.730904 |
73fd6762a5dcd76fefb458a605f5b8609cbf499a | 2,831 | pl | Perl | gsi/proxy/proxy_utils/source/test/proxy-order-test.pl | sfiligoi/gct | fbfee85f29b4947dfaaad4abfffd06f7a22491ec | [
"Apache-2.0"
]
| 44 | 2015-02-04T22:01:05.000Z | 2021-01-27T21:18:47.000Z | gsi/proxy/proxy_utils/source/test/proxy-order-test.pl | sfiligoi/gct | fbfee85f29b4947dfaaad4abfffd06f7a22491ec | [
"Apache-2.0"
]
| 108 | 2017-11-01T20:22:38.000Z | 2022-03-25T18:33:20.000Z | gsi/proxy/proxy_utils/source/test/proxy-order-test.pl | sfiligoi/gct | fbfee85f29b4947dfaaad4abfffd06f7a22491ec | [
"Apache-2.0"
]
| 51 | 2015-04-07T14:29:47.000Z | 2021-09-23T08:44:18.000Z | #! /usr/bin/perl
# This tests permutations in the proxy file format order, as well as support
# for PKCS8-encoded private keys in proxies
use strict;
use Test::More;
use IO::Handle;
use File::Temp;
my $valgrind="";
my @cleanups;
if (exists $ENV{VALGRIND})
{
$valgrind = "valgrind --log-file=VALGRIND-proxy-order-test-\%p.log";
if (exists $ENV{VALGRIND_OPTIONS})
{
$valgrind .= ' ' . $ENV{VALGRIND_OPTIONS};
}
}
sub create_proxy_elements
{
my $old_umask = umask(077);
my ($proxy_file) = mktemp( "proxytest.XXXXXXXX" );
umask($old_umask);
$ENV{X509_USER_PROXY} = $proxy_file;
system("$valgrind grid-proxy-init > /dev/null");
my $proxy_fh;
open($proxy_fh, "+<$proxy_file");
my $data = '';
my %elements = {};
while (<$proxy_fh>)
{
s/\s*$//;
if (/-----BEGIN CERTIFICATE-----/)
{
$data = "$_\n";
}
elsif (/-----END CERTIFICATE-----/)
{
$data .= "$_\n";
if (!exists($elements{proxy_cert}))
{
$elements{proxy_cert} = $data;
}
else
{
if (!exists($elements{id_cert}))
{
$elements{id_cert} = '';
}
$elements{id_cert} .= $data;
}
$data = '';
}
elsif (/-----BEGIN RSA PRIVATE KEY-----/)
{
$data = "$_\n";
}
elsif (/-----END RSA PRIVATE KEY-----/)
{
$data .= "$_\n";
$elements{proxy_key} = $data;
$data = '';
$elements{'proxy_key.pkcs8'} = `openssl pkcs8 -in "$proxy_file" -outform PEM -topk8 -nocrypt`;
}
else
{
$data .= "$_\n";
}
}
return %elements;
}
sub test_proxy_order($%)
{
my $order = shift;
my %elements = @_;
my $proxy_fh;
my $old_umask = umask(077);
my ($proxy_file) = mktemp( "proxytest.XXXXXXXX" );
umask($old_umask);
open($proxy_fh, ">$proxy_file");
for my $element (split(/:/, $order))
{
print $proxy_fh $elements{$element};
close($proxy_fh);
}
ok(system("$valgrind grid-proxy-info >/dev/null 2>&1") == 0, "proxy order $order");
}
my @permutations = qw(
proxy_cert:proxy_key:id_cert
proxy_cert:id_cert:proxy_key
proxy_key:proxy_cert:id_cert
proxy_key:id_cert:proxy_cert
id_cert:proxy_cert:proxy_key
id_cert:proxy_key:proxy_cert);
my @tests = @permutations;
push(@tests, map { $_ =~ s/proxy_key/proxy_key.pkcs8/; $_ } @permutations);
plan tests => scalar(@tests);
my %elements = create_proxy_elements();
foreach (@tests)
{
eval test_proxy_order($_, %elements);
}
| 23.591667 | 106 | 0.506535 |
ed091c83ad6d9edbd3365be5562983546a15cb6e | 4,229 | pl | Perl | royal.pl | wizmariefa/csci305-prolog-lab | b163c2a3263bcb71b2a45a156b7ccdd153dc8528 | [
"MIT"
]
| null | null | null | royal.pl | wizmariefa/csci305-prolog-lab | b163c2a3263bcb71b2a45a156b7ccdd153dc8528 | [
"MIT"
]
| null | null | null | royal.pl | wizmariefa/csci305-prolog-lab | b163c2a3263bcb71b2a45a156b7ccdd153dc8528 | [
"MIT"
]
| null | null | null | /* Marie Morin
* CSCI 305 Prolog Lab 2
* Royal Family of England 1900-2000 */
female('Queen Victoria').
female('Princess Alexandra of Denmark').
female('Queen Mary').
female('Mrs Simpson').
female('Lady Elizabeth Bowes-Lyon').
female('Queen Elizabeth II').
female('Princess Margaret').
female('Lady Diana Spencer').
female('Princess Anne').
female('Catherine Middleton').
female('Princess Charlotte').
female('Lady Sarah Chatto').
male('Prince Albert').
male('King Edward VII').
male('King George V').
male('King Edward VIII').
male('King George VI').
male('Prince Philip').
male('Prince Charles').
male('Prince Andrew').
male('Prince Edward').
male('Prince William').
male('Prince Henry').
male('Prince George').
male('Viscount Linley').
male('Antony Armstrong-Jones').
reigned('Queen Victoria', 1819, 1901).
reigned('King Edward VII', 1901, 1910).
reigned('King George V', 1910, 1936).
reigned('Queen Elizabeth II', 1952, 2017).
reigned('King Edward VIII', 1936, 1936).
reigned('King George VI', 1936, 1952).
born('Queen Victoria', 1819).
born('Princess Alexandra of Denmark', 1844).
born('Queen Mary', 1867).
born('Mrs Simpson', 1896).
born('Lady Elizabeth Bowes-Lyon', 1900).
born('Queen Elizabeth II', 1926 ).
born('Princess Margaret', 1930).
born('Lady Diana Spencer', 1961).
born('Princess Anne', 1950).
born('Catherine Middleton', 1982).
born('Prince Albert', 1819).
born('King Edward VII', 1841 ).
born('King George V', 1865).
born('King Edward VIII', 1894).
born('King George VI', 1895).
born('Prince Philip', 1921).
born('Prince Charles', 1948).
born('Prince Andrew', 1960).
born('Prince Edward', 1964).
born('Prince William', 1982).
born('Prince Henry', 1984).
born('Prince George', 2013).
born('Princess Charlotte', 2015).
born('Viscount Linley', 1961).
born('Lady Sarah Chatto', 1964).
born('Antony Armstrong-Jones', 1930).
died('Queen Victoria', 1901).
died('Princess Alexandra of Denmark', 1925).
died('Queen Mary', 1953).
died('Mrs Simpson', 1986).
died('Lady Elizabeth Bowes-Lyon', 2002).
died('Princess Margaret', 2002).
died('Lady Diana Spencer', 1997).
died('Prince Albert', 1861).
died('King Edward VII', 1910).
died('King George V', 1936).
died('King Edward VIII', 1972).
died('King George VI', 1952).
died('Antony Armstrong-Jones', 2017).
married('Prince Albert', 'Queen Victoria').
married('King Edward VII', 'Princess Alexandra of Denmark').
married('King George V', 'Queen Mary').
married('King Edward VIII', 'Mrs Simpson').
married('King George VI', 'Lady Elizabeth Bowes-Lyon').
married('Prince Philip', 'Queen Elizabeth II').
married('Prince Charles', 'Lady Diana Spencer').
married('Prince William', 'Catherine Middleton').
married('Antony Armstrong-Jones', 'Princess Margaret').
parent('Prince Albert', 'King Edward VII').
parent('Queen Victoria', 'King Edward VII').
parent('King Edward VII', 'King George V').
parent('Princess Alexandra of Denmark', 'King George V').
parent('King George V', 'King Edward VIII').
parent('Queen Mary', 'King Edward VIII').
parent('King George V', 'King George VI').
parent('Queen Mary', 'King George VI').
parent('King George VI', 'Queen Elizabeth II').
parent('Lady Elizabeth Bowes-Lyon', 'Queen Elizabeth II').
parent('King George VI', 'Princess Margaret').
parent('Lady Elizabeth Bowes-Lyon', 'Princess Margaret').
parent('Queen Elizabeth II', 'Prince Charles').
parent('Prince Philip', 'Prince Charles').
parent('Queen Elizabeth II', 'Princess Anne').
parent('Prince Philip', 'Princess Anne').
parent('Queen Elizabeth II', 'Prince Andrew').
parent('Prince Philip', 'Prince Andrew').
parent('Queen Elizabeth II', 'Prince Edward').
parent('Prince Philip', 'Prince Edward').
parent('Prince Charles', 'Prince William').
parent('Lady Diana Spencer', 'Prince William').
parent('Prince Charles', 'Prince Henry').
parent('Lady Diana Spencer', 'Prince Henry').
parent('Catherine Middleton', 'Prince George').
parent('Prince William', 'Prince George').
parent('Catherine Middleton', 'Princess Charlotte').
parent('Prince William', 'Princess Charlotte').
parent('Antony Armstrong-Jones', 'Viscount Linley').
parent('Princess Margaret', 'Viscount Linley').
parent('Antony Armstrong-Jones', 'Lady Sarah Chatto').
parent('Princess Margaret', 'Lady Sarah Chatto').
| 34.382114 | 60 | 0.714826 |
ed136501dd7362432ae7395f34d39c4984f7f5be | 12,250 | pl | Perl | 2021/aoc15-2.pl | f382/AdventOfCode | 78a46be0c29573f187030293568cf4633c2b575a | [
"MIT"
]
| 1 | 2021-12-05T06:25:23.000Z | 2021-12-05T06:25:23.000Z | 2021/aoc15-2.pl | f382/AdventOfCode | 78a46be0c29573f187030293568cf4633c2b575a | [
"MIT"
]
| null | null | null | 2021/aoc15-2.pl | f382/AdventOfCode | 78a46be0c29573f187030293568cf4633c2b575a | [
"MIT"
]
| null | null | null | #!/usr/bin/perl -w
use strict;
my @input1 = qw(
1163751742
1381373672
2136511328
3694931569
7463417111
1319128137
1359912421
3125421639
1293138521
2311944581
)
;
my @input2 = qw(
1195699269169962618115739279199143968185692172285182183566221795877116121863721498957174621167918242
9115625874265799911728162199785394821312124845672192542919338584962177612992393151111933224334135452
8131729216517615863391649615129757111193739768481218915512112595941796747611211317938536136799846916
4962593132118152776959137321183383866772192116141953231951591444941238923298442361423618911179121722
1416121522926541915424971183698194981419338198971913131598831476211215251194523121195812188825994191
1928733692818149228324516927257499752678492513169166313451293451242416536442231355632161758212412115
4991813117359923391742392452551991886811936769148871994981937912114913399457193319831421852811811411
9996916186114911181317116839536799955741529114391992149574162387517295536711111425429134625723713721
6413152742931664293329711273293938913869998819228825914291212594321245569621831111918122371115465372
6722188749914139715213996125538481197121421593279313213185899225935111987292443132111143755985119529
6141512948818315114491829781295212661954323972616128386859935554992431321714445196118173993711558124
6523752772123188989169344829152218112692618197911472748191793562881571148348812711618193873951113528
8954722416492191712173547723412144532941317659721251223481537443946222823319111777131252431841192491
1219692484677226812231612539162313962112991811497897637829997937131866442336993772931261219369261847
6829142775922131221421699171891121995314918167141731413315221751156692121198315343979568132427284418
3282913221696695997376693291956466428248818465226925182129141125458581691913172218151994115999238119
1481242274838117149188214983221621273134622411136155992499972363312217924192499321799321224791726881
8429813642119162329227799294946451917123691918196133831319435771944687143576199628949499998747162763
8395921941954153228218312412725253615739691131793212984746387117261619752267161113249561125448521573
9211772949361922111776251228119342199252233939131825891962491746149161289543191281631521191528151729
2193925127318321141244277227599184821119727813113229679251991316121821158292233491611923846717119158
9151776354929118196915775164124249829119872627219946481741131411931381997631827757831918173194985349
6977211417599781311418423893723399355128981882844795231591948241298219665711731268447885454263587381
5349135211225233128116791411544311173251931562886224132922219393288176192118214216322799827219811119
6411921773896928424585199799991923414751791199198424646119917617472278291778719919799348821419148724
1423293283117293382227124359498154229373299921865286619381116123429144636291256599612311814659899913
8759614112712881116188816992852111129273765191958918918119921831721418783293917211991846211312611119
4121196173264119196199812212192496732231752189712187319121858237158115471625725612655876196419969937
2691914257589447739711834281999184259675111522131449811913611412236532193323199936291224416611271113
9192755461112725383245113492161211415871889986712211921819194916181391316311361383794418692693182242
9891838115191983532641471156115494911242254468716132462814716618248743273323215725412773332412787352
8722272933154344722732912929122813165682321995172313631238381398582132511122695349523913886143313161
3159822492451512821177591837987711928147328462539253731373891338415277199226141921412821329159184278
1832485826993984412417721923133667113613451764133131128131243811948335992447851989136113499938359145
9257768218141712472531919121131719239231356129229915988251523772791781168121416242161919415829553784
3891717441161141299323329871161725242416786365139551955251111486128147276258118276995359131236712228
4133422437419291126239531215239841331958132171112115233199891441933618863125616385327915193131413261
3253212961163124967414171286936361495972984828192712184792123182321681413111277312139439225347179423
2377431129712475315863521829984995789655626495798679371297781315999954158181121987521157274217196321
4592394651189519271259571319178919179154163791125439916726132231168199694259881318333239193192113119
5214358557391139332181292337556917331883162955773614429133947912812152812455942531392992452114431332
7914511581243189111526812729232853912768193314111226889191115838158147643977115139839624185229333941
4522297916392638141999211949998782928492795393326383963611461431112429161915374925921922371178131735
3116117224134523616636283974197178845139981151286731829271937711211286144713973157818336923155139559
1111295511971847293991217559316561942966392155489341944819143697999114911998211431142725136499468655
1891992683454413881151161751711242395932829172221141125821463261747311911338413341127471564991439546
2197193741181151969214374311187114311245112693918122115717139181914895295849765115821395921191918468
1918812176151559923226989551718951285211227784728295345569322191532911724359295794212198411816325194
7629928961228139545143278341914339752551791925569811939691921284247551268554865938529131518711139531
9451169285941298488483155291166241622428812963136859134265217869232119571587922942764129629377832992
1139592251182689154648182495457245293152859671536169199155915935138564186622314416113812197287681293
1119816611213622645121527229154149189414321711438818453128839964994812163235717235493169348364812413
1115793714933792898281139148211541133261863761597669828999211194232712941151917141932348896263117215
7143981722811931378639626221768345837123991164575136264218371995983942221883741712166415472137721341
3996548229222449762784779391842131791294982258228583737547892351961147281221614412549284975749816744
4922438251273127318171752385192919154922976632198383111121691511461911742517115181294162921997113543
9124461637891375169892252644331692827189167199413165129676424414953458991238723712121149814131276926
1895991515343259216934519621792999914371314528811251145931177912272284392121146199117591523391341219
9857722651665692811316272199623915819118857972163473846145219143133918931463916632958839922431916911
1989949857315678686251225273677553493256129745562479491356285341113695469127148417384622949976616524
1514345992981613134238939273116925182116613291995762152229187269412797171147386143842712248985831764
1211198422698743771451111739285421716192682661858199165165495211191228411993891839117216417485154548
3112992823483168122193816192136331881279211994456269862431176427242242345281287279732441869716191389
6871134463512275644982441198617971116471544111195519491429492742222154536972116714589962192221751385
5647154259376797491331854821299242541251251831183931114992139186921418195851432419352479398994111597
9675812361251547522613219729358639431998762941185794271951111743771188822419414981869983179671393777
2421978919226813559125816133917455796932224322127431441971323952423731378977778142299338998481694621
1162339193451725659611144929116291695927663312921334958711971618293843833635911817495624438269793162
7194289631493331742577212984661271734593922149964321251891912599313222711319511212521891991121817159
9654438184931123365769111117511792284663135618911981951661785454819122411394344529179916722212292335
9381539819769183334129143827547144947273493139711946941111969166113912799186126173317111193291991275
1661334416712633888242162591491114145161623757119234215118957518411596768891927145421233553867417999
1181181172699977113144191474311313161538171364172149949927239939139973157512351741924112395453921131
9799361923512814971481384219119182861846186769934949142334471794341454911588479116988949736973762124
2171161128751829419662251657166198159119931228153262933188511412214512163914514326141175526963632415
7612147289898569864114841291891153691232511181425187711712596649484685412198253969882929227211124238
2922314329122211671657786342123242914361173382744154572623461799951676191374747944234229247999178141
2121115817128199999591441995165254392173622999611859571327239469691126169563163219128197619925629693
3182672168559637413893445199112142497191251242941619924889893728121218651239589762192385494162894121
5791512214198437118967488718672546229179875132191211294148111849597464372811229816224599419181512211
9368472118122928199893477986398229912136629381261436753252174518924581148123243335312798324878848212
9725669655831621352979534192691954118988373532149622234171911923288798911129172114513273197359582283
1942761687342938618918838525761617921731659877171691411971516121317261319199891414189574729261122229
2159398941128831167829781939514329224978191194811728234752148114537973115426731412464878529111311111
1341328878619141146339146971488879124925985158551477411318189214192111643482297176134521189678728713
1442411429315169933594843144898323461746534243341425449339893312191772326944159125121565342118732742
7652125192884993111137974796199931588271953919118334511232831498213211927598715139913123931814522156
8168233671944113286991712612511185119717139652855151332182712722616311711191945817112211499911181521
1921296996453463169619436191262787335963117656489612357751271541937729111183295281896932769447431755
7289213684237311791995281282813488592291961373748236224817633211187113123962827228325981121148847993
6751411399143943283211281437425359722729191819645784229792576159332722378196994132679121397858245431
1917169121919847115634282129154464112929199989281129417312237913972281211921149592991829981144227161
1261189974825512854988913249612121789782128611383136321941939819131669773171112589654999631741194198
3219281818175692294456827118194628339263336829122263483717216243613482232758123183171992174992388688
7222941144112654273162264136491941693974211731736147294821427975517491486839269699142111413274944943
6411899713149171347537792921413961778812778428865681922491878751412131132519154425521912118977133146
6275715225136872451189435474268927729781495997951583367145623498914931591691279272517953212593721359
2433746293145649421172128991788265173129261744194121679239172142992115883692944413244861736711569739
2824762557912419114811994741439928232182929722212597932922111769122217134615129118682941162335962156
3156739229892221111493261433466816249792951919531787792919597117721856143161391231113153218196918133
)
;
#################
my @input = @input2;
my @risk = map { [ split "", $_ ] } @input;
my $p = @risk;
my $q = @{$risk[0]};
for (my $i = 0; $i < 5; ++$i) {
for (my $j = 0; $j < 5; ++$j) {
next if $i == 0 && $j == 0;
for (my $x = 0; $x < $p; ++$x) {
for (my $y = 0; $y < $q; ++$y) {
my $a = $p * $i + $x;
my $b = $q * $j + $y;
my $v = $risk[$x][$y] + $i + $j;
$v -= 9 while $v > 9;
push @{$risk[$a]}, $v;
}
}
}
}
$p = @risk;
$q = @{$risk[0]};
my @dijk = map { [ map { undef } (1..$q) ] } (1..$p);
my %visited = ();
my @queue = ();
print "risk:\n", join("\n", map { join(",", @$_) } @risk), "\n";
sub dijk {
my($x, $y) = @_;
for (my $i = -1; $i <= 1; ++$i) {
my $a = $x + $i;
next if $a < 0 || $a >= $p;
for (my $j = -1; $j <= 1; ++$j) {
my $b = $y + $j;
next if $b < 0 || $b >= $q;
next if $a == $x && $b == $y;
next if $a != $x && $b != $y;
next if $visited{$a}{$b};
my $new = $dijk[$x][$y] + $risk[$a][$b];
if (!defined($dijk[$a][$b]) || $new < $dijk[$a][$b]) {
$dijk[$a][$b] = $new;
# print "$a, $b <- $new\n";
my $k = 0;
++$k while $k < @queue and $queue[$k][0] <= $new;
splice @queue, $k, 0, [$new, $a, $b];
}
}
}
$visited{$x}{$y} = 1;
return $x == $p - 1 && $y == $q - 1;
}
$dijk[0][0] = 0;
@queue = ([0, 0, 0]);
print "dijk:\n", join("\n", map { join(",", map { $_ // "" } @$_) } @dijk), "\n";
while (@queue) {
my($v, $x, $y) = @{shift @queue};
print "($x, $y) ", scalar(@queue), "\n";
my $result = dijk($x, $y);
# print join("\;", map { join(",", map { $_ // "" } @$_) } @queue), "\n";
# print join("\n", map { join(",", map { $_ // "" } @$_) } @dijk), "\n";
last if $result;
}
print "dijk:\n", join("\n", map { join(",", map { $_ // "" } @$_) } @dijk), "\n";
| 63.14433 | 101 | 0.88049 |
ed223856e8db2ed545a76ebd9a175c22b713515d | 715 | t | Perl | t/Catmandu-Importer-WoSCitedReferences.t | manwar/Catmandu-WoS | a8fbdc81245bf602c3cb7dfcb159a2d9afa5adc8 | [
"Artistic-1.0"
]
| null | null | null | t/Catmandu-Importer-WoSCitedReferences.t | manwar/Catmandu-WoS | a8fbdc81245bf602c3cb7dfcb159a2d9afa5adc8 | [
"Artistic-1.0"
]
| null | null | null | t/Catmandu-Importer-WoSCitedReferences.t | manwar/Catmandu-WoS | a8fbdc81245bf602c3cb7dfcb159a2d9afa5adc8 | [
"Artistic-1.0"
]
| 1 | 2019-09-19T14:44:48.000Z | 2019-09-19T14:44:48.000Z | use strict;
use Test::More;
use Test::Exception;
use Catmandu::Util qw(is_string is_hash_ref);
my $pkg = 'Catmandu::Importer::WoSCitedReferences';
require_ok $pkg;
SKIP: {
skip "env WOS_USERNAME, WOS_PASSWORD not defined"
unless $ENV{WOS_USERNAME} && $ENV{WOS_PASSWORD};
my %args = (
username => $ENV{WOS_USERNAME},
password => $ENV{WOS_PASSWORD},
uid => 'WOS:000348243500007',
);
$args{session_id} = $ENV{WOS_SESSION_ID} if $ENV{WOS_SESSION_ID};
my $importer = $pkg->new(%args);
ok is_string($importer->session_id);
$ENV{WOS_SESSION_ID} ||= $importer->session_id;
my $rec = $importer->first;
ok is_hash_ref($rec);
}
done_testing;
| 21.029412 | 69 | 0.641958 |
73ece59891d60f57ee395cf4f87973e997287437 | 1,689 | pm | Perl | lib/Bio/EnsEMBL/DataCheck/Checks/RegulatoryFeatureStableID.pm | gnaamati/ensembl-datacheck | b5eb55a4caa8dc0a7d03322fa6eabe95b7081701 | [
"Apache-2.0"
]
| 5 | 2018-06-13T10:40:06.000Z | 2021-01-27T15:37:46.000Z | lib/Bio/EnsEMBL/DataCheck/Checks/RegulatoryFeatureStableID.pm | gnaamati/ensembl-datacheck | b5eb55a4caa8dc0a7d03322fa6eabe95b7081701 | [
"Apache-2.0"
]
| 388 | 2018-06-15T15:56:12.000Z | 2022-03-29T07:52:46.000Z | lib/Bio/EnsEMBL/DataCheck/Checks/RegulatoryFeatureStableID.pm | gnaamati/ensembl-datacheck | b5eb55a4caa8dc0a7d03322fa6eabe95b7081701 | [
"Apache-2.0"
]
| 33 | 2018-06-15T11:14:29.000Z | 2022-03-04T11:45:27.000Z | =head1 LICENSE
Copyright [2018-2020] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
package Bio::EnsEMBL::DataCheck::Checks::RegulatoryFeatureStableID;
use warnings;
use strict;
use Moose;
use Test::More;
use Bio::EnsEMBL::DataCheck::Test::DataCheck;
use Bio::EnsEMBL::DataCheck::Utils qw/sql_count/;
extends 'Bio::EnsEMBL::DataCheck::DbCheck';
use constant {
NAME => 'RegulatoryFeatureStableID',
DESCRIPTION => 'Regulatory feature stable IDs are unique within a regulatory build',
GROUPS => ['funcgen', 'regulatory_build'],
DB_TYPES => ['funcgen'],
TABLES => ['regulatory_feature']
};
sub skip_tests {
my ($self) = @_;
my $sql = q/
SELECT COUNT(name) FROM regulatory_build
WHERE is_current=1
/;
if (! sql_count($self->dba, $sql) ) {
return (1, 'The database has no regulatory build');
}
}
sub tests {
my ($self) = @_;
my $desc = "Regulatory feature stable IDs are unique";
my $diag = "Regulatory feature";
my $sql = qq/
SELECT stable_id FROM regulatory_feature
GROUP BY regulatory_build_id, stable_id
HAVING COUNT(*) > 1
/;
is_rows_zero($self->dba, $sql, $desc, $diag);
}
1;
| 25.590909 | 86 | 0.709295 |
73e77eff971639a74853cb5882b5912c7b582858 | 3,642 | pl | Perl | source/pkgsrc/mail/mailgraph/patches/patch-mailgraph.pl | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
]
| 1 | 2021-11-20T22:46:39.000Z | 2021-11-20T22:46:39.000Z | source/pkgsrc/mail/mailgraph/patches/patch-mailgraph.pl | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
]
| null | null | null | source/pkgsrc/mail/mailgraph/patches/patch-mailgraph.pl | Scottx86-64/dotfiles-1 | 51004b1e2b032664cce6b553d2052757c286087d | [
"Unlicense"
]
| null | null | null | $NetBSD: patch-mailgraph.pl,v 1.1 2019/10/02 14:30:31 triaxx Exp $
* Use log/maillog as default mail logfile.
* Change hardcoded /var to pkgsrc compliant VARBASE.
--- mailgraph.pl.orig 2007-08-29 09:06:01.000000000 +0000
+++ mailgraph.pl
@@ -371,9 +371,9 @@ my $rrdstep = 60;
my $xpoints = 540;
my $points_per_sample = 3;
-my $daemon_logfile = '/var/log/mailgraph.log';
-my $daemon_pidfile = '/var/run/mailgraph.pid';
-my $daemon_rrd_dir = '/var/log';
+my $daemon_logfile = '@VARBASE@/log/mailgraph.log';
+my $daemon_pidfile = '@VARBASE@/run/mailgraph.pid';
+my $daemon_rrd_dir = '@VARBASE@/db/mailgraph';
# global variables
my $logfile;
@@ -405,14 +405,14 @@ sub usage
print " -v, --verbose be verbose about what you do\n";
print " -V, --version output version information and exit\n";
print " -c, --cat causes the logfile to be only read and not monitored\n";
- print " -l, --logfile f monitor logfile f instead of /var/log/syslog\n";
+ print " -l, --logfile f monitor logfile f instead of @VARBASE@/log/maillog\n";
print " -t, --logtype t set logfile's type (default: syslog)\n";
print " -y, --year starting year of the log file (default: current year)\n";
print " --host=HOST use only entries for HOST (regexp) in syslog\n";
print " -d, --daemon start in the background\n";
- print " --daemon-pid=FILE write PID to FILE instead of /var/run/mailgraph.pid\n";
- print " --daemon-rrd=DIR write RRDs to DIR instead of /var/log\n";
- print " --daemon-log=FILE write verbose-log to FILE instead of /var/log/mailgraph.log\n";
+ print " --daemon-pid=FILE write PID to FILE instead of @VARBASE@/run/mailgraph.pid\n";
+ print " --daemon-rrd=DIR write RRDs to DIR instead of @VARBASE@/log\n";
+ print " --daemon-log=FILE write verbose-log to FILE instead of @VARBASE@/log/mailgraph.log\n";
print " --ignore-localhost ignore mail to/from localhost (used for virus scanner)\n";
print " --ignore-host=HOST ignore mail to/from HOST regexp (used for virus scanner)\n";
print " --only-mail-rrd update only the mail rrd\n";
@@ -461,7 +461,7 @@ sub main
daemonize if $opt{daemon};
- my $logfile = defined $opt{logfile} ? $opt{logfile} : '/var/log/syslog';
+ my $logfile = defined $opt{logfile} ? $opt{logfile} : '@VARBASE@/log/maillog';
my $file;
if($opt{cat}) {
$file = $logfile;
@@ -909,14 +909,14 @@ B<mailgraph> [I<options>...]
-v, --verbose be verbose about what you do
-V, --version output version information and exit
-c, --cat causes the logfile to be only read and not monitored
- -l, --logfile f monitor logfile f instead of /var/log/syslog
+ -l, --logfile f monitor logfile f instead of @VARBASE@/log/maillog
-t, --logtype t set logfile's type (default: syslog)
-y, --year starting year of the log file (default: current year)
--host=HOST use only entries for HOST (regexp) in syslog
-d, --daemon start in the background
- --daemon-pid=FILE write PID to FILE instead of /var/run/mailgraph.pid
- --daemon-rrd=DIR write RRDs to DIR instead of /var/log
- --daemon-log=FILE write verbose-log to FILE instead of /var/log/mailgraph.log
+ --daemon-pid=FILE write PID to FILE instead of @VARBASE@/run/mailgraph.pid
+ --daemon-rrd=DIR write RRDs to DIR instead of @VARBASE@/log
+ --daemon-log=FILE write verbose-log to FILE instead of @VARBASE@/log/mailgraph.log
--ignore-localhost ignore mail to/from localhost (used for virus scanner)
--ignore-host=HOST ignore mail to/from HOST regexp (used for virus scanner)
--only-mail-rrd update only the mail rrd
| 53.558824 | 98 | 0.67106 |
ed21b96900fc8592cc0ae8e108f08d328940f2e2 | 511 | al | Perl | benchmark/benchmarks/FASP-benchmarks/data/random-oriented/randomoriented-0052-50-130.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | benchmark/benchmarks/FASP-benchmarks/data/random-oriented/randomoriented-0052-50-130.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | benchmark/benchmarks/FASP-benchmarks/data/random-oriented/randomoriented-0052-50-130.al | krzysg/FaspHeuristic | 1929c40e3fbc49e68b04acfc5522539a18758031 | [
"MIT"
]
| null | null | null | 1 6 29 32 35
2 7 11 14 40 47
3 6
4 25 49
5 1 14 19 24 40
6 49
7 26 35 43
8 4
9 47
10 3 40
11 5 10
12 11 40
13 5 22 45 48
14 10 22
15 34 44
16 9 14 47
17 45
18 16 39
19 9 31 43 45
20 15
21 43
22 12 18 27
23 19 24 34 39
24
25 1 19 44
26 14 19 21 41
27 9 21 50
28
29 13 14 45
30 10 11 12 21 38 42 50
31 7 14 24 36 38 40
32 14 25 27 33 38 41 49
33 16
34 17 20 28
35 38
36 18 33 42
37
38 16 20 25
39 9 28 40 44
40 7 13 32
41 16 25
42 13 17 33
43 2 13 26
44 33 49
45 27 47 48
46 38 39 45
47 5 20 30
48 9
49 9 33
50 13 | 10.22 | 23 | 0.649706 |
73f666065542de78f799e9b93c0134ad17bb8399 | 63,705 | pm | Perl | bin/lib/Image/ExifTool/Casio.pm | mceachen/exiftool_vendored.rb | bab2705f32f3b8fc47486ec9ceb6f012972419c2 | [
"MIT"
]
| 5 | 2017-02-18T11:03:32.000Z | 2019-01-29T16:04:41.000Z | bin/lib/Image/ExifTool/Casio.pm | mceachen/exiftool_vendored | c154ac88071e480d595fa47140eb65487d4f2b07 | [
"MIT"
]
| null | null | null | bin/lib/Image/ExifTool/Casio.pm | mceachen/exiftool_vendored | c154ac88071e480d595fa47140eb65487d4f2b07 | [
"MIT"
]
| null | null | null | #------------------------------------------------------------------------------
# File: Casio.pm
#
# Description: Casio EXIF maker notes tags
#
# Revisions: 12/09/2003 - P. Harvey Created
# 09/10/2004 - P. Harvey Added MakerNote2 (thanks to Joachim Loehr)
#
# References: 1) http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
# 2) Joachim Loehr private communication
# 3) http://homepage3.nifty.com/kamisaka/makernote/makernote_casio.htm
# 4) http://gvsoft.homedns.org/exif/makernote-casio-type1.html
# 5) Robert Chi private communication (EX-F1)
# 6) https://exiftool.org/forum/index.php/topic,3701.html
# JD) Jens Duttke private communication
#------------------------------------------------------------------------------
package Image::ExifTool::Casio;
use strict;
use vars qw($VERSION);
use Image::ExifTool::Exif;
$VERSION = '1.38';
# older Casio maker notes (ref 1)
%Image::ExifTool::Casio::Main = (
WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
WRITABLE => 1,
GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
0x0001 => {
Name => 'RecordingMode' ,
Writable => 'int16u',
PrintConv => {
1 => 'Single Shutter',
2 => 'Panorama',
3 => 'Night Scene',
4 => 'Portrait',
5 => 'Landscape',
7 => 'Panorama', #4
10 => 'Night Scene', #4
15 => 'Portrait', #4
16 => 'Landscape', #4
},
},
0x0002 => {
Name => 'Quality',
Writable => 'int16u',
PrintConv => { 1 => 'Economy', 2 => 'Normal', 3 => 'Fine' },
},
0x0003 => {
Name => 'FocusMode',
Writable => 'int16u',
PrintConv => {
2 => 'Macro',
3 => 'Auto',
4 => 'Manual',
5 => 'Infinity',
7 => 'Spot AF', #4
},
},
0x0004 => [
{
Name => 'FlashMode',
Condition => '$self->{Model} =~ /^QV-(3500EX|8000SX)/',
Writable => 'int16u',
PrintConv => {
1 => 'Auto',
2 => 'On',
3 => 'Off',
4 => 'Off', #4
5 => 'Red-eye Reduction', #4
},
},
{
Name => 'FlashMode',
Writable => 'int16u',
PrintConv => {
1 => 'Auto',
2 => 'On',
3 => 'Off',
4 => 'Red-eye Reduction',
},
},
],
0x0005 => {
Name => 'FlashIntensity',
Writable => 'int16u',
PrintConv => {
11 => 'Weak',
12 => 'Low', #4
13 => 'Normal',
14 => 'High', #4
15 => 'Strong',
},
},
0x0006 => {
Name => 'ObjectDistance',
Writable => 'int32u',
ValueConv => '$val / 1000', #4
ValueConvInv => '$val * 1000',
PrintConv => '"$val m"',
PrintConvInv => '$val=~s/\s*m$//;$val',
},
0x0007 => {
Name => 'WhiteBalance',
Writable => 'int16u',
PrintConv => {
1 => 'Auto',
2 => 'Tungsten',
3 => 'Daylight',
4 => 'Fluorescent',
5 => 'Shade',
129 => 'Manual',
},
},
# 0x0009 Bulb? (ref unknown)
0x000a => {
Name => 'DigitalZoom',
Writable => 'int32u',
PrintHex => 1,
PrintConv => {
0x10000 => 'Off',
0x10001 => '2x',
0x19999 => '1.6x', #4
0x20000 => '2x', #4
0x33333 => '3.2x', #4
0x40000 => '4x', #4
},
},
0x000b => {
Name => 'Sharpness',
Writable => 'int16u',
PrintConv => {
0 => 'Normal',
1 => 'Soft',
2 => 'Hard',
16 => 'Normal', #4
17 => '+1', #4
18 => '-1', #4
},
},
0x000c => {
Name => 'Contrast',
Writable => 'int16u',
PrintConv => {
0 => 'Normal',
1 => 'Low',
2 => 'High',
16 => 'Normal', #4
17 => '+1', #4
18 => '-1', #4
},
},
0x000d => {
Name => 'Saturation',
Writable => 'int16u',
PrintConv => {
0 => 'Normal',
1 => 'Low',
2 => 'High',
16 => 'Normal', #4
17 => '+1', #4
18 => '-1', #4
},
},
0x0014 => {
Name => 'ISO',
Writable => 'int16u',
Priority => 0,
},
0x0015 => { #JD (Similar to Type2 0x2001)
Name => 'FirmwareDate',
Writable => 'string',
Format => 'undef', # the 'string' contains nulls
Count => 18,
PrintConv => q{
$_ = $val;
if (/^(\d{2})(\d{2})\0\0(\d{2})(\d{2})\0\0(\d{2})(.{2})\0{2}$/) {
my $yr = $1 + ($1 < 70 ? 2000 : 1900);
my $sec = $6;
$val = "$yr:$2:$3 $4:$5";
$val .= ":$sec" if $sec=~/^\d{2}$/;
return $val;
}
tr/\0/./; s/\.+$//;
return "Unknown ($_)";
},
PrintConvInv => q{
$_ = $val;
if (/^(19|20)(\d{2}):(\d{2}):(\d{2}) (\d{2}):(\d{2})$/) {
return "$2$3\0\0$4$5\0\0$6\0\0\0\0";
} elsif (/^Unknown\s*\((.*)\)$/i) {
$_ = $1; tr/./\0/;
return $_;
} else {
return undef;
}
},
},
0x0016 => { #4
Name => 'Enhancement',
Writable => 'int16u',
PrintConv => {
1 => 'Off',
2 => 'Red',
3 => 'Green',
4 => 'Blue',
5 => 'Flesh Tones',
},
},
0x0017 => { #4
Name => 'ColorFilter',
Writable => 'int16u',
PrintConv => {
1 => 'Off',
2 => 'Black & White',
3 => 'Sepia',
4 => 'Red',
5 => 'Green',
6 => 'Blue',
7 => 'Yellow',
8 => 'Pink',
9 => 'Purple',
},
},
0x0018 => { #4
Name => 'AFPoint',
Writable => 'int16u',
Notes => 'may not be valid for all models', #JD
PrintConv => {
1 => 'Center',
2 => 'Upper Left',
3 => 'Upper Right',
4 => 'Near Left/Right of Center',
5 => 'Far Left/Right of Center',
6 => 'Far Left/Right of Center/Bottom',
7 => 'Top Near-left',
8 => 'Near Upper/Left',
9 => 'Top Near-right',
10 => 'Top Left',
11 => 'Top Center',
12 => 'Top Right',
13 => 'Center Left',
14 => 'Center Right',
15 => 'Bottom Left',
16 => 'Bottom Center',
17 => 'Bottom Right',
},
},
0x0019 => { #4
Name => 'FlashIntensity',
Writable => 'int16u',
PrintConv => {
1 => 'Normal',
2 => 'Weak',
3 => 'Strong',
},
},
0x0e00 => {
Name => 'PrintIM',
Description => 'Print Image Matching',
# crazy I know, but the offset for this value is entry-based
# (QV-2100, QV-2900UX, QV-3500EX and QV-4000) even though the
# offsets for other values isn't
EntryBased => 1,
SubDirectory => {
TagTable => 'Image::ExifTool::PrintIM::Main',
},
},
);
# ref 2:
%Image::ExifTool::Casio::Type2 = (
WRITE_PROC => \&Image::ExifTool::Exif::WriteExif,
CHECK_PROC => \&Image::ExifTool::Exif::CheckExif,
WRITABLE => 1,
GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
0x0002 => {
Name => 'PreviewImageSize',
Groups => { 2 => 'Image' },
Writable => 'int16u',
Count => 2,
PrintConv => '$val =~ tr/ /x/; $val',
PrintConvInv => '$val =~ tr/x/ /; $val',
},
0x0003 => {
Name => 'PreviewImageLength',
Groups => { 2 => 'Image' },
OffsetPair => 0x0004, # point to associated offset
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'MakerNotes',
Protected => 2,
},
0x0004 => {
Name => 'PreviewImageStart',
Groups => { 2 => 'Image' },
Flags => 'IsOffset',
OffsetPair => 0x0003, # point to associated byte count
DataTag => 'PreviewImage',
Writable => 'int32u',
WriteGroup => 'MakerNotes',
Protected => 2,
},
0x0008 => {
Name => 'QualityMode',
Writable => 'int16u',
PrintConv => {
0 => 'Economy',
1 => 'Normal',
2 => 'Fine',
},
},
0x0009 => {
Name => 'CasioImageSize',
Groups => { 2 => 'Image' },
Writable => 'int16u',
PrintConv => {
0 => '640x480',
4 => '1600x1200',
5 => '2048x1536',
20 => '2288x1712',
21 => '2592x1944',
22 => '2304x1728',
36 => '3008x2008',
},
},
0x000d => {
Name => 'FocusMode',
Writable => 'int16u',
PrintConv => {
0 => 'Normal',
1 => 'Macro',
},
},
0x0014 => {
Name => 'ISO',
Writable => 'int16u',
Priority => 0,
PrintConv => {
3 => 50,
4 => 64,
6 => 100,
9 => 200,
},
},
0x0019 => {
Name => 'WhiteBalance',
Writable => 'int16u',
PrintConv => {
0 => 'Auto',
1 => 'Daylight',
2 => 'Shade',
3 => 'Tungsten',
4 => 'Fluorescent',
5 => 'Manual',
},
},
0x001d => {
Name => 'FocalLength',
Writable => 'rational64u',
PrintConv => 'sprintf("%.1f mm",$val)',
PrintConvInv => '$val=~s/\s*mm$//;$val',
},
0x001f => {
Name => 'Saturation',
Writable => 'int16u',
PrintConv => {
0 => 'Low',
1 => 'Normal',
2 => 'High',
},
},
0x0020 => {
Name => 'Contrast',
Writable => 'int16u',
PrintConv => {
0 => 'Low',
1 => 'Normal',
2 => 'High',
},
},
0x0021 => {
Name => 'Sharpness',
Writable => 'int16u',
PrintConv => {
0 => 'Soft',
1 => 'Normal',
2 => 'Hard',
},
},
0x0e00 => {
Name => 'PrintIM',
Description => 'Print Image Matching',
Writable => 0,
SubDirectory => {
TagTable => 'Image::ExifTool::PrintIM::Main',
},
},
0x2000 => {
# this image data is also referenced by tags 3 and 4
# (nasty that they double-reference the image!)
%Image::ExifTool::previewImageTagInfo,
Groups => { 2 => 'Preview' },
},
0x2001 => { #PH
# I downloaded images from 12 different EX-Z50 cameras, and they showed
# only 3 distinct dates here (2004:08:31 18:55, 2004:09:13 14:14, and
# 2004:11:26 17:07), so I'm guessing this is a firmware version date - PH
Name => 'FirmwareDate',
Writable => 'string',
Format => 'undef', # the 'string' contains nulls
Count => 18,
PrintConv => q{
$_ = $val;
if (/^(\d{2})(\d{2})\0\0(\d{2})(\d{2})\0\0(\d{2})\0{4}$/) {
my $yr = $1 + ($1 < 70 ? 2000 : 1900);
return "$yr:$2:$3 $4:$5";
}
tr/\0/./; s/\.+$//;
return "Unknown ($_)";
},
PrintConvInv => q{
$_ = $val;
if (/^(19|20)(\d{2}):(\d{2}):(\d{2}) (\d{2}):(\d{2})$/) {
return "$2$3\0\0$4$5\0\0$6\0\0\0\0";
} elsif (/^Unknown\s*\((.*)\)$/i) {
$_ = $1; tr/./\0/;
return $_;
} else {
return undef;
}
},
},
0x2011 => {
Name => 'WhiteBalanceBias',
Writable => 'int16u',
Count => 2,
},
0x2012 => {
Name => 'WhiteBalance',
Writable => 'int16u',
PrintConv => {
0 => 'Manual',
1 => 'Daylight', #3
2 => 'Cloudy', #PH (EX-ZR20, NC)
3 => 'Shade', #3
4 => 'Flash?',
6 => 'Fluorescent', #3
9 => 'Tungsten?', #PH (EX-Z77)
10 => 'Tungsten', #3
12 => 'Flash',
},
},
0x2021 => { #JD (guess)
Name => 'AFPointPosition',
Writable => 'int16u',
Count => 4,
PrintConv => q{
my @v = split ' ', $val;
return 'n/a' if $v[0] == 65535 or not $v[1] or not $v[3];
sprintf "%.2g %.2g", $v[0]/$v[1], $v[2]/$v[3];
},
},
0x2022 => {
Name => 'ObjectDistance',
Writable => 'int32u',
ValueConv => '$val >= 0x20000000 ? "inf" : $val / 1000',
ValueConvInv => '$val eq "inf" ? 0x20000000 : $val * 1000',
PrintConv => '$val eq "inf" ? $val : "$val m"',
PrintConvInv => '$val=~s/\s*m$//;$val',
},
# 0x2023 looks interesting (values 0,1,2,3,5 in samples) - PH
# - 1 for makeup mode shots (portrait?) (EX-Z450)
0x2034 => {
Name => 'FlashDistance',
Writable => 'int16u',
},
# 0x203e - normally 62000, but 62001 for anti-shake mode - PH
0x2076 => { #PH (EX-Z450)
# ("Enhancement" was taken already, so call this "SpecialEffect" for lack of a better name)
Name => 'SpecialEffectMode',
Writable => 'int8u',
Count => 3,
PrintConv => {
'0 0 0' => 'Off',
'1 0 0' => 'Makeup',
'2 0 0' => 'Mist Removal',
'3 0 0' => 'Vivid Landscape',
# have also seen '1 1 1', '2 2 4', '4 3 3', '4 4 4'
# '0 0 14' and '0 0 42' - premium auto night shot (EX-Z2300)
# and '0 0 2' for Art HDR
},
},
0x2089 => [ #PH
{
Name => 'FaceInfo1',
Condition => '$$valPt =~ /^(\0\0|.\x02\x80\x01\xe0)/s', # (EX-H5)
SubDirectory => {
TagTable => 'Image::ExifTool::Casio::FaceInfo1',
ByteOrder => 'BigEndian',
},
},{
Name => 'FaceInfo2',
Condition => '$$valPt =~ /^\x02\x01/', # (EX-H20G,EX-ZR100)
SubDirectory => {
TagTable => 'Image::ExifTool::Casio::FaceInfo2',
ByteOrder => 'LittleEndian',
},
},{
Name => 'FaceInfoUnknown',
Unknown => 1,
},
],
# 0x208a - also some sort of face detection information - PH
0x211c => { #PH
Name => 'FacesDetected',
Format => 'int8u',
},
0x3000 => {
Name => 'RecordMode',
Writable => 'int16u',
PrintConv => {
2 => 'Program AE', #3
3 => 'Shutter Priority', #3
4 => 'Aperture Priority', #3
5 => 'Manual', #3
6 => 'Best Shot', #3
17 => 'Movie', #PH (UHQ?)
19 => 'Movie (19)', #PH (HQ?, EX-P505)
20 => 'YouTube Movie', #PH
'2 0' => 'Program AE', #PH (NC)
'3 0' => 'Shutter Priority', #PH (NC)
'4 0' => 'Aperture Priority', #PH (NC)
'5 0' => 'Manual', #PH (NC)
'6 0' => 'Best Shot', #PH (NC)
},
},
0x3001 => { #3
Name => 'ReleaseMode',
Writable => 'int16u',
PrintConv => {
1 => 'Normal',
3 => 'AE Bracketing',
11 => 'WB Bracketing',
13 => 'Contrast Bracketing', #(not sure about translation - PH)
19 => 'High Speed Burst', #PH (EX-FH25, 40fps)
# have also seen: 2, 7(common), 14, 18 - PH
},
},
0x3002 => {
Name => 'Quality',
Writable => 'int16u',
PrintConv => {
1 => 'Economy',
2 => 'Normal',
3 => 'Fine',
},
},
0x3003 => {
Name => 'FocusMode',
Writable => 'int16u',
PrintConv => {
0 => 'Manual', #(guess at translation)
1 => 'Focus Lock', #(guess at translation)
2 => 'Macro', #3
3 => 'Single-Area Auto Focus',
5 => 'Infinity', #PH
6 => 'Multi-Area Auto Focus',
8 => 'Super Macro', #PH (EX-Z2300)
},
},
0x3006 => {
Name => 'HometownCity',
Writable => 'string',
},
# unfortunately the BestShotMode numbers are model-dependent - PH
#http://search.casio-intl.com/search?q=BEST+SHOT+sets+up+the+camera+CASIO+EX+ZR100+BEST+SHOT&btnG=Search&output=xml_no_dtd&oe=UTF-8&ie=UTF-8&site=casio-intl_com&client=search_casio-intl_com&proxystylesheet=search_casio-intl_com
# NOTE: BestShotMode is not used unless RecordMode is "Best Shot"
0x3007 => [{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-FC100"',
Notes => 'EX-FC100',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Portrait',
3 => 'Scenery',
4 => 'Portrait with Scenery',
5 => 'Children',
6 => 'Sports',
7 => 'Pet',
8 => 'Flower',
9 => 'Natural Green',
10 => 'Autumn Leaves',
11 => 'Sundown',
12 => 'High Speed Night Scene',
13 => 'Night Scene Portrait',
14 => 'Fireworks',
15 => 'High Speed Anti Shake',
16 => 'Multi-motion Image',
17 => 'High Speed Best Selection',
18 => 'Move Out CS',
19 => 'Move In CS',
20 => 'Pre-record Movie',
21 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-FC150"',
Notes => 'EX-FC150',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Expression CS',
3 => 'Baby CS',
4 => 'Child CS',
5 => 'Pet CS',
6 => 'Sports CS',
7 => 'Child High Speed Movie',
8 => 'Pet High Speed Movie',
9 => 'Sports High Speed Movie',
10 => 'Lag Correction',
11 => 'High Speed Lighting',
12 => 'High Speed Night Scene',
13 => 'High Speed Night Scene and Portrait',
14 => 'High Speed Anti Shake',
15 => 'High Speed Best Selection',
16 => 'Portrait',
17 => 'Scenery',
18 => 'Portrait With Scenery',
19 => 'Flower',
20 => 'Natural Green',
21 => 'Autumn Leaves',
22 => 'Sundown',
23 => 'Fireworks',
24 => 'Multi-motion Image',
25 => 'Move Out CS',
26 => 'Move In CS',
27 => 'Pre-record Movie',
28 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-FC200S"',
Notes => 'EX-FC200S',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'Slow Motion Swing (behind)',
2 => 'Slow Motion Swing (front)',
3 => 'Self Slow Motion (behind)',
4 => 'Self Slow Motion (front)',
5 => 'Swing Burst',
6 => 'HDR',
7 => 'HDR Art',
8 => 'High Speed Night Scene',
9 => 'High Speed Night Scene and Portrait',
10 => 'High Speed Anti Shake',
11 => 'Multi SR Zoom',
12 => 'Blurred Background',
13 => 'Wide Shot',
14 => 'Slide Panorama',
15 => 'High Speed Best Selection',
16 => 'Lag Correction',
17 => 'High Speed CS',
18 => 'Child CS',
19 => 'Pet CS',
20 => 'Sports CS',
21 => 'Child High Speed Movie',
22 => 'Pet High Speed Movie',
23 => 'Sports High Speed Movie',
24 => 'Portrait',
25 => 'Scenery',
26 => 'Portrait with Scenery',
27 => 'Children',
28 => 'Sports',
29 => 'Candlelight Portrait',
30 => 'Party',
31 => 'Pet',
32 => 'Flower',
33 => 'Natural Green',
34 => 'Autumn Leaves',
35 => 'Soft Flowing Water',
36 => 'Splashing Water',
37 => 'Sundown',
38 => 'Fireworks',
39 => 'Food',
40 => 'Text',
41 => 'Collection',
42 => 'Auction',
43 => 'Pre-record Movie',
44 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-FH100"',
Notes => 'EX-FH100',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'Expression CS',
2 => 'Baby CS',
3 => 'Child CS',
4 => 'Pet CS',
5 => 'Sports CS',
6 => 'Child High Speed Movie',
7 => 'Pet High Speed Movie',
8 => 'Sports High Speed Movie',
9 => 'Lag Correction',
10 => 'High Speed Lighting',
11 => 'High Speed Night Scene',
12 => 'High Speed Night Scene and Portrait',
13 => 'High Speed Anti Shake',
14 => 'High Speed Best Selection',
15 => 'Portrait',
16 => 'Scenery',
17 => 'Portrait With Scenery',
18 => 'Flower',
19 => 'Natural Green',
20 => 'Autumn Leaves',
21 => 'Sundown',
22 => 'Fireworks',
23 => 'Multi-motion Image',
24 => 'Move Out CS',
25 => 'Move In CS',
26 => 'Pre-record Movie',
27 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-G1"',
Notes => 'EX-G1',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Auto Best Shot',
3 => 'Dynamic Photo',
4 => 'Interval Snapshot',
5 => 'Interval Movie',
6 => 'Portrait',
7 => 'Scenery',
8 => 'Portrait with Scenery',
9 => 'Underwater',
10 => 'Beach',
11 => 'Snow',
12 => 'Children',
13 => 'Sports',
14 => 'Pet',
15 => 'Flower',
16 => 'Sundown',
17 => 'Night Scene',
18 => 'Night Scene Portrait',
19 => 'Fireworks',
20 => 'Food',
21 => 'For eBay',
22 => 'Multi-motion Image',
23 => 'Pre-record Movie',
24 => 'For YouTube',
25 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-S10"',
Notes => 'EX-S10',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Portrait',
3 => 'Scenery',
4 => 'Portrait with Scenery',
5 => 'Self-portrait (1 person)',
6 => 'Self-portrait (2 people)',
7 => 'Children',
8 => 'Sports',
9 => 'Candlelight Portrait',
10 => 'Party',
11 => 'Pet',
12 => 'Flower',
13 => 'Natural Green',
14 => 'Autumn Leaves',
15 => 'Soft Flowing Water',
16 => 'Splashing Water',
17 => 'Sundown',
18 => 'Night Scene',
19 => 'Night Scene Portrait',
20 => 'Fireworks',
21 => 'Food',
22 => 'Text',
23 => 'Collection',
24 => 'Auction',
25 => 'Backlight',
26 => 'Anti Shake',
27 => 'High Sensitivity',
28 => 'Underwater',
29 => 'Monochrome',
30 => 'Retro',
31 => 'Business Cards',
32 => 'White Board',
33 => 'Silent',
34 => 'Pre-record Movie',
35 => 'For YouTube',
36 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-S880"',
Notes => 'EX-S880',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Portrait',
3 => 'Scenery',
4 => 'Portrait with Scenery',
5 => 'Children',
6 => 'Sports',
7 => 'Candlelight Portrait',
8 => 'Party',
9 => 'Pet',
10 => 'Flower',
11 => 'Natural Green',
12 => 'Autumn Leaves',
13 => 'Soft Flowing Water', # (wrong in documentation)
14 => 'Splashing Water',
15 => 'Sundown',
16 => 'Night Scene',
17 => 'Night Scene Portrait',
18 => 'Fireworks',
19 => 'Food',
20 => 'Text',
21 => 'Collection',
22 => 'Auction',
23 => 'Backlight',
24 => 'Anti Shake',
25 => 'High Sensitivity',
26 => 'Monochrome',
27 => 'Retro',
28 => 'Twilight',
29 => 'Layout (2 images)',
30 => 'Layout (3 images)',
31 => 'Auto Framing',
32 => 'Old Photo',
33 => 'Business Cards',
34 => 'White Board',
35 => 'Silent',
36 => 'Short Movie',
37 => 'Past Movie',
38 => 'For YouTube',
39 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-Z16"',
Notes => 'EX-Z16',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Portrait',
3 => 'Scenery',
4 => 'Portrait with Scenery',
5 => 'Children',
6 => 'Sports',
7 => 'Candlelight Portrait',
8 => 'Party',
9 => 'Pet',
10 => 'Flower',
11 => 'Soft Flowing Water',
12 => 'Sundown',
13 => 'Night Scene',
14 => 'Night Scene Portrait',
15 => 'Fireworks',
16 => 'Food',
17 => 'Text',
18 => 'For eBay',
19 => 'Backlight',
20 => 'Anti Shake',
21 => 'High Sensitivity',
22 => 'For YouTube',
23 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-Z9"',
Notes => 'EX-Z9',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Movie',
3 => 'Portrait',
4 => 'Scenery',
5 => 'Children',
6 => 'Sports',
7 => 'Candlelight Portrait',
8 => 'Party',
9 => 'Pet',
10 => 'Flower',
11 => 'Soft Flowing Water',
12 => 'Sundown',
13 => 'Night Scene',
14 => 'Night Scene Portrait',
15 => 'Fireworks',
16 => 'Food',
17 => 'Text',
18 => 'Auction',
19 => 'Backlight',
20 => 'Anti Shake',
21 => 'High Sensitivity',
22 => 'For YouTube',
23 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-Z80"',
Notes => 'EX-Z80',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Portrait',
3 => 'Scenery',
4 => 'Portrait with Scenery',
5 => 'Pet',
6 => 'Self-portrait (1 person)',
7 => 'Self-portrait (2 people)',
8 => 'Flower',
9 => 'Food',
10 => 'Fashion Accessories',
11 => 'Magazine',
12 => 'Monochrome',
13 => 'Retro',
14 => 'Cross Filter',
15 => 'Pastel',
16 => 'Night Scene',
17 => 'Night Scene Portrait',
18 => 'Party',
19 => 'Sports',
20 => 'Children',
21 => 'Sundown',
22 => 'Fireworks',
23 => 'Underwater',
24 => 'Backlight',
25 => 'High Sensitivity',
26 => 'Auction',
27 => 'White Board',
28 => 'Pre-record Movie',
29 => 'For YouTube',
30 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} =~ /^EX-Z(100|200)$/',
Notes => 'EX-Z100 and EX-Z200',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Auto Best Shot',
3 => 'Portrait',
4 => 'Scenery',
5 => 'Portrait with Scenery',
6 => 'Self-portrait (1 person)',
7 => 'Self-portrait (2 people)',
8 => 'Children',
9 => 'Sports',
10 => 'Candlelight Portrait',
11 => 'Party',
12 => 'Pet',
13 => 'Flower',
14 => 'Natural Green',
15 => 'Autumn Leaves',
16 => 'Soft Flowing Water',
17 => 'Splashing Water',
18 => 'Sundown',
19 => 'Night Scene',
20 => 'Night Scene Portrait',
21 => 'Fireworks',
22 => 'Food',
23 => 'Text',
24 => 'Collection',
25 => 'Auction',
26 => 'Backlight',
27 => 'Anti Shake',
28 => 'High Sensitivity',
29 => 'Underwater',
30 => 'Monochrome',
31 => 'Retro',
32 => 'Twilight',
33 => 'ID Photo',
34 => 'Business Cards',
35 => 'White Board',
36 => 'Silent',
37 => 'Pre-record Movie',
38 => 'For YouTube',
39 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z750" and $$self{FILE_TYPE} eq "JPEG"',
Notes => 'EX-Z750 JPEG images',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Portrait with Scenery',
4 => 'Children',
5 => 'Sports',
6 => 'Candlelight Portrait',
7 => 'Party',
8 => 'Pet',
9 => 'Flower',
10 => 'Natural Green',
11 => 'Soft Flowing Water',
12 => 'Splashing Water',
13 => 'Sundown',
14 => 'Night Scene',
15 => 'Night Scene Portrait',
16 => 'Fireworks',
17 => 'Food',
18 => 'Text',
19 => 'Collection',
20 => 'Backlight',
21 => 'Anti Shake',
22 => 'Pastel',
23 => 'Illustration',
24 => 'Cross Filter',
25 => 'Monochrome',
26 => 'Retro',
27 => 'Twilight',
28 => 'Old Photo',
29 => 'ID Photo',
30 => 'Business Cards',
31 => 'White Board',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z750" and $$self{FILE_TYPE} =~ /^(MOV|AVI)$/',
Notes => 'EX-Z750 movies',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Night Scene',
4 => 'Fireworks',
5 => 'Backlight',
6 => 'Silent',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z850" and $$self{FILE_TYPE} eq "JPEG"',
Notes => 'EX-Z850 JPEG images',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Portrait with Scenery',
4 => 'Children',
5 => 'Sports',
6 => 'Candlelight Portrait',
7 => 'Party',
8 => 'Pet',
9 => 'Flower',
10 => 'Natural Green',
11 => 'Autumn Leaves',
12 => 'Soft Flowing Water',
13 => 'Splashing Water',
14 => 'Sundown',
15 => 'Night Scene',
16 => 'Night Scene Portrait',
17 => 'Fireworks',
18 => 'Food',
19 => 'Text',
20 => 'Collection',
21 => 'For eBay',
22 => 'Backlight',
23 => 'Anti Shake',
24 => 'High Sensitivity',
25 => 'Pastel',
26 => 'Illustration',
27 => 'Cross Filter',
28 => 'Monochrome',
29 => 'Retro',
30 => 'Twilight',
31 => 'ID Photo',
32 => 'Old Photo',
33 => 'Business Cards',
34 => 'White Board',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z850" and $$self{FILE_TYPE} =~ /^(MOV|AVI)$/',
Notes => 'EX-Z850 movies',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Night Scene',
4 => 'Fireworks',
5 => 'Backlight',
6 => 'High Sensitivity',
7 => 'Silent',
8 => 'Short Movie',
9 => 'Past Movie',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z1050"',
Notes => 'EX-Z1050',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Movie',
3 => 'Portrait',
4 => 'Scenery',
5 => 'Portrait with Scenery',
6 => 'Children',
7 => 'Sports',
8 => 'Candlelight Portrait',
9 => 'Party',
10 => 'Pet',
11 => 'Flower',
12 => 'Natural Green',
13 => 'Autumn Leaves',
14 => 'Soft Flowing Water',
15 => 'Splashing Water',
16 => 'Sundown',
17 => 'Night Scene',
18 => 'Night Scene Portrait',
19 => 'Fireworks',
20 => 'Food',
21 => 'Text',
22 => 'Collection',
23 => 'For eBay',
24 => 'Backlight',
25 => 'Anti Shake',
26 => 'High Sensitivity',
27 => 'Underwater',
28 => 'Monochrome',
29 => 'Retro',
30 => 'Twilight',
31 => 'Layout (2 images)',
32 => 'Layout (3 images)',
33 => 'Auto Framing',
34 => 'ID Photo',
35 => 'Old Photo',
36 => 'Business Cards',
37 => 'White Board',
38 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z1080"',
Notes => 'EX-Z1080',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Movie',
3 => 'Portrait',
4 => 'Scenery',
5 => 'Portrait with Scenery',
6 => 'Children',
7 => 'Sports',
8 => 'Candlelight Portrait',
9 => 'Party',
10 => 'Pet',
11 => 'Flower',
12 => 'Natural Green',
13 => 'Autumn Leaves',
14 => 'Soft Flowing Water',
15 => 'Splashing Water',
16 => 'Sundown',
17 => 'Night Scene',
18 => 'Night Scene Portrait',
19 => 'Fireworks',
20 => 'Food',
21 => 'Text',
22 => 'Collection',
23 => 'For eBay',
24 => 'Backlight',
25 => 'Anti Shake',
26 => 'High Sensitivity',
27 => 'Underwater',
28 => 'Monochrome',
29 => 'Retro',
30 => 'Twilight',
31 => 'Layout (2 images)',
32 => 'Layout (3 images)',
33 => 'Auto Framing',
34 => 'ID Photo',
35 => 'Old Photo',
36 => 'Business Cards',
37 => 'White Board',
38 => 'Short Movie',
39 => 'Past Movie',
40 => 'For YouTube',
41 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z1200" and $$self{FILE_TYPE} eq "JPEG"',
Notes => 'EX-Z1200 JPEG images',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Portrait with Scenery',
4 => 'Children',
5 => 'Sports',
6 => 'Candlelight Portrait',
7 => 'Party',
8 => 'Pet',
9 => 'Flower',
10 => 'Natural Green',
11 => 'Autumn Leaves',
12 => 'Soft Flowing Water',
13 => 'Splashing Water',
14 => 'Sundown',
15 => 'Night Scene',
16 => 'Night Scene Portrait',
17 => 'Fireworks',
18 => 'Food',
19 => 'Text',
20 => 'Collection',
21 => 'Auction',
22 => 'Backlight',
23 => 'High Sensitivity',
24 => 'Underwater',
25 => 'Monochrome',
26 => 'Retro',
27 => 'Twilight',
28 => 'Layout (2 images)',
29 => 'Layout (3 images)',
30 => 'Auto Framing',
31 => 'ID Photo',
32 => 'Old Photo',
33 => 'Business Cards',
34 => 'White Board',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z1200" and $$self{FILE_TYPE} =~ /^(MOV|AVI)$/',
Notes => 'EX-Z1200 movies',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Night Scene',
4 => 'Fireworks',
5 => 'Backlight',
6 => 'High Sensitivity',
7 => 'Silent',
8 => 'Short Movie',
9 => 'Past Movie',
},
},
# (the following weren't numbered in the documentation:
# G1, Z300, Z250, Z85, Z19, Z150, F1, FH20)
{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-Z2000"',
Notes => 'EX-Z2000',
PrintConvColumns => 3,
#http://support.casio.com/download_files/001/faq_pdf/Z2000/EXZ2000_BS_US_a.pdf
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Premium Auto',
3 => 'Dynamic Photo',
4 => 'Portrait',
5 => 'Scenery',
6 => 'Portrait with Scenery',
7 => 'Children',
8 => 'Sports',
9 => 'Candlelight Portrait',
10 => 'Party',
11 => 'Pet',
12 => 'Flower',
13 => 'Natural Green',
14 => 'Autumn Leaves',
15 => 'Soft Flowing Water',
16 => 'Splashing Water',
17 => 'Sundown',
18 => 'Night Scene',
19 => 'Night Scene Portrait',
20 => 'Fireworks',
21 => 'Food',
22 => 'Text',
23 => 'Collection',
24 => 'For eBay',
25 => 'Backlight',
26 => 'High Sensitivity',
27 => 'Oil Painting',
28 => 'Crayon',
29 => 'Water Color',
30 => 'Monochrome',
31 => 'Retro',
32 => 'Twilight',
33 => 'Multi-motion Image',
34 => 'ID Photo',
35 => 'Business Cards',
36 => 'White Board',
37 => 'Silent',
38 => 'Pre-record Movie',
39 => 'For YouTube',
40 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
# (Movies have different BestShot numbers for this camera)
Condition => '$$self{Model} eq "EX-Z2300"',
Notes => 'EX-Z2300',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Auto',
2 => 'Premium Auto',
3 => 'Dynamic Photo',
4 => 'Portrait',
5 => 'Scenery',
6 => 'Portrait with Scenery',
7 => 'Children',
8 => 'Sports',
9 => 'Candlelight Portrait',
10 => 'Party',
11 => 'Pet',
12 => 'Flower',
13 => 'Natural Green',
14 => 'Autumn Leaves',
15 => 'Soft Flowing Water',
16 => 'Splashing Water',
17 => 'Sundown',
18 => 'Night Scene',
19 => 'Night Scene Portrait',
20 => 'Fireworks',
21 => 'Food',
22 => 'Text',
23 => 'Collection',
24 => 'Auction',
25 => 'Backlight',
26 => 'High Sensitivity',
27 => 'Oil Painting',
28 => 'Crayon',
29 => 'Water Color',
30 => 'Monochrome',
31 => 'Retro',
32 => 'Twilight',
33 => 'Multi-motion Image',
34 => 'ID Photo',
35 => 'Business Cards',
36 => 'White Board',
37 => 'Silent',
38 => 'Pre-record Movie',
39 => 'For YouTube',
40 => 'Voice Recording',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-Z3000"',
Notes => 'EX-Z3000',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'Portrait',
2 => 'Scenery',
3 => 'Portrait With Scenery',
4 => 'Children',
5 => 'Sports',
6 => 'Night Scene',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-ZR100"',
Notes => 'EX-ZR100',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'Child CS',
2 => 'Pet CS',
3 => 'Sports CS',
4 => 'Child High Speed Movie',
5 => 'Pet High Speed Movie',
6 => 'Sports High Speed Movie',
7 => 'Multi SR Zoom',
8 => 'Lag Correction',
9 => 'High Speed Night Scene',
10 => 'High Speed Night Scene and Portrait',
11 => 'High Speed Anti Shake',
12 => 'Portrait',
13 => 'Scenery',
14 => 'Portrait with Scenery',
15 => 'Children',
16 => 'Sports',
17 => 'Candlelight Portrait',
18 => 'Party',
19 => 'Pet',
20 => 'Flower',
21 => 'Natural Green',
22 => 'Autumn Leaves',
23 => 'Soft Flowing Water',
24 => 'Splashing Water',
25 => 'Sundown',
26 => 'Fireworks',
27 => 'Food',
28 => 'Text',
29 => 'Collection',
30 => 'For eBay',
31 => 'Pre-record Movie',
32 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-ZR200"',
Notes => 'EX-ZR200',
PrintConvColumns => 2,
PrintConv => {
0 => 'Off',
1 => 'High Speed Night Scene',
2 => 'High Speed Night Scene and Portrait',
3 => 'High Speed Anti Shake',
4 => 'Blurred Background',
5 => 'Wide Shot',
6 => 'High Speed Best Selection',
7 => 'Lag Correction',
8 => 'Child CS',
9 => 'Pet CS',
10 => 'Sports CS',
11 => 'Child High Speed Movie',
12 => 'Pet High Speed Movie',
13 => 'Sports High Speed Movie',
14 => 'Portrait',
15 => 'Scenery',
16 => 'Portrait with Scenery',
17 => 'Children',
18 => 'Sports',
19 => 'Candlelight Portrait',
20 => 'Party',
21 => 'Pet',
22 => 'Flower',
23 => 'Natural Green',
24 => 'Autumn Leaves',
25 => 'Soft Flowing Water',
26 => 'Splashing Water',
27 => 'Sundown',
28 => 'Fireworks',
29 => 'Food',
30 => 'Text',
31 => 'Collection',
32 => 'Auction',
33 => 'Pre-record Movie',
34 => 'For YouTube',
},
},{ #http://ftp.casio.co.jp/pub/world_manual/qv/en/qv_4000/BS.pdf
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "QV-4000"',
Notes => 'QV-4000',
PrintConvColumns => 3,
PrintConv => {
0 => 'Off',
1 => 'People',
2 => 'Scenery',
3 => 'Flower',
4 => 'Night Scene',
5 => 'Soft Focus',
# this camera also supports 100 modes that you can apparently load
# from a CD-ROM, but I don't know how these map into these numbers
},
},{ #Manfred, email
Name => 'BestShotMode',
Writable => 'int16u',
Condition => '$$self{Model} eq "EX-ZR300"',
Notes => 'EX-ZR300',
PrintConvColumns => 2,
PrintConv => {
1 => 'High Speed Night Shot',
2 => 'Blurred Background',
3 => 'Toy Camera',
4 => 'Soft Focus',
5 => 'Light Tone',
6 => 'Pop',
7 => 'Sepia',
8 => 'Monochrome',
9 => 'Miniature',
10 => 'Wide Shot',
11 => 'High Speed Best Selection',
12 => 'Lag Correction',
13 => 'High Speed Night Scene',
14 => 'High Speed Night Scene and Portrait',
15 => 'High Speed Anti Shake',
16 => 'Portrait',
17 => 'Scenery',
18 => 'Portrait with Scenery',
19 => 'Children',
20 => 'Sports',
21 => 'Candlelight Portrait',
22 => 'Party',
23 => 'Pet',
24 => 'Flower',
25 => 'Natural Green',
26 => 'Autumn Leaves',
27 => 'Soft Flowing Water',
28 => 'Splashing Water',
29 => 'Sundown',
30 => 'Fireworks',
31 => 'Food',
32 => 'Text',
33 => 'Collection',
34 => 'Auction',
35 => 'Prerecord (Movie)',
36 => 'For YouTube',
},
},{
Name => 'BestShotMode',
Writable => 'int16u',
Notes => 'other models not yet decoded',
# so we can't use a lookup as usual - PH
PrintConv => '$val ? $val : "Off"',
PrintConvInv => '$val=~/(\d+)/ ? $1 : 0',
}],
0x3008 => { #3
Name => 'AutoISO',
Writable => 'int16u',
PrintConv => {
1 => 'On',
2 => 'Off',
7 => 'On (high sensitivity)', #PH
8 => 'On (anti-shake)', #PH
10 => 'High Speed', #PH (EX-FC150)
},
},
0x3009 => { #6
Name => 'AFMode',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'Spot',
2 => 'Multi',
3 => 'Face Detection',
4 => 'Tracking', # (but saw this for "Family First" mode with EX-Z77 - PH)
5 => 'Intelligent',
},
},
0x3011 => { #3
Name => 'Sharpness',
Format => 'int16s',
Writable => 'undef',
},
0x3012 => { #3
Name => 'Contrast',
Format => 'int16s',
Writable => 'undef',
},
0x3013 => { #3
Name => 'Saturation',
Format => 'int16s',
Writable => 'undef',
},
0x3014 => {
Name => 'ISO',
Writable => 'int16u',
Priority => 0,
},
0x3015 => {
Name => 'ColorMode',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
2 => 'Black & White', #PH (EX-Z400,FH20)
3 => 'Sepia', #PH (EX-Z400)
},
},
0x3016 => {
Name => 'Enhancement',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'Scenery', #PH (NC) (EX-Z77)
3 => 'Green', #PH (EX-Z77)
5 => 'Underwater', #PH (NC) (EX-Z77)
9 => 'Flesh Tones', #PH (EX-Z77)
},
},
0x3017 => {
Name => 'ColorFilter',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'Blue', #PH (FH20,Z400)
3 => 'Green', #PH (FH20)
4 => 'Yellow', #PH (FH20)
5 => 'Red', #PH (FH20,Z77)
6 => 'Purple', #PH (FH20,Z77,Z400)
7 => 'Pink', #PH (FH20)
},
},
0x301b => { #PH
Name => 'ArtMode',
Writable => 'int16u',
PrintConv => {
0 => 'Normal',
8 => 'Silent Movie',
39 => 'HDR', # (EX-ZR10)
45 => 'Premium Auto', # (EX-2300)
47 => 'Painting', # (EX-2300)
49 => 'Crayon Drawing', # (EX-2300)
51 => 'Panorama', # (EX-ZR10)
52 => 'Art HDR', # (EX-ZR10,EX-Z3000)
62 => 'High Speed Night Shot', # (EX-ZR20)
64 => 'Monochrome', # (EX-ZR20)
67 => 'Toy Camera', # (EX-ZR20)
68 => 'Pop Art', # (EX-ZR20)
69 => 'Light Tone', # (EX-ZR20)
},
},
0x301c => { #3
Name => 'SequenceNumber', # for continuous shooting
Writable => 'int16u',
},
0x301d => { #3
Name => 'BracketSequence',
Writable => 'int16u',
Count => 2,
},
# 0x301e - MultiBracket ? (ref 3)
0x3020 => { #3
Name => 'ImageStabilization',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'On',
2 => 'Best Shot',
3 => 'Movie Anti-Shake', # (EX-V7, EX-TR100)
# (newer models write 2 numbers here - PH)
'0 0' => 'Off', #PH
'16 0' => 'Slow Shutter', #PH (EX-Z77)
'18 0' => 'Anti-Shake', #PH (EX-Z77)
'20 0' => 'High Sensitivity', #PH (EX-Z77)
# EX-Z2000 in 'Auto' mode gives '0 3' or '2 3' (ref 6)
'0 1' => 'Off (1)', #6
'0 3' => 'CCD Shift', #PH/6 ("Camera AS" in EX-Z2000 manual)
'2 1' => 'High Sensitivity', #6
'2 3' => 'CCD Shift + High Sensitivity', #PH (EX-FC150)
# have also seen:
# '2 0' - EX-Z15 1/60s ISO 200, EX-Z77 1/1000s ISO 50
# '16 1' - EX-Z2300 1/125s ISO 50
},
},
0x302a => { #PH (EX-Z450)
Name => 'LightingMode', #(just guessing here)
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'High Dynamic Range', # (EX-Z77 anti-blur shot)
5 => 'Shadow Enhance Low', #(NC)
6 => 'Shadow Enhance High', #(NC)
},
},
0x302b => { #PH (EX-Z77)
Name => 'PortraitRefiner',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => '+1',
2 => '+2',
},
},
0x3030 => { #PH (EX-Z450)
Name => 'SpecialEffectLevel',
Writable => 'int16u',
},
0x3031 => { #PH (EX-Z450)
Name => 'SpecialEffectSetting',
Writable => 'int16u',
PrintConv => {
0 => 'Off',
1 => 'Makeup',
2 => 'Mist Removal',
3 => 'Vivid Landscape',
16 => 'Art Shot', # (EX-Z2300)
},
},
0x3103 => { #5
Name => 'DriveMode',
Writable => 'int16u',
PrintConvColumns => 2,
PrintConv => {
OTHER => sub {
# handle new values of future models
my ($val, $inv) = @_;
return $val =~ /(\d+)/ ? $1 : undef if $inv;
return "Continuous ($val fps)";
},
0 => 'Single Shot', #PH (NC)
1 => 'Continuous Shooting', # (1 fps for the EX-F1)
2 => 'Continuous (2 fps)',
3 => 'Continuous (3 fps)',
4 => 'Continuous (4 fps)',
5 => 'Continuous (5 fps)',
6 => 'Continuous (6 fps)',
7 => 'Continuous (7 fps)',
10 => 'Continuous (10 fps)',
12 => 'Continuous (12 fps)',
15 => 'Continuous (15 fps)',
20 => 'Continuous (20 fps)',
30 => 'Continuous (30 fps)',
40 => 'Continuous (40 fps)', #PH (EX-FH25)
60 => 'Continuous (60 fps)',
240 => 'Auto-N',
},
},
0x310b => { #PH (NC)
Name => 'ArtModeParameters',
Writable => 'int8u',
Count => 3,
# "0 1 0" = Toy camera 1
# "0 2 0" = Toy camera 1
# "0 3 0" = Toy camera 1
# Have also seen "0 0 0" and "2 0 0"
},
0x4001 => { #PH (AVI videos)
Name => 'CaptureFrameRate',
Writable => 'int16u',
Count => -1,
ValueConv => q{
my @v=split(" ",$val);
return $val / 1000 if @v == 1;
return $v[1] ? "$v[1]-$v[0]" : ($v[0] > 10000 ? $v[0] / 1000 : $v[0]);
},
ValueConvInv => '$val <= 60 ? $val * 1000 : int($val) . " 0"',
},
# 0x4002 - AVI videos, related to video quality or size - PH
0x4003 => { #PH (AVI and MOV videos)
Name => 'VideoQuality',
Writable => 'int16u',
PrintConv => {
1 => 'Standard',
# 2 - could this be LP?
3 => 'HD (720p)',
4 => 'Full HD (1080p)', # (EX-ZR10, 30fps 1920x1080)
5 => 'Low', # used in High Speed modes
},
},
);
# face detection information (ref PH) (EX-H5)
%Image::ExifTool::Casio::FaceInfo1 = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
WRITABLE => 1,
FIRST_ENTRY => 0,
DATAMEMBER => [ 0 ],
NOTES => 'Face-detect tags extracted from models such as the EX-H5.',
0x00 => { # (NC)
Name => 'FacesDetected',
DataMember => 'FacesDetected',
RawConv => '$$self{FacesDetected} = $val',
},
0x01 => {
Name => 'FaceDetectFrameSize',
Condition => '$$self{FacesDetected} >= 1', # (otherwise zeros)
Format => 'int16u[2]',
},
0x0d => {
Name => 'Face1Position',
Condition => '$$self{FacesDetected} >= 1',
Format => 'int16u[4]',
Notes => q{
left, top, right and bottom of detected face in coordinates of
FaceDetectFrameSize, with increasing Y downwards
},
},
# decoding NOT CONFIRMED (NC) for faces 2-10!
0x7c => {
Name => 'Face2Position',
Condition => '$$self{FacesDetected} >= 2',
Format => 'int16u[4]',
},
0xeb => {
Name => 'Face3Position',
Condition => '$$self{FacesDetected} >= 3',
Format => 'int16u[4]',
},
0x15a => {
Name => 'Face4Position',
Condition => '$$self{FacesDetected} >= 4',
Format => 'int16u[4]',
},
0x1c9 => {
Name => 'Face5Position',
Condition => '$$self{FacesDetected} >= 5',
Format => 'int16u[4]',
},
0x238 => {
Name => 'Face6Position',
Condition => '$$self{FacesDetected} >= 6',
Format => 'int16u[4]',
},
0x2a7 => {
Name => 'Face7Position',
Condition => '$$self{FacesDetected} >= 7',
Format => 'int16u[4]',
},
0x316 => {
Name => 'Face8Position',
Condition => '$$self{FacesDetected} >= 8',
Format => 'int16u[4]',
},
0x385 => {
Name => 'Face9Position',
Condition => '$$self{FacesDetected} >= 9',
Format => 'int16u[4]',
},
0x3f4 => {
Name => 'Face10Position',
Condition => '$$self{FacesDetected} >= 10',
Format => 'int16u[4]',
},
);
# face detection information (ref PH) (EX-ZR100)
%Image::ExifTool::Casio::FaceInfo2 = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
WRITE_PROC => \&Image::ExifTool::WriteBinaryData,
CHECK_PROC => \&Image::ExifTool::CheckBinaryData,
GROUPS => { 0 => 'MakerNotes', 2 => 'Image' },
WRITABLE => 1,
FIRST_ENTRY => 0,
DATAMEMBER => [ 2 ],
NOTES => 'Face-detect tags extracted from models such as the EX-H20G and EX-ZR100.',
0x02 => {
Name => 'FacesDetected',
DataMember => 'FacesDetected',
RawConv => '$$self{FacesDetected} = $val',
},
0x04 => {
Name => 'FaceDetectFrameSize',
Condition => '$$self{FacesDetected} >= 1',
Format => 'int16u[2]',
},
0x08 => {
Name => 'FaceOrientation',
Condition => '$$self{FacesDetected} >= 1',
PrintConv => {
0 => 'Horizontal (normal)',
1 => 'Rotate 90 CW',
2 => 'Rotate 270 CW',
3 => 'Rotate 180', # (NC)
# (have seen 64 here, but image had no face)
},
Notes => 'orientation of face relative to unrotated image',
},
# 0x0a - FaceDetectFrameSize again
# 0x11 - Face1Detected flag (1=detected)
0x18 => {
Name => 'Face1Position',
Condition => '$$self{FacesDetected} >= 1',
Format => 'int16u[4]',
Notes => q{
left, top, right and bottom of detected face in coordinates of
FaceDetectFrameSize, with increasing Y downwards
},
},
# 0x45 - Face2Detected, etc...
0x4c => {
Name => 'Face2Position',
Condition => '$$self{FacesDetected} >= 2',
Format => 'int16u[4]',
},
0x80 => {
Name => 'Face3Position',
Condition => '$$self{FacesDetected} >= 3',
Format => 'int16u[4]',
},
0xb4 => {
Name => 'Face4Position',
Condition => '$$self{FacesDetected} >= 4',
Format => 'int16u[4]',
},
0xe8 => {
Name => 'Face5Position',
Condition => '$$self{FacesDetected} >= 5',
Format => 'int16u[4]',
},
0x11c => {
Name => 'Face6Position',
Condition => '$$self{FacesDetected} >= 6',
Format => 'int16u[4]',
},
0x150 => {
Name => 'Face7Position',
Condition => '$$self{FacesDetected} >= 7',
Format => 'int16u[4]',
},
0x184 => {
Name => 'Face8Position',
Condition => '$$self{FacesDetected} >= 8',
Format => 'int16u[4]',
},
0x1b8 => {
Name => 'Face9Position',
Condition => '$$self{FacesDetected} >= 9',
Format => 'int16u[4]',
},
0x1ec => {
Name => 'Face10Position',
Condition => '$$self{FacesDetected} >= 10',
Format => 'int16u[4]',
},
);
# Casio APP1 QVCI segment found in QV-7000SX images (ref PH)
%Image::ExifTool::Casio::QVCI = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
FIRST_ENTRY => 0,
NOTES => q{
This information is found in the APP1 QVCI segment of JPEG images from the
Casio QV-7000SX.
},
0x2c => {
Name => 'CasioQuality',
PrintConv => {
1 => 'Economy',
2 => 'Normal',
3 => 'Fine',
4 => 'Super Fine',
},
},
0x37 => {
Name => 'FocalRange',
Unknown => 1,
},
0x4d => {
Name => 'DateTimeOriginal',
Description => 'Date/Time Original',
Format => 'string[20]',
Groups => { 2 => 'Time' },
ValueConv => '$val=~tr/./:/; $val=~s/(\d+:\d+:\d+):/$1 /; $val',
PrintConv => '$self->ConvertDateTime($val)',
},
0x62 => {
Name => 'ModelType',
Format => 'string[7]',
},
0x72 => { # could be serial number or manufacture date in form YYMMDDxx ?
Name => 'ManufactureIndex',
Format => 'string[9]',
},
0x7c => {
Name => 'ManufactureCode',
Format => 'string[9]',
},
);
# tags in Casio AVI videos (ref PH)
%Image::ExifTool::Casio::AVI = (
PROCESS_PROC => \&Image::ExifTool::ProcessBinaryData,
GROUPS => { 0 => 'MakerNotes', 2 => 'Camera' },
FIRST_ENTRY => 0,
NOTES => 'This information is found in Casio GV-10 AVI videos.',
0 => {
Name => 'Software', # (equivalent to RIFF Software tag)
Format => 'string',
},
);
1; # end
__END__
=head1 NAME
Image::ExifTool::Casio - Casio EXIF maker notes tags
=head1 SYNOPSIS
This module is loaded automatically by Image::ExifTool when required.
=head1 DESCRIPTION
This module contains definitions required by Image::ExifTool to interpret
Casio maker notes in EXIF information.
=head1 AUTHOR
Copyright 2003-2022, Phil Harvey (philharvey66 at gmail.com)
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 REFERENCES
=over 4
=item L<http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html>
=back
=head1 ACKNOWLEDGEMENTS
Thanks to Joachim Loehr for adding support for the type 2 maker notes, and
Jens Duttke and Robert Chi for decoding some tags.
=head1 SEE ALSO
L<Image::ExifTool::TagNames/Casio Tags>,
L<Image::ExifTool(3pm)|Image::ExifTool>
=cut
| 30.909753 | 231 | 0.41025 |
ed090636fcd4cb3794fcd6ce49888895a7e06830 | 8,269 | pm | Perl | cygwin/perl5.14/lib/perl5/DateTime/Locale/az_Latn.pm | rwhitworth/precompiled-perl-mods | bbcfaa3e1663eaac8d770548ca275c50c5eead97 | [
"Artistic-2.0"
]
| 8 | 2018-08-13T18:50:15.000Z | 2021-11-02T05:09:44.000Z | cygwin/perl5.14/lib/perl5/DateTime/Locale/az_Latn.pm | rwhitworth/precompiled-perl-mods | bbcfaa3e1663eaac8d770548ca275c50c5eead97 | [
"Artistic-2.0"
]
| null | null | null | cygwin/perl5.14/lib/perl5/DateTime/Locale/az_Latn.pm | rwhitworth/precompiled-perl-mods | bbcfaa3e1663eaac8d770548ca275c50c5eead97 | [
"Artistic-2.0"
]
| 4 | 2018-10-26T04:31:32.000Z | 2020-06-20T07:01:33.000Z | ###########################################################################
#
# This file is auto-generated by the Perl DateTime Suite locale
# generator (0.05). This code generator comes with the
# DateTime::Locale distribution in the tools/ directory, and is called
# generate-from-cldr.
#
# This file as generated from the CLDR XML locale data. See the
# LICENSE.cldr file included in this distribution for license details.
#
# This file was generated from the source file az_Latn.xml
# The source file version number was 1.30, generated on
# 2009/05/05 23:06:34.
#
# Do not edit this file directly.
#
###########################################################################
package DateTime::Locale::az_Latn;
use strict;
use warnings;
our $VERSION = '0.46';
use utf8;
use base 'DateTime::Locale::az';
sub cldr_version { return "1\.7\.1" }
{
my $first_day_of_week = "1";
sub first_day_of_week { return $first_day_of_week }
}
1;
__END__
=pod
=encoding utf8
=head1 NAME
DateTime::Locale::az_Latn
=head1 SYNOPSIS
use DateTime;
my $dt = DateTime->now( locale => 'az_Latn' );
print $dt->month_name();
=head1 DESCRIPTION
This is the DateTime locale package for Azerbaijani Latin.
=head1 DATA
This locale inherits from the L<DateTime::Locale::az> locale.
It contains the following data.
=head2 Days
=head3 Wide (format)
bazar ertəsi
çərşənbə axşamı
çərşənbə
cümə axşamı
cümə
şənbə
bazar
=head3 Abbreviated (format)
B.E.
Ç.A.
Ç.
C.A.
C
Ş.
B.
=head3 Narrow (format)
1
2
3
4
5
6
7
=head3 Wide (stand-alone)
bazar ertəsi
çərşənbə axşamı
çərşənbə
cümə axşamı
cümə
şənbə
bazar
=head3 Abbreviated (stand-alone)
B.E.
Ç.A.
Ç.
C.A.
C
Ş.
B.
=head3 Narrow (stand-alone)
1
2
3
4
5
6
7
=head2 Months
=head3 Wide (format)
Yanvar
Fevral
Mart
Aprel
May
İyun
İyul
Avqust
Sentyabr
Oktyabr
Noyabr
Dekabr
=head3 Abbreviated (format)
yan
fev
mar
apr
may
iyn
iyl
avq
sen
okt
noy
dek
=head3 Narrow (format)
1
2
3
4
5
6
7
8
9
10
11
12
=head3 Wide (stand-alone)
Yanvar
Fevral
Mart
Aprel
May
İyun
İyul
Avqust
Sentyabr
Oktyabr
Noyabr
Dekabr
=head3 Abbreviated (stand-alone)
yan
fev
mar
apr
may
iyn
iyl
avq
sen
okt
noy
dek
=head3 Narrow (stand-alone)
1
2
3
4
5
6
7
8
9
10
11
12
=head2 Quarters
=head3 Wide (format)
1-ci kvartal
2-ci kvartal
3-cü kvartal
4-cü kvartal
=head3 Abbreviated (format)
1-ci kv.
2-ci kv.
3-cü kv.
4-cü kv.
=head3 Narrow (format)
1
2
3
4
=head3 Wide (stand-alone)
1-ci kvartal
2-ci kvartal
3-cü kvartal
4-cü kvartal
=head3 Abbreviated (stand-alone)
1-ci kv.
2-ci kv.
3-cü kv.
4-cü kv.
=head3 Narrow (stand-alone)
1
2
3
4
=head2 Eras
=head3 Wide
eramızdan əvvəl
bizim eramızın
=head3 Abbreviated
e.ə.
b.e.
=head3 Narrow
e.ə.
b.e.
=head2 Date Formats
=head3 Full
2008-02-05T18:30:30 = çərşənbə axşamı, 5, Fevral, 2008
1995-12-22T09:05:02 = cümə, 22, Dekabr, 1995
-0010-09-15T04:44:23 = şənbə, 15, Sentyabr, -10
=head3 Long
2008-02-05T18:30:30 = 5 Fevral , 2008
1995-12-22T09:05:02 = 22 Dekabr , 1995
-0010-09-15T04:44:23 = 15 Sentyabr , -10
=head3 Medium
2008-02-05T18:30:30 = 5 fev, 2008
1995-12-22T09:05:02 = 22 dek, 1995
-0010-09-15T04:44:23 = 15 sen, -10
=head3 Short
2008-02-05T18:30:30 = 08/02/05
1995-12-22T09:05:02 = 95/12/22
-0010-09-15T04:44:23 = -10/09/15
=head3 Default
2008-02-05T18:30:30 = 5 fev, 2008
1995-12-22T09:05:02 = 22 dek, 1995
-0010-09-15T04:44:23 = 15 sen, -10
=head2 Time Formats
=head3 Full
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 18:30:30 UTC
1995-12-22T09:05:02 = 09:05:02 UTC
-0010-09-15T04:44:23 = 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head3 Short
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 09:05
-0010-09-15T04:44:23 = 04:44
=head3 Default
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 09:05:02
-0010-09-15T04:44:23 = 04:44:23
=head2 Datetime Formats
=head3 Full
2008-02-05T18:30:30 = çərşənbə axşamı, 5, Fevral, 2008 18:30:30 UTC
1995-12-22T09:05:02 = cümə, 22, Dekabr, 1995 09:05:02 UTC
-0010-09-15T04:44:23 = şənbə, 15, Sentyabr, -10 04:44:23 UTC
=head3 Long
2008-02-05T18:30:30 = 5 Fevral , 2008 18:30:30 UTC
1995-12-22T09:05:02 = 22 Dekabr , 1995 09:05:02 UTC
-0010-09-15T04:44:23 = 15 Sentyabr , -10 04:44:23 UTC
=head3 Medium
2008-02-05T18:30:30 = 5 fev, 2008 18:30:30
1995-12-22T09:05:02 = 22 dek, 1995 09:05:02
-0010-09-15T04:44:23 = 15 sen, -10 04:44:23
=head3 Short
2008-02-05T18:30:30 = 08/02/05 18:30
1995-12-22T09:05:02 = 95/12/22 09:05
-0010-09-15T04:44:23 = -10/09/15 04:44
=head3 Default
2008-02-05T18:30:30 = 5 fev, 2008 18:30:30
1995-12-22T09:05:02 = 22 dek, 1995 09:05:02
-0010-09-15T04:44:23 = 15 sen, -10 04:44:23
=head2 Available Formats
=head3 d (d)
2008-02-05T18:30:30 = 5
1995-12-22T09:05:02 = 22
-0010-09-15T04:44:23 = 15
=head3 EEEd (d EEE)
2008-02-05T18:30:30 = 5 Ç.A.
1995-12-22T09:05:02 = 22 C
-0010-09-15T04:44:23 = 15 Ş.
=head3 Hm (H:mm)
2008-02-05T18:30:30 = 18:30
1995-12-22T09:05:02 = 9:05
-0010-09-15T04:44:23 = 4:44
=head3 hm (h:mm a)
2008-02-05T18:30:30 = 6:30 PM
1995-12-22T09:05:02 = 9:05 AM
-0010-09-15T04:44:23 = 4:44 AM
=head3 Hms (H:mm:ss)
2008-02-05T18:30:30 = 18:30:30
1995-12-22T09:05:02 = 9:05:02
-0010-09-15T04:44:23 = 4:44:23
=head3 hms (h:mm:ss a)
2008-02-05T18:30:30 = 6:30:30 PM
1995-12-22T09:05:02 = 9:05:02 AM
-0010-09-15T04:44:23 = 4:44:23 AM
=head3 M (L)
2008-02-05T18:30:30 = 2
1995-12-22T09:05:02 = 12
-0010-09-15T04:44:23 = 9
=head3 Md (M-d)
2008-02-05T18:30:30 = 2-5
1995-12-22T09:05:02 = 12-22
-0010-09-15T04:44:23 = 9-15
=head3 MEd (E, M-d)
2008-02-05T18:30:30 = Ç.A., 2-5
1995-12-22T09:05:02 = C, 12-22
-0010-09-15T04:44:23 = Ş., 9-15
=head3 MMM (LLL)
2008-02-05T18:30:30 = fev
1995-12-22T09:05:02 = dek
-0010-09-15T04:44:23 = sen
=head3 MMMd (MMM d)
2008-02-05T18:30:30 = fev 5
1995-12-22T09:05:02 = dek 22
-0010-09-15T04:44:23 = sen 15
=head3 MMMEd (E MMM d)
2008-02-05T18:30:30 = Ç.A. fev 5
1995-12-22T09:05:02 = C dek 22
-0010-09-15T04:44:23 = Ş. sen 15
=head3 MMMMd (MMMM d)
2008-02-05T18:30:30 = Fevral 5
1995-12-22T09:05:02 = Dekabr 22
-0010-09-15T04:44:23 = Sentyabr 15
=head3 MMMMEd (E MMMM d)
2008-02-05T18:30:30 = Ç.A. Fevral 5
1995-12-22T09:05:02 = C Dekabr 22
-0010-09-15T04:44:23 = Ş. Sentyabr 15
=head3 ms (mm:ss)
2008-02-05T18:30:30 = 30:30
1995-12-22T09:05:02 = 05:02
-0010-09-15T04:44:23 = 44:23
=head3 y (y)
2008-02-05T18:30:30 = 2008
1995-12-22T09:05:02 = 1995
-0010-09-15T04:44:23 = -10
=head3 yM (y-M)
2008-02-05T18:30:30 = 2008-2
1995-12-22T09:05:02 = 1995-12
-0010-09-15T04:44:23 = -10-9
=head3 yMEd (EEE, y-M-d)
2008-02-05T18:30:30 = Ç.A., 2008-2-5
1995-12-22T09:05:02 = C, 1995-12-22
-0010-09-15T04:44:23 = Ş., -10-9-15
=head3 yMMM (y MMM)
2008-02-05T18:30:30 = 2008 fev
1995-12-22T09:05:02 = 1995 dek
-0010-09-15T04:44:23 = -10 sen
=head3 yMMMEd (EEE, y MMM d)
2008-02-05T18:30:30 = Ç.A., 2008 fev 5
1995-12-22T09:05:02 = C, 1995 dek 22
-0010-09-15T04:44:23 = Ş., -10 sen 15
=head3 yMMMM (y MMMM)
2008-02-05T18:30:30 = 2008 Fevral
1995-12-22T09:05:02 = 1995 Dekabr
-0010-09-15T04:44:23 = -10 Sentyabr
=head3 yQ (y Q)
2008-02-05T18:30:30 = 2008 1
1995-12-22T09:05:02 = 1995 4
-0010-09-15T04:44:23 = -10 3
=head3 yQQQ (y QQQ)
2008-02-05T18:30:30 = 2008 1-ci kv.
1995-12-22T09:05:02 = 1995 4-cü kv.
-0010-09-15T04:44:23 = -10 3-cü kv.
=head3 yyQ (Q yy)
2008-02-05T18:30:30 = 1 08
1995-12-22T09:05:02 = 4 95
-0010-09-15T04:44:23 = 3 -10
=head2 Miscellaneous
=head3 Prefers 24 hour time?
Yes
=head3 Local first day of the week
bazar ertəsi
=head1 SUPPORT
See L<DateTime::Locale>.
=cut
| 15.312963 | 75 | 0.618454 |
ed1686c7082412dedf1cc0d0eb02ceae73e09fbb | 4,075 | t | Perl | t/11-inet6.t | gitpan/Net-DNS | a99fcea22c6695e77375eef2b0d217f3940a375c | [
"ISC"
]
| null | null | null | t/11-inet6.t | gitpan/Net-DNS | a99fcea22c6695e77375eef2b0d217f3940a375c | [
"ISC"
]
| null | null | null | t/11-inet6.t | gitpan/Net-DNS | a99fcea22c6695e77375eef2b0d217f3940a375c | [
"ISC"
]
| null | null | null | # $Id: 11-inet6.t 754 2008-12-22 12:48:09Z olaf $ -*-perl-*-
use Test::More;
use strict;
BEGIN {
if (-e 't/IPv6.enabled' && ! -e 't/IPv6.disabled' ) {
plan tests => 10;
} else {
plan skip_all => 'Online tests disabled.';
exit;
}
}
my $answer;
my $res= Net::DNS::Resolver->new;
;
my $res2;
my $AAAA_address;
my $A_address;
# If there is IPv6 transport only then this works too.
my $nsanswer=$res->send("net-dns.org","NS","IN");
is (($nsanswer->answer)[0]->type, "NS","Preparing for v6 transport, got NS records for net-dns.org");
my $found_ns=0;
foreach my $ns ($nsanswer->answer){
next if $ns->nsdname !~ /net-dns\.org$/i; # User net-dns.org only
my $aaaa_answer=$res->send($ns->nsdname,"AAAA","IN");
next if ($aaaa_answer->header->ancount == 0);
is (($aaaa_answer->answer)[0]->type,"AAAA", "Preparing for v6 transport, got AAAA records for ". $ns->nsdname);
$AAAA_address=($aaaa_answer->answer)[0]->address;
$found_ns=1;
diag ("\n\t\t Will try to connect to ". $ns->nsdname . " ($AAAA_address)");
last;
}
ok(1,"Dummy test: No AAA Records found, we will skip some other tests") unless $found_ns;
$res->nameservers($AAAA_address);
#$res->print;
$answer=$res->send("net-dns.org","SOA","IN");
is (($answer->answer)[0]->type, "SOA","Query over udp6 succeeded");
$res->usevc(1);
$res->force_v4(1);
# $res->print;
# $res->debug(1);
$answer=$res->send("net-dns.org","SOA","IN");
is ($res->errorstring,"no nameservers","Correct errorstring when forcing v4");
$res->force_v4(0);
$answer=$res->send("net-dns.org","NS","IN");
if ($answer){
is (($answer->answer)[0]->type, "NS","Query over tcp6 succeeded");
}else{
diag "You can safely ignore the following message:";
diag ($res->errorstring) if ($res->errorstring ne "connection failed(IPv6 socket failure)");
diag ("configuring ".$AAAA_address." ". $A_address." as nameservers");
$res->nameservers($AAAA_address,$A_address);
undef $answer;
# $res->print;
$answer=$res->send("net-dns.org","NS","IN");
is (($answer->answer)[0]->type, "NS","Fallback to V4 succeeded");
}
#
#
# Now test AXFR functionality.
#
#
my $socket;
SKIP: { skip "online tests are not enabled", 2 unless (-e 't/IPv6.enabled' && ! -e 't/IPv6.disabled');
# First use the local resolver to query for the AAAA record of a
$res2=Net::DNS::Resolver->new;
# $res2->debug(1);
my $nsanswer=$res2->send("net-dns.org","NS","IN");
SKIP:{ skip "No answers for NS queries",2 unless $nsanswer && ( $nsanswer->header->ancount != 0 );
is (($nsanswer->answer)[0]->type, "NS","Preparing for v6 transport, got NS records for net-dns.org");
my $AAAA_address;
foreach my $ns ($nsanswer->answer){
next if $ns->nsdname !~ /net-dns\.org$
/; # User net-dns.org only
my $aaaa_answer=$res2->send($ns->nsdname,"AAAA","IN");
next if ($aaaa_answer->header->ancount == 0);
is (($aaaa_answer->answer)[0]->type,"AAAA", "Preparing for v6 transport, got AAAA records for ". $ns->nsdname);
$AAAA_address=($aaaa_answer->answer)[0]->address;
diag ("\n\t\t Trying to connect to ". $ns->nsdname . " ($AAAA_address)");
last;
}
ok(1,"Dummy test: No AAAA Records found, we will skip some other tests") unless $AAAA_address;
$res2->nameservers($AAAA_address);
# $res2->print;
$socket=$res2->axfr_start('example.com');
}
}
SKIP: { skip "axfr_start did not return a socket", 2 unless defined($socket);
is(ref($socket),"IO::Socket::INET6","axfr_start returns IPv6 Socket");
my ($rr,$err)=$res2->axfr_next;
is($res2->errorstring,'Response code from server: NOTAUTH',"Transfer is not authorized (but our connection worked)");
}
use Net::DNS::Nameserver;
my $ns = Net::DNS::Nameserver->new(
LocalAddr => ['::1' ],
LocalPort => "5363",
ReplyHandler => \&reply_handler,
Verbose => 1
);
ok($ns,"nameserver object created on IPv6 ::1");
| 27.533784 | 118 | 0.607607 |
73d53ae874b0a8149c85fe682dac4cfffb672e05 | 19,820 | pm | Perl | perl/src/lib/ExtUtils/CBuilder/Platform/Windows.pm | nokibsarkar/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
]
| 2,293 | 2015-01-02T12:46:10.000Z | 2022-03-29T09:45:43.000Z | perl/src/lib/ExtUtils/CBuilder/Platform/Windows.pm | nokibsarkar/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
]
| 315 | 2015-05-31T11:55:46.000Z | 2022-01-12T08:36:37.000Z | perl/src/lib/ExtUtils/CBuilder/Platform/Windows.pm | nokibsarkar/sl4a | d3c17dca978cbeee545e12ea240a9dbf2a6999e9 | [
"Apache-2.0"
]
| 1,033 | 2015-01-04T07:48:40.000Z | 2022-03-24T09:34:37.000Z | package ExtUtils::CBuilder::Platform::Windows;
use strict;
use warnings;
use File::Basename;
use File::Spec;
use ExtUtils::CBuilder::Base;
use IO::File;
use vars qw($VERSION @ISA);
$VERSION = '0.2602';
@ISA = qw(ExtUtils::CBuilder::Base);
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
my $cf = $self->{config};
# Inherit from an appropriate compiler driver class
unshift @ISA, "ExtUtils::CBuilder::Platform::Windows::" . $self->_compiler_type;
return $self;
}
sub _compiler_type {
my $self = shift;
my $cc = $self->{config}{cc};
return ( $cc =~ /cl(\.exe)?$/ ? 'MSVC'
: $cc =~ /bcc32(\.exe)?$/ ? 'BCC'
: 'GCC');
}
sub split_like_shell {
# Since Windows will pass the whole command string (not an argument
# array) to the target program and make the program parse it itself,
# we don't actually need to do any processing here.
(my $self, local $_) = @_;
return @$_ if defined() && UNIVERSAL::isa($_, 'ARRAY');
return unless defined() && length();
return ($_);
}
sub do_system {
# See above
my $self = shift;
my $cmd = join(" ",
grep length,
map {$a=$_;$a=~s/\t/ /g;$a=~s/^\s+|\s+$//;$a}
grep defined, @_);
return $self->SUPER::do_system($cmd);
}
sub arg_defines {
my ($self, %args) = @_;
s/"/\\"/g foreach values %args;
return map qq{"-D$_=$args{$_}"}, keys %args;
}
sub compile {
my ($self, %args) = @_;
my $cf = $self->{config};
die "Missing 'source' argument to compile()" unless defined $args{source};
my ($basename, $srcdir) =
( File::Basename::fileparse($args{source}, '\.[^.]+$') )[0,1];
$srcdir ||= File::Spec->curdir();
my @defines = $self->arg_defines( %{ $args{defines} || {} } );
my %spec = (
srcdir => $srcdir,
builddir => $srcdir,
basename => $basename,
source => $args{source},
output => File::Spec->catfile($srcdir, $basename) . $cf->{obj_ext},
cc => $cf->{cc},
cflags => [
$self->split_like_shell($cf->{ccflags}),
$self->split_like_shell($cf->{cccdlflags}),
$self->split_like_shell($args{extra_compiler_flags}),
],
optimize => [ $self->split_like_shell($cf->{optimize}) ],
defines => \@defines,
includes => [ @{$args{include_dirs} || []} ],
perlinc => [
$self->perl_inc(),
$self->split_like_shell($cf->{incpath}),
],
use_scripts => 1, # XXX provide user option to change this???
);
$self->normalize_filespecs(
\$spec{source},
\$spec{output},
$spec{includes},
$spec{perlinc},
);
my @cmds = $self->format_compiler_cmd(%spec);
while ( my $cmd = shift @cmds ) {
$self->do_system( @$cmd )
or die "error building $cf->{dlext} file from '$args{source}'";
}
(my $out = $spec{output}) =~ tr/'"//d;
return $out;
}
sub need_prelink { 1 }
sub link {
my ($self, %args) = @_;
my $cf = $self->{config};
my @objects = ( ref $args{objects} eq 'ARRAY' ? @{$args{objects}} : $args{objects} );
my $to = join '', (File::Spec->splitpath($objects[0]))[0,1];
$to ||= File::Spec->curdir();
(my $file_base = $args{module_name}) =~ s/.*:://;
my $output = $args{lib_file} ||
File::Spec->catfile($to, "$file_base.$cf->{dlext}");
# if running in perl source tree, look for libs there, not installed
my $lddlflags = $cf->{lddlflags};
my $perl_src = $self->perl_src();
$lddlflags =~ s/\Q$cf->{archlibexp}\E[\\\/]CORE/$perl_src/ if $perl_src;
my %spec = (
srcdir => $to,
builddir => $to,
startup => [ ],
objects => \@objects,
libs => [ ],
output => $output,
ld => $cf->{ld},
libperl => $cf->{libperl},
perllibs => [ $self->split_like_shell($cf->{perllibs}) ],
libpath => [ $self->split_like_shell($cf->{libpth}) ],
lddlflags => [ $self->split_like_shell($lddlflags) ],
other_ldflags => [ $self->split_like_shell($args{extra_linker_flags} || '') ],
use_scripts => 1, # XXX provide user option to change this???
);
unless ( $spec{basename} ) {
($spec{basename} = $args{module_name}) =~ s/.*:://;
}
$spec{srcdir} = File::Spec->canonpath( $spec{srcdir} );
$spec{builddir} = File::Spec->canonpath( $spec{builddir} );
$spec{output} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . '.'.$cf->{dlext} );
$spec{manifest} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . '.'.$cf->{dlext}.'.manifest');
$spec{implib} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . $cf->{lib_ext} );
$spec{explib} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . '.exp' );
if ($cf->{cc} eq 'cl') {
$spec{dbg_file} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . '.pdb' );
}
elsif ($cf->{cc} eq 'bcc32') {
$spec{dbg_file} ||= File::Spec->catfile( $spec{builddir},
$spec{basename} . '.tds' );
}
$spec{def_file} ||= File::Spec->catfile( $spec{srcdir} ,
$spec{basename} . '.def' );
$spec{base_file} ||= File::Spec->catfile( $spec{srcdir} ,
$spec{basename} . '.base' );
$self->add_to_cleanup(
grep defined,
@{[ @spec{qw(manifest implib explib dbg_file def_file base_file map_file)} ]}
);
foreach my $opt ( qw(output manifest implib explib dbg_file def_file map_file base_file) ) {
$self->normalize_filespecs( \$spec{$opt} );
}
foreach my $opt ( qw(libpath startup objects) ) {
$self->normalize_filespecs( $spec{$opt} );
}
(my $def_base = $spec{def_file}) =~ tr/'"//d;
$def_base =~ s/\.def$//;
$self->prelink( dl_name => $args{module_name},
dl_file => $def_base,
dl_base => $spec{basename} );
my @cmds = $self->format_linker_cmd(%spec);
while ( my $cmd = shift @cmds ) {
$self->do_system( @$cmd );
}
$spec{output} =~ tr/'"//d;
return wantarray
? grep defined, @spec{qw[output manifest implib explib dbg_file def_file map_file base_file]}
: $spec{output};
}
# canonize & quote paths
sub normalize_filespecs {
my ($self, @specs) = @_;
foreach my $spec ( grep defined, @specs ) {
if ( ref $spec eq 'ARRAY') {
$self->normalize_filespecs( map {\$_} grep defined, @$spec )
} elsif ( ref $spec eq 'SCALAR' ) {
$$spec =~ tr/"//d if $$spec;
next unless $$spec;
$$spec = '"' . File::Spec->canonpath($$spec) . '"';
} elsif ( ref $spec eq '' ) {
$spec = '"' . File::Spec->canonpath($spec) . '"';
} else {
die "Don't know how to normalize " . (ref $spec || $spec) . "\n";
}
}
}
# directory of perl's include files
sub perl_inc {
my $self = shift;
my $perl_src = $self->perl_src();
if ($perl_src) {
File::Spec->catdir($perl_src, "lib", "CORE");
} else {
File::Spec->catdir($self->{config}{archlibexp},"CORE");
}
}
1;
########################################################################
=begin comment
The packages below implement functions for generating properly
formatted commandlines for the compiler being used. Each package
defines two primary functions 'format_linker_cmd()' &
'format_compiler_cmd()' that accepts a list of named arguments (a
hash) and returns a list of formatted options suitable for invoking the
compiler. By default, if the compiler supports scripting of its
operation then a script file is built containing the options while
those options are removed from the commandline, and a reference to the
script is pushed onto the commandline in their place. Scripting the
compiler in this way helps to avoid the problems associated with long
commandlines under some shells.
=end comment
=cut
########################################################################
package ExtUtils::CBuilder::Platform::Windows::MSVC;
sub format_compiler_cmd {
my ($self, %spec) = @_;
foreach my $path ( @{ $spec{includes} || [] },
@{ $spec{perlinc} || [] } ) {
$path = '-I' . $path;
}
%spec = $self->write_compiler_script(%spec)
if $spec{use_scripts};
return [ grep {defined && length} (
$spec{cc},'-nologo','-c',
@{$spec{includes}} ,
@{$spec{cflags}} ,
@{$spec{optimize}} ,
@{$spec{defines}} ,
@{$spec{perlinc}} ,
"-Fo$spec{output}" ,
$spec{source} ,
) ];
}
sub write_compiler_script {
my ($self, %spec) = @_;
my $script = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.ccs' );
$self->add_to_cleanup($script);
print "Generating script '$script'\n" if !$self->{quiet};
my $SCRIPT = IO::File->new( ">$script" )
or die( "Could not create script '$script': $!" );
print $SCRIPT join( "\n",
map { ref $_ ? @{$_} : $_ }
grep defined,
delete(
@spec{ qw(includes cflags optimize defines perlinc) } )
);
push @{$spec{includes}}, '@"' . $script . '"';
return %spec;
}
sub format_linker_cmd {
my ($self, %spec) = @_;
my $cf = $self->{config};
foreach my $path ( @{$spec{libpath}} ) {
$path = "-libpath:$path";
}
my $output = $spec{output};
$spec{def_file} &&= '-def:' . $spec{def_file};
$spec{output} &&= '-out:' . $spec{output};
$spec{manifest} &&= '-manifest ' . $spec{manifest};
$spec{implib} &&= '-implib:' . $spec{implib};
$spec{map_file} &&= '-map:' . $spec{map_file};
%spec = $self->write_linker_script(%spec)
if $spec{use_scripts};
my @cmds; # Stores the series of commands needed to build the module.
push @cmds, [ grep {defined && length} (
$spec{ld} ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{other_ldflags}} ,
@{$spec{startup}} ,
@{$spec{objects}} ,
$spec{map_file} ,
$spec{libperl} ,
@{$spec{perllibs}} ,
$spec{def_file} ,
$spec{implib} ,
$spec{output} ,
) ];
# Embed the manifest file for VC 2005 (aka VC 8) or higher, but not for the 64-bit Platform SDK compiler
if ($cf->{ivsize} == 4 && $cf->{cc} eq 'cl' and $cf->{ccversion} =~ /^(\d+)/ and $1 >= 14) {
push @cmds, [
'if', 'exist', $spec{manifest}, 'mt', '-nologo', $spec{manifest}, '-outputresource:' . "$output;2"
];
}
return @cmds;
}
sub write_linker_script {
my ($self, %spec) = @_;
my $script = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.lds' );
$self->add_to_cleanup($script);
print "Generating script '$script'\n" if !$self->{quiet};
my $SCRIPT = IO::File->new( ">$script" )
or die( "Could not create script '$script': $!" );
print $SCRIPT join( "\n",
map { ref $_ ? @{$_} : $_ }
grep defined,
delete(
@spec{ qw(lddlflags libpath other_ldflags
startup objects libperl perllibs
def_file implib map_file) } )
);
push @{$spec{lddlflags}}, '@"' . $script . '"';
return %spec;
}
1;
########################################################################
package ExtUtils::CBuilder::Platform::Windows::BCC;
sub format_compiler_cmd {
my ($self, %spec) = @_;
foreach my $path ( @{ $spec{includes} || [] },
@{ $spec{perlinc} || [] } ) {
$path = '-I' . $path;
}
%spec = $self->write_compiler_script(%spec)
if $spec{use_scripts};
return [ grep {defined && length} (
$spec{cc}, '-c' ,
@{$spec{includes}} ,
@{$spec{cflags}} ,
@{$spec{optimize}} ,
@{$spec{defines}} ,
@{$spec{perlinc}} ,
"-o$spec{output}" ,
$spec{source} ,
) ];
}
sub write_compiler_script {
my ($self, %spec) = @_;
my $script = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.ccs' );
$self->add_to_cleanup($script);
print "Generating script '$script'\n" if !$self->{quiet};
my $SCRIPT = IO::File->new( ">$script" )
or die( "Could not create script '$script': $!" );
# XXX Borland "response files" seem to be unable to accept macro
# definitions containing quoted strings. Escaping strings with
# backslash doesn't work, and any level of quotes are stripped. The
# result is is a floating point number in the source file where a
# string is expected. So we leave the macros on the command line.
print $SCRIPT join( "\n",
map { ref $_ ? @{$_} : $_ }
grep defined,
delete(
@spec{ qw(includes cflags optimize perlinc) } )
);
push @{$spec{includes}}, '@"' . $script . '"';
return %spec;
}
sub format_linker_cmd {
my ($self, %spec) = @_;
foreach my $path ( @{$spec{libpath}} ) {
$path = "-L$path";
}
push( @{$spec{startup}}, 'c0d32.obj' )
unless ( $spec{starup} && @{$spec{startup}} );
%spec = $self->write_linker_script(%spec)
if $spec{use_scripts};
return [ grep {defined && length} (
$spec{ld} ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{other_ldflags}} ,
@{$spec{startup}} ,
@{$spec{objects}} , ',',
$spec{output} , ',',
$spec{map_file} , ',',
$spec{libperl} ,
@{$spec{perllibs}} , ',',
$spec{def_file}
) ];
}
sub write_linker_script {
my ($self, %spec) = @_;
# To work around Borlands "unique" commandline syntax,
# two scripts are used:
my $ld_script = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.lds' );
my $ld_libs = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.lbs' );
$self->add_to_cleanup($ld_script, $ld_libs);
print "Generating scripts '$ld_script' and '$ld_libs'.\n" if !$self->{quiet};
# Script 1: contains options & names of object files.
my $LD_SCRIPT = IO::File->new( ">$ld_script" )
or die( "Could not create linker script '$ld_script': $!" );
print $LD_SCRIPT join( " +\n",
map { @{$_} }
grep defined,
delete(
@spec{ qw(lddlflags libpath other_ldflags startup objects) } )
);
# Script 2: contains name of libs to link against.
my $LD_LIBS = IO::File->new( ">$ld_libs" )
or die( "Could not create linker script '$ld_libs': $!" );
print $LD_LIBS join( " +\n",
(delete $spec{libperl} || ''),
@{delete $spec{perllibs} || []},
);
push @{$spec{lddlflags}}, '@"' . $ld_script . '"';
push @{$spec{perllibs}}, '@"' . $ld_libs . '"';
return %spec;
}
1;
########################################################################
package ExtUtils::CBuilder::Platform::Windows::GCC;
sub format_compiler_cmd {
my ($self, %spec) = @_;
foreach my $path ( @{ $spec{includes} || [] },
@{ $spec{perlinc} || [] } ) {
$path = '-I' . $path;
}
# split off any -arguments included in cc
my @cc = split / (?=-)/, $spec{cc};
return [ grep {defined && length} (
@cc, '-c' ,
@{$spec{includes}} ,
@{$spec{cflags}} ,
@{$spec{optimize}} ,
@{$spec{defines}} ,
@{$spec{perlinc}} ,
'-o', $spec{output} ,
$spec{source} ,
) ];
}
sub format_linker_cmd {
my ($self, %spec) = @_;
# The Config.pm variable 'libperl' is hardcoded to the full name
# of the perl import library (i.e. 'libperl56.a'). GCC will not
# find it unless the 'lib' prefix & the extension are stripped.
$spec{libperl} =~ s/^(?:lib)?([^.]+).*$/-l$1/;
unshift( @{$spec{other_ldflags}}, '-nostartfiles' )
if ( $spec{startup} && @{$spec{startup}} );
# From ExtUtils::MM_Win32:
#
## one thing for GCC/Mingw32:
## we try to overcome non-relocateable-DLL problems by generating
## a (hopefully unique) image-base from the dll's name
## -- BKS, 10-19-1999
File::Basename::basename( $spec{output} ) =~ /(....)(.{0,4})/;
$spec{image_base} = sprintf( "0x%x0000", unpack('n', $1 ^ $2) );
%spec = $self->write_linker_script(%spec)
if $spec{use_scripts};
foreach my $path ( @{$spec{libpath}} ) {
$path = "-L$path";
}
my @cmds; # Stores the series of commands needed to build the module.
push @cmds, [
'dlltool', '--def' , $spec{def_file},
'--output-exp' , $spec{explib}
];
# split off any -arguments included in ld
my @ld = split / (?=-)/, $spec{ld};
push @cmds, [ grep {defined && length} (
@ld ,
'-o', $spec{output} ,
"-Wl,--base-file,$spec{base_file}" ,
"-Wl,--image-base,$spec{image_base}" ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{startup}} ,
@{$spec{objects}} ,
@{$spec{other_ldflags}} ,
$spec{libperl} ,
@{$spec{perllibs}} ,
$spec{explib} ,
$spec{map_file} ? ('-Map', $spec{map_file}) : ''
) ];
push @cmds, [
'dlltool', '--def' , $spec{def_file},
'--output-exp' , $spec{explib},
'--base-file' , $spec{base_file}
];
push @cmds, [ grep {defined && length} (
@ld ,
'-o', $spec{output} ,
"-Wl,--image-base,$spec{image_base}" ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{startup}} ,
@{$spec{objects}} ,
@{$spec{other_ldflags}} ,
$spec{libperl} ,
@{$spec{perllibs}} ,
$spec{explib} ,
$spec{map_file} ? ('-Map', $spec{map_file}) : ''
) ];
return @cmds;
}
sub write_linker_script {
my ($self, %spec) = @_;
my $script = File::Spec->catfile( $spec{srcdir},
$spec{basename} . '.lds' );
$self->add_to_cleanup($script);
print "Generating script '$script'\n" if !$self->{quiet};
my $SCRIPT = IO::File->new( ">$script" )
or die( "Could not create script '$script': $!" );
print $SCRIPT ( 'SEARCH_DIR(' . $_ . ")\n" )
for @{delete $spec{libpath} || []};
# gcc takes only one startup file, so the first object in startup is
# specified as the startup file and any others are shifted into the
# beginning of the list of objects.
if ( $spec{startup} && @{$spec{startup}} ) {
print $SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n";
unshift @{$spec{objects}},
@{delete $spec{startup} || []};
}
print $SCRIPT 'INPUT(' . join( ',',
@{delete $spec{objects} || []}
) . ")\n";
print $SCRIPT 'INPUT(' . join( ' ',
(delete $spec{libperl} || ''),
@{delete $spec{perllibs} || []},
) . ")\n";
push @{$spec{other_ldflags}}, '"' . $script . '"';
return %spec;
}
1;
__END__
=head1 NAME
ExtUtils::CBuilder::Platform::Windows - Builder class for Windows platforms
=head1 DESCRIPTION
This module implements the Windows-specific parts of ExtUtils::CBuilder.
Most of the Windows-specific stuff has to do with compiling and
linking C code. Currently we support the 3 compilers perl itself
supports: MSVC, BCC, and GCC.
This module inherits from C<ExtUtils::CBuilder::Base>, so any functionality
not implemented here will be implemented there. The interfaces are
defined by the L<ExtUtils::CBuilder> documentation.
=head1 AUTHOR
Ken Williams <ken@mathforum.org>
Most of the code here was written by Randy W. Sims <RandyS@ThePierianSpring.org>.
=head1 SEE ALSO
perl(1), ExtUtils::CBuilder(3), ExtUtils::MakeMaker(3)
=cut
| 28.934307 | 106 | 0.534763 |
ed1a92ce52d381036b6bae9eb4fb928d1591660b | 89 | pm | Perl | lib/VMOMI/VchaState.pm | restump/p5-vmomi | e2571d72a1f552ddd0258ad289ec229d8d12a147 | [
"Apache-2.0"
]
| 1 | 2020-07-22T21:56:34.000Z | 2020-07-22T21:56:34.000Z | lib/VMOMI/VchaState.pm | restump/p5-vmomi | e2571d72a1f552ddd0258ad289ec229d8d12a147 | [
"Apache-2.0"
]
| null | null | null | lib/VMOMI/VchaState.pm | restump/p5-vmomi | e2571d72a1f552ddd0258ad289ec229d8d12a147 | [
"Apache-2.0"
]
| 1 | 2016-07-19T19:56:09.000Z | 2016-07-19T19:56:09.000Z | package VMOMI::VchaState;
use parent 'VMOMI::SimpleType';
use strict;
use warnings;
1;
| 11.125 | 31 | 0.741573 |
73f9c3a2006e9909f835c25e648b2c937654a15b | 57 | pm | Perl | libapreq2/glue/perl/xsbuilder/APR/Request/Error/Error.pm | zippy1981/rapache | 6511812d2a46f129679c8a7508bab39d37909438 | [
"Apache-2.0"
]
| 74 | 2015-01-03T13:48:08.000Z | 2021-11-26T10:35:10.000Z | libapreq2/glue/perl/xsbuilder/APR/Request/Error/Error.pm | zippy1981/rapache | 6511812d2a46f129679c8a7508bab39d37909438 | [
"Apache-2.0"
]
| 27 | 2015-02-12T11:03:26.000Z | 2022-02-17T20:31:56.000Z | libapreq2/glue/perl/xsbuilder/APR/Request/Error/Error.pm | zippy1981/rapache | 6511812d2a46f129679c8a7508bab39d37909438 | [
"Apache-2.0"
]
| 29 | 2015-01-26T00:18:45.000Z | 2022-02-15T16:35:16.000Z | use APR::Error;
our @ISA = qw/APR::Error APR::Request/;
| 14.25 | 39 | 0.649123 |
73eb7eedb0da7fe811fb59d8f96b8ce064c0870d | 1,027 | t | Perl | t/009module/013dtm-mulinc.t | ChengCat/dale | 4a764895611679cd1670d9a43ffdbee136661759 | [
"BSD-3-Clause"
]
| 1,083 | 2015-03-18T09:42:49.000Z | 2022-03-29T03:17:47.000Z | t/009module/013dtm-mulinc.t | ChengCat/dale | 4a764895611679cd1670d9a43ffdbee136661759 | [
"BSD-3-Clause"
]
| 195 | 2015-01-04T03:06:41.000Z | 2022-03-18T18:16:27.000Z | t/009module/013dtm-mulinc.t | ChengCat/dale | 4a764895611679cd1670d9a43ffdbee136661759 | [
"BSD-3-Clause"
]
| 56 | 2015-03-18T20:02:13.000Z | 2022-01-22T19:35:27.000Z | #!/usr/bin/env perl
use warnings;
use strict;
$ENV{"DALE_TEST_ARGS"} ||= "";
my $test_dir = $ENV{"DALE_TEST_DIR"} || ".";
$ENV{PATH} .= ":.";
use Data::Dumper;
use Test::More tests => 5;
my @res = `dalec -O0 $test_dir/t/src/dtm1.dt -o ./t.dtm-mulinc.o -c -m ./mod1`;
is_deeply(\@res, [], 'no compilation errors');
@res = `dalec -O0 $test_dir/t/src/dtm2.dt -o ./t.dtm-mulinc.o -c -m ./mod2`;
is_deeply(\@res, [], 'no compilation errors');
@res = `dalec $ENV{"DALE_TEST_ARGS"} $test_dir/t/src/dtm-mulinc.dt -o dtm-mulinc`;
chomp for @res;
is_deeply(\@res,
[ ],
'no compilation errors');
@res = `./dtm-mulinc`;
is($?, 0, 'Program executed successfully');
chomp for @res;
is_deeply(\@res,
[ 'hello' ],
'Got expected results');
`rm libmod1.so`;
`rm libmod1-nomacros.so`;
`rm libmod2.so`;
`rm libmod2-nomacros.so`;
`rm libmod1.dtm`;
`rm libmod2.dtm`;
`rm libmod1.bc`;
`rm libmod1-nomacros.bc`;
`rm libmod2.bc`;
`rm libmod2-nomacros.bc`;
`rm dtm-mulinc`;
`rm t.dtm-mulinc.o`;
1;
| 22.326087 | 82 | 0.609542 |
ed054ade68e391ee0caa3cab02cf749574a6d3f8 | 805 | pm | Perl | tests/console/hibernation_enabled.pm | lansuse/os-autoinst-distri-opensuse | 8e8c532236f2436693ec1da426de563c9759d778 | [
"FSFAP"
]
| null | null | null | tests/console/hibernation_enabled.pm | lansuse/os-autoinst-distri-opensuse | 8e8c532236f2436693ec1da426de563c9759d778 | [
"FSFAP"
]
| null | null | null | tests/console/hibernation_enabled.pm | lansuse/os-autoinst-distri-opensuse | 8e8c532236f2436693ec1da426de563c9759d778 | [
"FSFAP"
]
| null | null | null | # SUSE's openQA tests
#
# Copyright 2020-2021 SUSE LLC
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
# Summary: Verify that "resume=" kernel parameter is present in the list of default parameters.
# This kernel parameter enables hibernation, it is not supported for all backends.
# See https://bugzilla.suse.com/show_bug.cgi?id=1188731
# Maintainer: QE YaST <qa-sle-yast@suse.de>
use base "consoletest";
use strict;
use warnings;
use testapi;
sub run {
select_console 'root-console';
assert_script_run("grep 'resume=' /proc/cmdline", fail_message => "resume parameter not found in /proc/cmdline");
}
1;
| 29.814815 | 117 | 0.752795 |
73fcf26f984d159bfd5356f5c3a5d46a64707105 | 1,121 | pm | Perl | lib/Google/Ads/AdWords/v201406/PageOnePromotedBiddingScheme/StrategyGoal.pm | gitpan/Google-Ads-AdWords-Client | 44c7408a1b7f8f16b22efa359c037d1f986f04f1 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/AdWords/v201406/PageOnePromotedBiddingScheme/StrategyGoal.pm | gitpan/Google-Ads-AdWords-Client | 44c7408a1b7f8f16b22efa359c037d1f986f04f1 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/AdWords/v201406/PageOnePromotedBiddingScheme/StrategyGoal.pm | gitpan/Google-Ads-AdWords-Client | 44c7408a1b7f8f16b22efa359c037d1f986f04f1 | [
"Apache-2.0"
]
| null | null | null | package Google::Ads::AdWords::v201406::PageOnePromotedBiddingScheme::StrategyGoal;
use strict;
use warnings;
sub get_xmlns { 'https://adwords.google.com/api/adwords/cm/v201406'};
# derivation by restriction
use base qw(
SOAP::WSDL::XSD::Typelib::Builtin::string);
1;
__END__
=pod
=head1 NAME
=head1 DESCRIPTION
Perl data type class for the XML Schema defined simpleType
PageOnePromotedBiddingScheme.StrategyGoal from the namespace https://adwords.google.com/api/adwords/cm/v201406.
This clase is derived from
SOAP::WSDL::XSD::Typelib::Builtin::string
. SOAP::WSDL's schema implementation does not validate data, so you can use it exactly
like it's base type.
# Description of restrictions not implemented yet.
=head1 METHODS
=head2 new
Constructor.
=head2 get_value / set_value
Getter and setter for the simpleType's value.
=head1 OVERLOADING
Depending on the simple type's base type, the following operations are overloaded
Stringification
Numerification
Boolification
Check L<SOAP::WSDL::XSD::Typelib::Builtin> for more information.
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
| 16.984848 | 111 | 0.769848 |
73e3c05cdcaf44ed133379bbbc5223b10ebab795 | 3,698 | pm | Perl | src/DmrgDriver.pm | g1257/dmrgpp | 9f46eebce7e2c231cf486aa2e33368477827b63e | [
"Unlicense"
]
| 24 | 2016-02-22T20:53:19.000Z | 2022-03-17T07:29:32.000Z | src/DmrgDriver.pm | g1257/dmrgpp | 9f46eebce7e2c231cf486aa2e33368477827b63e | [
"Unlicense"
]
| 31 | 2015-06-29T21:32:33.000Z | 2022-01-06T12:41:31.000Z | src/DmrgDriver.pm | g1257/dmrgpp | 9f46eebce7e2c231cf486aa2e33368477827b63e | [
"Unlicense"
]
| 18 | 2015-08-13T04:17:47.000Z | 2021-04-27T15:50:23.000Z | #!/usr/bin/perl
use strict;
use warnings;
package DmrgDriver;
sub createTemplates
{
my ($generateSources) = @_;
my $cppEach = 2;
my @lanczos = ("LanczosSolver","ChebyshevSolver");
my @matrixVector = ("MatrixVectorOnTheFly","MatrixVectorStored","MatrixVectorKron");
my @vecWithOffsets = ("","s");
my @complexOrReal = (0, 3);
my @values;
my $cppFiles = 0;
my $counter = 0;
my $fout;
my $target = "TargetingBase";
my @su2files;
foreach my $complexOrNot (@complexOrReal) {
foreach my $lanczos (@lanczos) {
foreach my $vecWithOffset (@vecWithOffsets) {
foreach my $matrixVector (@matrixVector) {
if ($counter == 0 or $counter % $cppEach == 0) {
if ($counter > 0 and $generateSources) {
close(FOUT);
print STDERR "$0: File $fout written\n";
}
$fout = "DmrgDriver$cppFiles.cpp";
$su2files[$cppFiles++] = 0;
if ($generateSources) {
open(FOUT,"> $fout") or die "$0: Cannot write to $fout : $!\n";
printHeader();
}
}
if ($generateSources) {
printInstance($counter,$target,$lanczos,$matrixVector,
$vecWithOffset,$complexOrNot,\@values);
}
$counter++;
}
}
}
}
if ($generateSources) {
close(FOUT);
print STDERR "$0: $counter instances and $cppFiles files\n";
}
return @su2files;
}
sub printInstance
{
my ($counter,$target,$lanczos,$matrixVector,$vecWithOffset,$complexOrNot,
$values) = @_;
my $sparseMatrix = "SparseMatrixInstance${counter}Type";
my $basisWithout = "Dmrg::Basis<$sparseMatrix>";
my $basisWith = "Dmrg::BasisWithOperators<$basisWithout >";
my $basis = $basisWithout;
my $inputNg = "PsimagLite::InputNg<Dmrg::InputCheck>::Readable";
my $geometry = "GeometryInstance${counter}Type";
my $basisSuperBlock = "$basis";
my $lrs = "Dmrg::LeftRightSuper<$basisWith,$basisSuperBlock >";
my $lanczosType = "LanczosSolver${counter}Type";
my $matrixVectorType = "MatrixVector${counter}Type";
my ($complexOrReal1, $complexOrReal2) = getDualRealComplex($complexOrNot);
my $vecWithOffsetType = "Dmrg::VectorWithOffset${vecWithOffset}<$complexOrReal2, Dmrg::Qn> ";
print FOUT<<EOF;
typedef PsimagLite::CrsMatrix<$complexOrReal1> $sparseMatrix;
typedef Dmrg::SuperGeometry<$complexOrReal1,$inputNg,Dmrg::ProgramGlobals> $geometry;
typedef Dmrg::$matrixVector<
Dmrg::ModelBase<
Dmrg::ModelHelperLocal<
$lrs
>,
ParametersDmrgSolverType,
InputNgType::Readable,
$geometry
>
> $matrixVectorType;
typedef PsimagLite::$lanczos<PsimagLite::ParametersForSolver<${geometry}::RealType>,
$matrixVectorType, ${matrixVectorType}::VectorType> $lanczosType;
template void mainLoop4<$lanczosType,$vecWithOffsetType>
(${lanczosType}::MatrixType::ModelType::SuperGeometryType&,
const ParametersDmrgSolverType&,
InputNgType::Readable&,
const OperatorOptions&);
EOF
my $value = "Local$complexOrNot";
my $seen = 0;
foreach my $item (@$values) {
if ($item eq $value) {
$seen = 1;
last;
}
}
return if ($seen);
push @$values, $value;
foreach my $item (@$values) {
system("echo \'$item\' >> out.txt");
}
system("echo \"-------------------\" >> out.txt");
}
sub isComplexOption
{
my ($option) = @_;
return ($option ne "RealType");
}
sub targetNotComplex
{
my ($target) = @_;
return ($target ne "TargetingTimeStep");
}
sub printHeader
{
print FOUT<<EOF;
// Created automatically by $0
// DO NOT EDIT because file will be overwritten each
// time you run $0 with the second argument set to 1
// This file should be commited
#include "DmrgDriver1.h"
EOF
}
sub getDualRealComplex
{
my ($n) = @_;
return (getOneRealComplex($n & 1), getOneRealComplex($n & 2));
}
sub getOneRealComplex
{
my ($n) = @_;
return ($n == 0) ? "RealType" : "std::complex<RealType> ";
}
1;
| 22.143713 | 94 | 0.679016 |
73e82463f2fe4fb0496e509b7edd0176448457c0 | 337 | pm | Perl | pdu-perl-api/Raritan/RPC/auth/ldapsrv/SecurityProtocol.pm | gregoa/raritan-pdu-json-rpc-sdk | 76df982462742b97b52872aa34630140f5df7e58 | [
"BSD-3-Clause"
]
| 1 | 2021-04-29T23:04:17.000Z | 2021-04-29T23:04:17.000Z | pdu-perl-api/Raritan/RPC/auth/ldapsrv/SecurityProtocol.pm | gregoa/raritan-pdu-json-rpc-sdk | 76df982462742b97b52872aa34630140f5df7e58 | [
"BSD-3-Clause"
]
| null | null | null | pdu-perl-api/Raritan/RPC/auth/ldapsrv/SecurityProtocol.pm | gregoa/raritan-pdu-json-rpc-sdk | 76df982462742b97b52872aa34630140f5df7e58 | [
"BSD-3-Clause"
]
| 2 | 2020-06-20T16:21:23.000Z | 2021-09-28T19:04:44.000Z | # SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This file was generated by IdlC from LdapServerSettings.idl.
use strict;
package Raritan::RPC::auth::ldapsrv::SecurityProtocol;
use constant SEC_PROTO_NONE => 0;
use constant SEC_PROTO_SSL => 1;
use constant SEC_PROTO_STARTTLS => 2;
1;
| 21.0625 | 62 | 0.762611 |
ed090c2a125387006b0e04493b8c0d0e53c604bd | 1,302 | pm | Perl | openresty-win32-build/thirdparty/perl5-5.29.6/cpan/Test-Simple/lib/Test/Tester/CaptureRunner.pm | nneesshh/openresty-win32-build | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
]
| 2 | 2018-06-15T08:32:44.000Z | 2019-01-12T03:20:41.000Z | openresty-win32-build/thirdparty/perl5-5.29.6/lib/Test/Tester/CaptureRunner.pm | nneesshh/openresty-win32-build | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
]
| null | null | null | openresty-win32-build/thirdparty/perl5-5.29.6/lib/Test/Tester/CaptureRunner.pm | nneesshh/openresty-win32-build | bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3 | [
"MIT"
]
| null | null | null | # $Header: /home/fergal/my/cvs/Test-Tester/lib/Test/Tester/CaptureRunner.pm,v 1.3 2003/03/05 01:07:55 fergal Exp $
use strict;
package Test::Tester::CaptureRunner;
our $VERSION = '1.302141';
use Test::Tester::Capture;
require Exporter;
sub new
{
my $pkg = shift;
my $self = bless {}, $pkg;
return $self;
}
sub run_tests
{
my $self = shift;
my $test = shift;
capture()->reset;
$self->{StartLevel} = $Test::Builder::Level;
&$test();
}
sub get_results
{
my $self = shift;
my @results = capture()->details;
my $start = $self->{StartLevel};
foreach my $res (@results)
{
next if defined $res->{depth};
my $depth = $res->{_depth} - $res->{_level} - $start - 3;
# print "my $depth = $res->{_depth} - $res->{_level} - $start - 1\n";
$res->{depth} = $depth;
}
return @results;
}
sub get_premature
{
return capture()->premature;
}
sub capture
{
return Test::Tester::Capture->new;
}
__END__
=head1 NAME
Test::Tester::CaptureRunner - Help testing test modules built with Test::Builder
=head1 DESCRIPTION
This stuff if needed to allow me to play with other ways of monitoring the
test results.
=head1 AUTHOR
Copyright 2003 by Fergal Daly <fergal@esatclear.ie>.
=head1 LICENSE
Under the same license as Perl itself
See http://www.perl.com/perl/misc/Artistic.html
=cut
| 16.275 | 114 | 0.673579 |
73fe97ccd81855e59e858756ed6e17e224fef9d1 | 6,466 | pm | Perl | cloud/aws/health/mode/events.pm | handfreezer/centreon-plugins | b90f14765a6583249a46a810b89987a15a249ed2 | [
"Apache-2.0"
]
| null | null | null | cloud/aws/health/mode/events.pm | handfreezer/centreon-plugins | b90f14765a6583249a46a810b89987a15a249ed2 | [
"Apache-2.0"
]
| null | null | null | cloud/aws/health/mode/events.pm | handfreezer/centreon-plugins | b90f14765a6583249a46a810b89987a15a249ed2 | [
"Apache-2.0"
]
| null | null | null | #
# Copyright 2022 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package cloud::aws::health::mode::events;
use base qw(centreon::plugins::templates::counter);
use strict;
use warnings;
sub prefix_global_output {
my ($self, %options) = @_;
return 'Events ';
}
sub set_counters {
my ($self, %options) = @_;
$self->{maps_counters_type} = [
{ name => 'global', cb_prefix_output => 'prefix_global_output', type => 0 }
];
$self->{maps_counters}->{global} = [
{ label => 'total', nlabel => 'events.total.count', set => {
key_values => [ { name => 'total' } ],
output_template => 'total: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'open', nlabel => 'events.open.count', set => {
key_values => [ { name => 'open' } ],
output_template => 'open: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'closed', nlabel => 'events.closed.count', set => {
key_values => [ { name => 'closed' } ],
output_template => 'closed: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
},
{ label => 'upcoming', nlabel => 'events.upcoming.count', set => {
key_values => [ { name => 'upcoming' } ],
output_template => 'upcoming: %s',
perfdatas => [
{ template => '%s', min => 0 }
]
}
}
];
}
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
bless $self, $class;
$options{options}->add_options(arguments => {
'filter-service:s@' => { name => 'filter_service' },
'filter-region:s@' => { name => 'filter_region' },
'filter-entity-value:s@' => { name => 'filter_entity_value' },
'filter-event-status:s@' => { name => 'filter_event_status' },
'filter-event-category:s@' => { name => 'filter_event_category' },
'display-affected-entities' => { name => 'display_affected_entities' }
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::check_options(%options);
$self->{filter_options} = {};
foreach (('service', 'region', 'entity_value', 'event_status', 'event_category')) {
$self->{filter_options}->{'filter_' . $_} = undef;
if (defined($self->{option_results}->{'filter_' . $_})) {
foreach my $option (@{$self->{option_results}->{'filter_' . $_}}) {
next if ($option eq '');
$self->{filter_options}->{'filter_' . $_} = [] if (!defined($self->{filter_options}->{'filter_' . $_}));
push @{$self->{filter_options}->{'filter_' . $_}}, split(/,/, $option);
}
}
}
}
sub manage_selection {
my ($self, %options) = @_;
my $results = $options{custom}->health_describe_events(
%{$self->{filter_options}}
);
$self->{global} = { total => 0, open => 0, closed => 0, upcoming => 0 };
my $events = {};
foreach my $entry (@$results) {
$self->{global}->{ lc($entry->{statusCode}) }++;
$self->{global}->{total}++;
$events->{ $entry->{arn} } = $entry;
}
my $affected_entities;
my @event_arns = sort { $events->{$b}->{startTime} cmp $events->{$a}->{startTime} } keys %$events;
if (scalar(@event_arns) > 0 && defined($self->{option_results}->{display_affected_entities})) {
$affected_entities = $options{custom}->health_describe_affected_entities(filter_event_arns => [@event_arns]);
}
foreach (@event_arns) {
my $entity = '';
if (defined($affected_entities)) {
$entity = '[affected entity: -]';
foreach my $affected (@$affected_entities) {
if ($events->{$_}->{arn} eq $affected->{eventArn}) {
$entity = '[affected entity: ' . $affected->{entityValue} . ']';
last;
}
}
}
$self->{output}->output_add(long_msg =>
sprintf(
'[service: %s][region: %s][status: %s][type: %s][start: %s]%s',
$events->{$_}->{service},
$events->{$_}->{region},
$events->{$_}->{statusCode},
$events->{$_}->{eventTypeCode},
$events->{$_}->{startTime} =~ m/^\d{4}-\d{2}-\d{2}/ ? $events->{$_}->{startTime} : scalar(localtime($events->{$_}->{startTime})),
$entity
)
);
}
}
1;
__END__
=head1 MODE
Check health events.
=over 8
=item B<--filter-service>
Filter result by service (multiple option).
Example: --filter-service=EC2 --filter-service=RDS
=item B<--filter-region>
Filter result by region (multiple option).
Example: --filter-region=ap-southeast-1 --filter-region=eu-west-1
=item B<--filter-entity-value>
Filter result by entity value (multiple option).
Example: --filter-entity-value=i-34ab692e --filter-entity-value=vol-426ab23e
=item B<--filter-event-status>
Filter result by event status (multiple option).
Example: --filter-event-status=open --filter-event-status=closed
=item B<--filter-event-category>
Filter result by event category (multiple option).
Example: --filter-event-category=issue
=item B<--display-affected-entities>
Display affected entities by the event.
=item B<--warning-*> B<--critical-*>
Thresholds.
Can be: 'total', 'open', 'closed', 'upcoming'.
=back
=cut
| 31.236715 | 145 | 0.545005 |
73f7ba1d2bea94f46d568e89b7f1875e1b6899cc | 4,578 | pm | Perl | lib/Search/Elasticsearch/Transport/Async.pm | garykrige/elasticsearch-perl | 11932ea7a72361e77e9ee921114283a3a3e13e63 | [
"Apache-2.0"
]
| 1 | 2022-03-14T10:44:11.000Z | 2022-03-14T10:44:11.000Z | lib/Search/Elasticsearch/Transport/Async.pm | garykrige/elasticsearch-perl | 11932ea7a72361e77e9ee921114283a3a3e13e63 | [
"Apache-2.0"
]
| null | null | null | lib/Search/Elasticsearch/Transport/Async.pm | garykrige/elasticsearch-perl | 11932ea7a72361e77e9ee921114283a3a3e13e63 | [
"Apache-2.0"
]
| null | null | null | package Search::Elasticsearch::Transport::Async;
use Moo;
with 'Search::Elasticsearch::Role::Is_Async',
'Search::Elasticsearch::Role::Transport';
use Time::HiRes qw(time);
use Search::Elasticsearch::Util qw(upgrade_error);
use Promises qw(deferred);
use namespace::clean;
#===================================
sub perform_request {
#===================================
my $self = shift;
my $params = $self->tidy_request(@_);
my $pool = $self->cxn_pool;
my $logger = $self->logger;
my $deferred = deferred;
my ( $start, $cxn );
$pool->next_cxn
# perform request
->then(
sub {
$cxn = shift;
$start = time();
$cxn->perform_request($params);
}
)
# log request regardless of success/failure
->finally( sub { $logger->trace_request( $cxn, $params ) } )
->done(
# request succeeded
sub {
my ( $code, $response ) = @_;
$pool->request_ok($cxn);
$logger->trace_response( $cxn, $code, $response,
time() - $start );
$deferred->resolve($response);
},
# request failed
sub {
my $error = upgrade_error( shift(), { request => $params } );
if ( $pool->request_failed( $cxn, $error ) ) {
# log failed, then retry
$logger->debugf( "[%s] %s", $cxn->stringify, "$error" );
$logger->info('Retrying request on a new cxn');
return $self->perform_request($params)->done(
sub { $deferred->resolve(@_) },
sub { $deferred->reject(@_) }
);
}
if ($cxn) {
$logger->trace_request( $cxn, $params );
$logger->trace_error( $cxn, $error );
}
$error->is('NoNodes')
? $logger->critical($error)
: $logger->error($error);
$deferred->reject($error);
}
);
return $deferred->promise;
}
1;
#ABSTRACT: Provides async interface between the client class and the Elasticsearch cluster
=head1 DESCRIPTION
The Async::Transport class manages the request cycle. It receives parsed requests
from the (user-facing) client class, and tries to execute the request on a
node in the cluster, retrying a request if necessary.
This class does L<Search::Elasticsearch::Role::Transport> and
L<Search::Elasticsearch::Role::Is_Async>.
=head1 CONFIGURATION
=head2 C<send_get_body_as>
$e = Search::Elasticsearch::Async->new(
send_get_body_as => 'POST'
);
Certain endpoints like L<Search::Elasticsearch::Client::6_0::Direct/search()>
default to using a C<GET> method, even when they include a request body.
Some proxy servers do not support C<GET> requests with a body. To work
around this, the C<send_get_body_as> parameter accepts the following:
=over
=item * C<GET>
The default. Request bodies are sent as C<GET> requests.
=item * C<POST>
The method is changed to C<POST> when a body is present.
=item * C<source>
The body is encoded as JSON and added to the query string as the C<source>
parameter. This has the advantage of still being a C<GET> request (for those
filtering on request method) but has the disadvantage of being restricted
in size. The limit depends on the proxies between the client and
Elasticsearch, but usually is around 4kB.
=back
=head1 METHODS
=head2 C<perform_request()>
Raw requests can be executed using the transport class as follows:
$promise = $e->transport->perform_request(
method => 'POST',
path => '/_search',
qs => { from => 0, size => 10 },
body => {
query => {
match => {
title => "Elasticsearch clients"
}
}
}
);
C<perform_request()> returns a L<Promise> object, which will be resolved
(success) or rejected (error) at some point in the future.
Other than the C<method>, C<path>, C<qs> and C<body> parameters, which
should be self-explanatory, it also accepts:
=over
=item C<ignore>
The HTTP error codes which should be ignored instead of throwing an error,
eg C<404 NOT FOUND>:
$promise = $e->transport->perform_request(
method => 'GET',
path => '/index/type/id'
ignore => [404],
);
=item C<serialize>
Whether the C<body> should be serialized in the standard way (as plain
JSON) or using the special I<bulk> format: C<"std"> or C<"bulk">.
=back
| 27.914634 | 90 | 0.586501 |
73e96e1fd381d892e8bdff05680fff5f5b374849 | 1,693 | t | Perl | t/Catmandu-Store-File-BagIt.t | manwar/Catmandu-BagIt | 046d7970e9e527a00e945791abfec29934c456dd | [
"Artistic-1.0"
]
| 1 | 2016-01-21T08:37:10.000Z | 2016-01-21T08:37:10.000Z | t/Catmandu-Store-File-BagIt.t | manwar/Catmandu-BagIt | 046d7970e9e527a00e945791abfec29934c456dd | [
"Artistic-1.0"
]
| 14 | 2015-05-29T09:58:00.000Z | 2020-02-19T10:09:38.000Z | t/Catmandu-Store-File-BagIt.t | manwar/Catmandu-BagIt | 046d7970e9e527a00e945791abfec29934c456dd | [
"Artistic-1.0"
]
| 2 | 2016-01-20T10:52:23.000Z | 2019-10-07T15:10:38.000Z | #!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Exception;
my $pkg;
BEGIN {
$pkg = 'Catmandu::Store::File::BagIt';
use_ok $pkg;
}
require_ok $pkg;
dies_ok {$pkg->new} 'dies ok on not enough parameters';
my $store = $pkg->new(root => 't/data2', keysize => 9);
ok $store , 'got a store';
my $bags = $store->bag();
ok $bags , 'store->bag()';
isa_ok $bags , 'Catmandu::Store::File::BagIt::Index';
is $store->path_string('1234'), 't/data2/000/001/234', 'path_string(1234)';
is $store->path_string('0001234'), 't/data2/000/001/234',
'path_string(0001234)';
ok !$store->path_string('00000001234'), 'path_string(00000001234) fails';
ok !$store->bag('1235') , 'bag(1235) doesnt exist';
lives_ok {$store->bag('1')} 'bag(1) exists';
dies_ok sub {
$pkg->new(root => 't/data2', keysize => 13);
}, 'dies on wrong keysize';
lives_ok sub {
$pkg->new(root => 't/data2', keysize => 12);
}, 'dies on connecting to a store with the wrong keysize';
note("uuid");
{
my $store = $pkg->new(root => 't/data3', uuid => 1);
ok $store , 'got a store';
my $bags = $store->bag();
ok $bags , 'store->bag()';
isa_ok $bags , 'Catmandu::Store::File::BagIt::Index';
is $store->path_string('7D9DEBD0-3B84-11E9-913F-EA3D2282636C')
, 't/data3/7D9/DEB/D0-/3B8/4-1/1E9/-91/3F-/EA3/D22/826/36C'
, 'path_string(7D9DEBD0-3B84-11E9-913F-EA3D2282636C)';
ok ! $store->path_string('7D9DEBD') , 'path_string(7D9DEBD) fails';
ok !$store->bag('7D9DEBD') , 'bag(1235) doesnt exist';
lives_ok {$store->bag('7D9DEBD0-3B84-11E9-913F-EA3D2282636C')} 'bag(7D9DEBD0-3B84-11E9-913F-EA3D2282636C) exists';
}
done_testing;
| 23.84507 | 118 | 0.624926 |
ed0c78e0a684af38234253d3e787703292ac741e | 504 | t | Perl | test/blackbox-tests/test-cases/coq/public-dep-on-private.t/run.t | marsam/dune | 8a3d7f2f2015b71384caa07226d1a89dba9d6c25 | [
"MIT"
]
| 2 | 2022-03-03T01:38:24.000Z | 2022-03-03T01:54:36.000Z | test/blackbox-tests/test-cases/coq/public-dep-on-private.t/run.t | marsam/dune | 8a3d7f2f2015b71384caa07226d1a89dba9d6c25 | [
"MIT"
]
| 1 | 2021-11-08T19:54:28.000Z | 2021-11-08T19:54:28.000Z | test/blackbox-tests/test-cases/coq/public-dep-on-private.t/run.t | marsam/dune | 8a3d7f2f2015b71384caa07226d1a89dba9d6c25 | [
"MIT"
]
| 1 | 2022-03-02T19:35:36.000Z | 2022-03-02T19:35:36.000Z | $ dune build --display short --debug-dependency-path
File "public/dune", line 4, characters 11-18:
4 | (theories private))
^^^^^^^
Error: Theory "private" is private, it cannot be a dependency of a public
theory. You need to associate "private" to a package.
-> required by public/b.v.d
-> required by public/b.vo
-> required by install lib/coq/user-contrib/public/b.vo
-> required by public.install
-> required by alias default
-> required by alias default
[1]
| 36 | 75 | 0.666667 |
73ee441a8be3713f17d982e7c4cc62f97c5501b9 | 3,842 | pm | Perl | auto-lib/Paws/ECS/SubmitContainerStateChange.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/ECS/SubmitContainerStateChange.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/ECS/SubmitContainerStateChange.pm | galenhuntington/aws-sdk-perl | 13b775dcb5f0b3764f0a82f3679ed5c7721e67d3 | [
"Apache-2.0"
]
| null | null | null |
package Paws::ECS::SubmitContainerStateChange;
use Moose;
has Cluster => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'cluster' );
has ContainerName => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'containerName' );
has ExitCode => (is => 'ro', isa => 'Int', traits => ['NameInRequest'], request_name => 'exitCode' );
has NetworkBindings => (is => 'ro', isa => 'ArrayRef[Paws::ECS::NetworkBinding]', traits => ['NameInRequest'], request_name => 'networkBindings' );
has Reason => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'reason' );
has Status => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'status' );
has Task => (is => 'ro', isa => 'Str', traits => ['NameInRequest'], request_name => 'task' );
use MooseX::ClassAttribute;
class_has _api_call => (isa => 'Str', is => 'ro', default => 'SubmitContainerStateChange');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::ECS::SubmitContainerStateChangeResponse');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::ECS::SubmitContainerStateChange - Arguments for method SubmitContainerStateChange on L<Paws::ECS>
=head1 DESCRIPTION
This class represents the parameters used for calling the method SubmitContainerStateChange on the
L<Amazon EC2 Container Service|Paws::ECS> service. Use the attributes of this class
as arguments to method SubmitContainerStateChange.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to SubmitContainerStateChange.
=head1 SYNOPSIS
my $ecs = Paws->service('ECS');
my $SubmitContainerStateChangeResponse = $ecs->SubmitContainerStateChange(
Cluster => 'MyString', # OPTIONAL
ContainerName => 'MyString', # OPTIONAL
ExitCode => 1, # OPTIONAL
NetworkBindings => [
{
bindIP => 'MyString',
containerPort => 1,
hostPort => 1,
protocol => 'tcp', # values: tcp, udp; OPTIONAL
},
...
], # OPTIONAL
Reason => 'MyString', # OPTIONAL
Status => 'MyString', # OPTIONAL
Task => 'MyString', # OPTIONAL
);
# Results:
my $Acknowledgment = $SubmitContainerStateChangeResponse->Acknowledgment;
# Returns a L<Paws::ECS::SubmitContainerStateChangeResponse> object.
Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.
For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/ecs/SubmitContainerStateChange>
=head1 ATTRIBUTES
=head2 Cluster => Str
The short name or full ARN of the cluster that hosts the container.
=head2 ContainerName => Str
The name of the container.
=head2 ExitCode => Int
The exit code returned for the state change request.
=head2 NetworkBindings => ArrayRef[L<Paws::ECS::NetworkBinding>]
The network bindings of the container.
=head2 Reason => Str
The reason for the state change request.
=head2 Status => Str
The status of the state change request.
=head2 Task => Str
The task ID or full Amazon Resource Name (ARN) of the task that hosts
the container.
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method SubmitContainerStateChange in L<Paws::ECS>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: L<https://github.com/pplu/aws-sdk-perl>
Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues>
=cut
| 31.752066 | 249 | 0.662676 |
73e88460a837191e3850eca73f6d5d67aa28170a | 1,129 | t | Perl | t.rep/72-shutdown-sync.t | rcdevs/repcached | c9cb4cf0ff156785c54dd461a4d584369866c58c | [
"BSD-3-Clause"
]
| 10 | 2015-10-30T07:07:26.000Z | 2017-07-17T03:24:09.000Z | t.rep/72-shutdown-sync.t | rcdevs/repcached | c9cb4cf0ff156785c54dd461a4d584369866c58c | [
"BSD-3-Clause"
]
| 1 | 2019-01-11T13:03:26.000Z | 2020-01-26T14:51:26.000Z | t.rep/72-shutdown-sync.t | ignacykasperowicz/repcached | c9cb4cf0ff156785c54dd461a4d584369866c58c | [
"BSD-3-Clause"
]
| 6 | 2015-05-30T13:15:26.000Z | 2017-07-17T03:24:14.000Z | #!/usr/bin/perl
use strict;
use warnings;
use Test::More qw(no_plan);
use FindBin qw($Bin);
use lib ("$Bin/lib", "$Bin/../t/lib");
use RepcachedTest;
my($m1, $m2) = new_repcached();
my($sock_m1, $sock_m2) = ($m1->sock, $m2->sock);
# stop second process, fill buffers on first one
# XXX use (pid + 1) to bypass timedrun, unsafe
kill 'STOP', $m2->{pid} + 1;
my ($uniq, $key, $val, $vallen);
for my $i (1..10) {
$key = 'settest_1_' . $i;
$val = 'setval' . $i . ('0' x (1000*1024));
$vallen = length $val;
print $sock_m1 "set $key 0 0 $vallen\r\n$val\r\n";
is(scalar <$sock_m1>, "STORED\r\n", "stored $i");
}
# ask first process to shutdown, and release second one
kill 'INT', $m1->{pid} + 1;
kill 'CONT', $m2->{pid} + 1;
# wait for a while
sleep(2);
for my $i (1..10) {
$key = 'settest_1_' . $i;
my $expected = 'setval' . $i . ('0' x (1000*1024)) . "\r\nEND\r\n";
print $sock_m2 "get $key\r\n";
my $r = <$sock_m2>;
$r = <$sock_m2> . <$sock_m2> if $r =~ /VALUE/;
is(substr($r, 0, 20), substr($expected, 0, 20), "get $i");
is(length($r), length($expected), "get $i length");
}
| 25.659091 | 71 | 0.56333 |
ed16b60c628e45df41e8f0fd999962220f70a076 | 3,218 | pm | Perl | lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm | qls0ulp/musicbrainz-server | ebe8a45bf6f336352cd5c56e2e825d07679c0e45 | [
"BSD-2-Clause"
]
| 2 | 2019-03-14T05:31:35.000Z | 2019-03-14T05:32:01.000Z | lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm | qls0ulp/musicbrainz-server | ebe8a45bf6f336352cd5c56e2e825d07679c0e45 | [
"BSD-2-Clause"
]
| null | null | null | lib/MusicBrainz/Server/Edit/ReleaseGroup/Create.pm | qls0ulp/musicbrainz-server | ebe8a45bf6f336352cd5c56e2e825d07679c0e45 | [
"BSD-2-Clause"
]
| 1 | 2021-02-24T13:14:25.000Z | 2021-02-24T13:14:25.000Z | package MusicBrainz::Server::Edit::ReleaseGroup::Create;
use Moose;
use MooseX::Types::Moose qw( ArrayRef Int Str );
use MooseX::Types::Structured qw( Dict Optional );
use MusicBrainz::Server::Constants qw( $EDIT_RELEASEGROUP_CREATE );
use MusicBrainz::Server::Edit::Types qw( Nullable ArtistCreditDefinition );
use MusicBrainz::Server::Edit::Utils qw(
load_artist_credit_definitions
artist_credit_preview
verify_artist_credits
clean_submitted_artist_credits
);
use MusicBrainz::Server::Translation qw( N_l );
use Scalar::Util qw( looks_like_number );
extends 'MusicBrainz::Server::Edit::Generic::Create';
with 'MusicBrainz::Server::Edit::Role::Preview';
with 'MusicBrainz::Server::Edit::ReleaseGroup::RelatedEntities';
with 'MusicBrainz::Server::Edit::ReleaseGroup';
with 'MusicBrainz::Server::Edit::Role::AlwaysAutoEdit';
use aliased 'MusicBrainz::Server::Entity::ReleaseGroup';
sub edit_name { N_l('Add release group') }
sub edit_type { $EDIT_RELEASEGROUP_CREATE }
sub _create_model { 'ReleaseGroup' }
sub release_group_id { shift->entity_id }
has '+data' => (
isa => Dict[
type_id => Nullable[Int],
name => Str,
artist_credit => ArtistCreditDefinition,
comment => Nullable[Str],
secondary_type_ids => Optional[ArrayRef[Int]]
]
);
sub foreign_keys
{
my $self = shift;
return {
Artist => { load_artist_credit_definitions($self->data->{artist_credit}) },
ReleaseGroup => [ $self->entity_id ],
ReleaseGroupType => [ $self->data->{type_id} ],
ReleaseGroupSecondaryType => $self->data->{secondary_type_ids}
};
}
sub build_display_data
{
my ($self, $loaded) = @_;
my $type = $self->data->{type_id};
return {
artist_credit => artist_credit_preview($loaded, $self->data->{artist_credit}),
name => $self->data->{name} || '',
comment => $self->data->{comment} || '',
type => $type ? $loaded->{ReleaseGroupType}->{ $type } : '',
release_group => (defined($self->entity_id) &&
$loaded->{ReleaseGroup}{ $self->entity_id }) ||
ReleaseGroup->new( name => $self->data->{name} ),
secondary_types => join(' + ', map { $loaded->{ReleaseGroupSecondaryType}{$_}->name }
@{ $self->data->{secondary_type_ids} })
};
}
sub initialize {
my ($self, %opts) = @_;
$opts{type_id} = delete $opts{primary_type_id};
delete $opts{secondary_type_ids}
unless grep { looks_like_number($_) } @{ $opts{secondary_type_ids} // [] };
$opts{artist_credit} = clean_submitted_artist_credits($opts{artist_credit});
$self->data(\%opts);
}
sub _insert_hash
{
my ($self, $data) = @_;
$data->{artist_credit} = $self->c->model('ArtistCredit')->find_or_insert($data->{artist_credit});
$data->{primary_type_id} = delete $data->{type_id};
$data->{comment} = '' unless defined $data->{comment};
return $data;
}
before accept => sub {
my ($self) = @_;
verify_artist_credits($self->c, $self->data->{artist_credit});
};
__PACKAGE__->meta->make_immutable;
no Moose;
1;
| 31.861386 | 101 | 0.627719 |
73e46074a133e0f6905b3deb9497ff6a9cb8d8e4 | 28,701 | pl | Perl | src/core/api/db_push.pl | CyberFlameGO/terminusdb | 3c3b67d621da67c4ae673cf415f59bb5d0249121 | [
"Apache-2.0"
]
| 822 | 2019-07-31T12:15:18.000Z | 2022-03-31T05:32:32.000Z | src/core/api/db_push.pl | CyberFlameGO/terminusdb | 3c3b67d621da67c4ae673cf415f59bb5d0249121 | [
"Apache-2.0"
]
| 600 | 2019-08-02T14:03:14.000Z | 2022-03-29T15:27:31.000Z | src/core/api/db_push.pl | CyberFlameGO/terminusdb | 3c3b67d621da67c4ae673cf415f59bb5d0249121 | [
"Apache-2.0"
]
| 53 | 2019-08-14T22:09:40.000Z | 2022-03-25T09:01:35.000Z | :- module(db_push, [
push/8,
authorized_push/3
]).
:- use_module(core(util)).
:- use_module(core(query)).
:- use_module(library(terminus_store)).
:- use_module(core(transaction)).
:- use_module(db_pack).
:- use_module(db_rebase).
:- use_module(db_create).
:- use_module(core(account)).
:- use_module(library(http/http_client)).
:- use_module(core(document)).
:- use_module(library(tus)).
% error conditions:
% - branch to push does not exist
% - repository does not exist
% - we tried to push to a repository that is not a remote
% - tried to push without having fetched first. The repository exists as an entity in our metadata graph but it hasn't got an associated commit graph. We always need one.
% - remote diverged - someone else committed and pushed and we know about that
% - We try to push an empty branch, but we know that remote is non-empty
% - remote returns an error
% -- history diverged (we check locally, but there's a race)
% -- remote doesn't know what we're talking about
% -- remote authorization failed
% - communication error while talking to the remote
:- meta_predicate push(+, +, +, +, +, +, 2, -).
push(System_DB, Auth, Branch, Remote_Name, Remote_Branch, _Options,
Push_Predicate, Result) :-
do_or_die(
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
error(invalid_absolute_path(Branch),_)),
do_or_die(
(branch_descriptor{} :< Branch_Descriptor),
error(push_requires_branch(Branch_Descriptor),_)),
check_descriptor_auth(System_DB, (Branch_Descriptor.repository_descriptor), '@schema':'Action/push', Auth),
do_or_die(
open_descriptor(Branch_Descriptor, _Branch_Transaction), % dodgy underscore
error(unresolvable_absolute_descriptor(Branch_Descriptor),_)),
Repository_Descriptor = (Branch_Descriptor.repository_descriptor),
Database_Descriptor = (Repository_Descriptor.database_descriptor),
do_or_die(
repository_type(Database_Descriptor, Remote_Name, Type),
error(no_repository_with_name(Database_Descriptor,Remote_Name),_)),
do_or_die(
Type = remote,
error(push_attempted_on_non_remote(Database_Descriptor,Remote_Name),_)),
repository_remote_url(Database_Descriptor, Remote_Name, Remote_URL),
% Begin hypothetical rebase for pack
askable_context(Repository_Descriptor, System_DB, Auth, Repository_Context_With_Prefixes),
context_default_prefixes(Repository_Context_With_Prefixes, Repository_Context),
resolve_relative_descriptor(Database_Descriptor,[Remote_Name, "_commits"],
Remote_Repository),
create_context(Remote_Repository, Remote_Repository_Context_With_Prefixes),
context_default_prefixes(Remote_Repository_Context_With_Prefixes,
Remote_Repository_Context),
context_to_parent_transaction(Remote_Repository_Context, Database_Transaction),
do_or_die(repository_head(Database_Transaction, Remote_Name, Last_Head_Id),
error(push_has_no_repository_head(Remote_Repository), _)),
( branch_head_commit(Repository_Context,
(Branch_Descriptor.branch_name),
Local_Commit_Uri)
-> ( has_branch(Remote_Repository_Context,
Remote_Branch)
-> ( branch_head_commit(Remote_Repository_Context,
Remote_Branch,
Remote_Commit_Uri)
-> Remote_Commit_Uri_Option = some(Remote_Commit_Uri)
; Remote_Commit_Uri_Option = none
),
branch_name_uri(Remote_Repository_Context, Remote_Branch, Remote_Branch_Uri)
; insert_branch_object(Remote_Repository_Context_With_Prefixes, Remote_Branch, Remote_Branch_Uri),
Remote_Commit_Uri_Option = none
),
commit_id_uri(Repository_Context, Local_Commit_Id, Local_Commit_Uri),
( Remote_Commit_Uri_Option = some(Remote_Commit_Uri),
commit_id_uri(Remote_Repository_Context, Remote_Commit_Id, Remote_Commit_Uri),
most_recent_common_ancestor(Repository_Context, Remote_Repository_Context, Local_Commit_Id,
Remote_Commit_Id, _Common_Commit_Id, _Local_Branch_Path, Remote_Branch_Path)
% Shared history
-> do_or_die(Remote_Branch_Path = [],
error(remote_diverged(Remote_Repository,Remote_Branch_Path),_))
% No commit yet on remote
; Remote_Commit_Uri_Option = none
-> true
% No shared history
; throw(
error(no_common_history(Remote_Repository),_))),
( ( Remote_Commit_Uri_Option = none
; Remote_Commit_Id \= Local_Commit_Id)
-> copy_commits(Repository_Context, Remote_Repository_Context, Local_Commit_Id),
reset_branch_head(Remote_Repository_Context_With_Prefixes, Remote_Branch_Uri, Local_Commit_Uri)
; true)
; ( has_branch(Remote_Repository_Context,
Remote_Branch),
branch_head_commit(Remote_Repository_Context,
Remote_Branch, _)
-> throw(error(remote_not_empty_on_local_empty(Remote_Repository),_))
; insert_branch_object(Remote_Repository_Context_With_Prefixes, Remote_Branch, _)
)
),
cycle_context(Remote_Repository_Context, Final_Context, Remote_Transaction_Object, _),
pack_from_context(Final_Context, some(Last_Head_Id), Payload_Option),
( Payload_Option = none % Last_Head_Id = Current_Head_Id
-> Result = same(Last_Head_Id)
; Payload_Option = some(Payload),
catch(call(Push_Predicate, Remote_URL, Payload),
E,
( E = error(Inner_E,_),
( Inner_E = history_diverged
; Inner_E = remote_unknown
; Inner_E = authorization_failure(_)
; Inner_E = communication_failure(_))
-> throw(error(remote_unpack_failed(Inner_E),_))
; throw(error(remote_unpack_unexpected_failure(E),_)))),
Database_Transaction_Object = (Remote_Transaction_Object.parent),
[Read_Obj] = (Remote_Transaction_Object.instance_objects),
Layer = (Read_Obj.read),
layer_to_id(Layer, Current_Head_Id),
update_repository_head(Database_Transaction_Object, Remote_Name, Current_Head_Id),
run_transactions([Database_Transaction_Object], true, _),
Result = new(Current_Head_Id)
).
remote_unpack_url(URL, Pack_URL) :-
pattern_string_split('/', URL, [Protocol,Blank,Server|Rest]),
merge_separator_split(Pack_URL,'/',[Protocol,Blank,Server,"api","unpack"|Rest]).
remote_tus_url(URL, TUS_URL) :-
pattern_string_split('/', URL, [Protocol,Blank,Server|_Rest]),
merge_separator_split(TUS_URL,'/',[Protocol,Blank,Server,"api","files"]).
% NOTE: What do we do with the remote branch? How do we send it?
authorized_push(Authorization, Remote_URL, Payload) :-
catch(
( % Try TUS protocol (we could check resulting options too for create etc...)
remote_tus_url(Remote_URL, TUS_URL),
tus_options(TUS_URL, _TUS_Options, [request_header('Authorization'=Authorization)]),
Using_TUS = true,
setup_call_cleanup(
tmp_file_stream(Tmp_File, Stream, [encoding(octet)]),
format(Stream, "~s", Payload),
close(Stream)
),
tus_upload(Tmp_File, TUS_URL, Resource_URL, [request_header('Authorization'=Authorization)]),
Data = json(_{resource_uri : Resource_URL})
),
error(existence_error(url,_),_),
% TUS failed, fall back to old style
( Data = bytes('application/octets',Payload),
Using_TUS = false
)
),
remote_unpack_url(Remote_URL, Unpack_URL),
catch(http_post(Unpack_URL,
Data,
Result,
[request_header('Authorization'=Authorization),
json_object(dict),
timeout(infinite),
status_code(Status_Code)
]),
E,
throw(error(communication_failure(E),_))),
( 200 = Status_Code
-> ( Using_TUS = true
-> tus_delete(Resource_URL, [tus_extension([termination])],
% assume extension to avoid pointless pre-flight
[request_header('Authorization'=Authorization)])
; true)
; 400 = Status_Code,
_{'@type': "api:UnpackErrorResponse", 'api:error' : Error} :< Result
-> ( _{'@type' : "api:NotALinearHistory"} :< Error
-> throw(error(history_diverged,_))
; _{'@type' : "api:UnpackDestinationDatabaseNotFound"} :< Error
-> throw(error(remote_unknown,_))
; throw(error(unknown_status_code(Status_Code, Result),_))
)
; 403 = Status_Code
-> throw(error(remote_authorization_failure(Result),_))
; throw(error(unknown_status_code,_))
).
:- begin_tests(push).
:- use_module(core(util/test_utils)).
:- use_module(core(query)).
:- use_module(core(triple)).
:- use_module(core(transaction)).
:- use_module(core(account)).
%:- use_module(db_create).
:- use_module(db_branch).
test_pusher(Expected, _Remote_URL, Payload) :-
payload_repository_head_and_pack(Payload, _Head, Pack),
pack_layerids_and_parents(Pack, Layer_Parents),
do_or_die(
memberchk(Expected-_,Layer_Parents),
error(layer_not_found(Expected))).
test(push_on_empty,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))
])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Repository_Descriptor),
create_context(Descriptor, commit_info{author: "me",
message: "something"},
Branch_Context),
with_transaction(
Branch_Context,
ask(Branch_Context,
( insert(a,b,c),
insert(c,d,e))),
_Meta_Data_B),
super_user_authority(Auth),
once(ask(Descriptor.repository_descriptor,
t(_,layer:identifier, Expected_Layer_Id^^(xsd:string)))),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(Expected_Layer_Id), _Result),
resolve_absolute_string_descriptor("admin/foo/remote/branch/main", Remote_Branch),
findall(X-Y-Z, ask(Remote_Branch, t(X,Y,Z)), Triples),
sort(Triples, [a-b-c,c-d-e]).
test(push_twice,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Repository_Descriptor),
create_context(Descriptor, commit_info{author: "me",
message: "something"},
Branch_Context),
with_transaction(
Branch_Context,
ask(Branch_Context,
( insert(a,b,c),
insert(c,d,e))),
_Meta_Data_B),
super_user_authority(Auth),
Repo = (Descriptor.repository_descriptor),
once(ask(Repo,
t(_,layer:identifier, Expected_Layer_Id^^(xsd:string)))),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(Expected_Layer_Id), _Result),
create_context(Descriptor, commit_info{author: "me",
message: "something else"},
Branch_Context_2),
with_transaction(
Branch_Context_2,
ask(Branch_Context_2,
( insert(h,i,j),
insert(k,l,m))),
_Meta_Data_B_2),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(_Expected_Layer_Id_2), _Result_2),
resolve_absolute_string_descriptor("admin/foo/remote/branch/main", Remote_Branch),
findall(X-Y-Z, ask(Remote_Branch, t(X,Y,Z)), Triples),
sort(Triples, [a-b-c,c-d-e,h-i-j,k-l-m]).
test(push_twice_with_second_push_changing_nothing,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Repository_Descriptor),
create_context(Descriptor, commit_info{author: "me",
message: "something"},
Branch_Context),
with_transaction(
Branch_Context,
ask(Branch_Context,
( insert(a,b,c),
insert(c,d,e))),
_Meta_Data_B),
super_user_authority(Auth),
once(ask(Descriptor.repository_descriptor,
t(_,layer:identifier, Expected_Layer_Id^^(xsd:string)))),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(Expected_Layer_Id), Result),
Result = new(Head),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(_Expected_Layer_Id_2), Result_2),
Result_2 = same(Head).
test(push_empty_branch,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "main"),
true.
test(push_new_nonmaster_branch,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))
])
:-
Destination_Path = "admin/foo/local/branch/work",
super_user_authority(Auth),
branch_create(system_descriptor{}, Auth, Destination_Path, empty(_,_), _),
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, "admin/foo/local/branch/work", "remote", "work", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "work"),
true.
test(push_new_nonmaster_branch_with_content,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))
])
:-
Destination_Path = "admin/foo/local/branch/work",
super_user_authority(Auth),
branch_create(system_descriptor{}, Auth, Destination_Path, empty(_,_), _),
resolve_absolute_string_descriptor(Destination_Path, Work_Branch_Descriptor),
Prefixes = _{'@base' : 'http://somewhere_else/',
'@schema': 'http://somewhere/schema#',
foo: 'http://the_foo_place/'},
create_schema(Work_Branch_Descriptor, [], Prefixes),
create_context(Work_Branch_Descriptor, commit_info{author:"test", message:"test"}, Work_Branch_Context),
with_transaction(Work_Branch_Context,
ask(Work_Branch_Context,
insert(a,b,c)),
_),
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Repository_Descriptor = (Descriptor.repository_descriptor),
Database_Descriptor = (Repository_Descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, Destination_Path, "remote", "work", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "work"),
branch_head_commit(Repository_Descriptor, "work", Head_Commit),
branch_head_commit(Remote_Repository_Descriptor, "work", Head_Commit),
true.
test(push_without_branch,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
error(branch_does_not_exist(_))
])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, "admin/foo/local/branch/work", "remote", "work", [], test_pusher(_New_Layer_Id), _Result).
test(push_without_repository,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
error(no_repository_with_name(_,_))
])
:-
Destination_Path = "admin/foo/local/branch/work",
super_user_authority(Auth),
branch_create(system_descriptor{}, Auth, Destination_Path, empty(_,_), _),
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, "admin/foo/local/branch/work", "remote", "work", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "work"),
true.
test(push_local,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
error(push_attempted_on_non_remote(_,_))
])
:-
Destination_Path = "admin/foo/local/branch/work",
super_user_authority(Auth),
branch_create(system_descriptor{}, Auth, Destination_Path, empty(_,_), _),
resolve_absolute_string_descriptor(Destination_Path, Work_Branch_Descriptor),
Prefixes = _{'@base' : 'http://somewhere_else/',
'@schema': 'http://somewhere/schema#',
foo: 'http://the_foo_place/'},
create_schema(Work_Branch_Descriptor, [], Prefixes),
create_context(Work_Branch_Descriptor, commit_info{author:"test", message:"test"}, Work_Branch_Context),
with_transaction(Work_Branch_Context,
ask(Work_Branch_Context,
insert(a,b,c)),
_),
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Repository_Descriptor =(Descriptor.repository_descriptor),
Database_Descriptor = (Repository_Descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_local_repository(Database_Context, "remote", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, Destination_Path, "remote", "work", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "work"),
branch_head_commit(Repository_Descriptor, "work", Head_Commit),
branch_head_commit(Remote_Repository_Descriptor, "work", Head_Commit),
true.
test(push_headless_remote,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
error(push_has_no_repository_head(_))
])
:-
Destination_Path = "admin/foo/local/branch/work",
super_user_authority(Auth),
branch_create(system_descriptor{}, Auth, Destination_Path, empty(_,_), _),
resolve_absolute_string_descriptor(Destination_Path, Work_Branch_Descriptor),
Prefixes = _{'@base' : 'http://somewhere_else/',
'@schema': 'http://somewhere/schema#',
foo: 'http://the_foo_place/'},
create_schema(Work_Branch_Descriptor, [], Prefixes),
create_context(Work_Branch_Descriptor, commit_info{author:"test", message:"test"}, Work_Branch_Context),
with_transaction(Work_Branch_Context,
ask(Work_Branch_Context,
insert(a,b,c)),
_),
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Repository_Descriptor = (Descriptor.repository_descriptor),
Database_Descriptor = (Repository_Descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://fakeytown.mock",_),
_),
super_user_authority(Auth),
push(system_descriptor{}, Auth, Destination_Path, "remote", "work", [], test_pusher(_New_Layer_Id), _Result),
has_branch(Remote_Repository_Descriptor, "work"),
branch_head_commit(Repository_Descriptor, "work", Head_Commit),
branch_head_commit(Remote_Repository_Descriptor, "work", Head_Commit),
true.
test(push_prefixes,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State))
])
:-
resolve_absolute_string_descriptor("admin/foo", Descriptor),
Database_Descriptor = (Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://somewhere", _),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth),
push(system_descriptor{}, Auth, "admin/foo", "remote", "main", [], test_pusher(_), _Result),
resolve_absolute_string_descriptor("admin/foo/remote/branch/main", Remote),
database_prefixes(Remote, Prefixes),
Prefixes = _{'@base' : "http://somewhere.for.now/document/",
'@schema': "http://somewhere.for.now/schema#",
'@type': 'Context'}.
erroring_push_predicate(Error, _Remote_Url, _Payload) :-
throw(Error).
generic_setup_for_error_conditions(Branch_Descriptor, Auth) :-
resolve_absolute_string_descriptor("admin/foo/local/_commits", Repository_Descriptor),
resolve_relative_descriptor(Repository_Descriptor, ["branch", "main"], Branch_Descriptor),
create_context(Branch_Descriptor, commit_info{author:"test", message:"test"}, Branch_Context),
with_transaction(Branch_Context,
ask(Branch_Context,
insert(a,b,c)),
_),
Database_Descriptor = (Branch_Descriptor.repository_descriptor.database_descriptor),
resolve_relative_string_descriptor(Database_Descriptor, "remote/_commits", Remote_Repository_Descriptor),
create_context(Database_Descriptor, Database_Context),
with_transaction(Database_Context,
insert_remote_repository(Database_Context, "remote", "http://fakeytown.mock",_),
_),
create_ref_layer(Remote_Repository_Descriptor),
super_user_authority(Auth).
test(remote_diverged,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
throws(error(remote_unpack_failed(history_diverged),_))
])
:-
generic_setup_for_error_conditions(Branch_Descriptor, Auth),
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
push(system_descriptor{}, Auth, Branch, "remote", "main", [], erroring_push_predicate(error(history_diverged,_)), _Result).
test(remote_does_not_exist,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
throws(error(remote_unpack_failed(remote_unknown),_))
])
:-
generic_setup_for_error_conditions(Branch_Descriptor, Auth),
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
push(system_descriptor{}, Auth, Branch, "remote", "main", [], erroring_push_predicate(error(remote_unknown,_)), _Result).
test(remote_authorization_failed,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
throws(error(remote_unpack_failed(authorization_failure(_)),_))
])
:-
generic_setup_for_error_conditions(Branch_Descriptor, Auth),
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
push(system_descriptor{}, Auth, Branch, "remote", "main", [], erroring_push_predicate(error(authorization_failure(some_context_idunno),_)), _Result).
test(remote_communication_failed,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
throws(error(remote_unpack_failed(communication_failure(_)),_))
])
:-
generic_setup_for_error_conditions(Branch_Descriptor, Auth),
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
push(system_descriptor{}, Auth, Branch, "remote", "main", [], erroring_push_predicate(error(communication_failure(some_context_idunno),_)), _Result).
test(remote_gave_unknown_error,
[setup((setup_temp_store(State),
create_db_without_schema(admin,foo))),
cleanup(teardown_temp_store(State)),
throws(error(remote_unpack_unexpected_failure(error(phase_of_the_moon_is_wrong(full),_)),_))
])
:-
generic_setup_for_error_conditions(Branch_Descriptor, Auth),
resolve_absolute_string_descriptor(Branch, Branch_Descriptor),
push(system_descriptor{}, Auth, Branch, "remote", "main", [], erroring_push_predicate(error(phase_of_the_moon_is_wrong(full),_)), _Result).
:- end_tests(push).
| 40.141259 | 170 | 0.685203 |
73e1a030d65ec6b2fa8fc4e4ed5af1fec910b4f3 | 273 | t | Perl | misc/t-non-spec/06-bind-array.t | lablua/Perlito | 97c296f63f395ce6a9aa3cac1baeeed076b753a3 | [
"Artistic-2.0"
]
| 279 | 2015-01-10T22:22:27.000Z | 2022-03-11T00:00:26.000Z | misc/t-non-spec/06-bind-array.t | lablua/Perlito | 97c296f63f395ce6a9aa3cac1baeeed076b753a3 | [
"Artistic-2.0"
]
| 38 | 2015-07-12T20:06:59.000Z | 2022-02-01T09:23:58.000Z | misc/t-non-spec/06-bind-array.t | lablua/Perlito | 97c296f63f395ce6a9aa3cac1baeeed076b753a3 | [
"Artistic-2.0"
]
| 31 | 2015-02-18T14:55:57.000Z | 2022-02-24T16:53:19.000Z | use v6;
class Main {
say '1..2';
my $x := 1;
my $y := 2;
my $x1 := 0;
my $y1 := 0;
[ $x1, $y1 ] := [ $x, $y ];
if $x1 != 1 {
print 'not '
};
say 'ok ', $x1;
if $y1 != 2 {
print 'not '
};
say 'ok ', $y1;
}
| 12.409091 | 31 | 0.304029 |
ed08e5aa4a80ba99b0024f58a6272a3bab5eb1db | 14,456 | pl | Perl | bin/make_browsable_snapshot.pl | holtzermann17/Noosphere | 7be63c122f778ef00e56ffe847a6d40d004527dd | [
"MIT"
]
| 1 | 2018-05-31T06:29:48.000Z | 2018-05-31T06:29:48.000Z | bin/make_browsable_snapshot.pl | holtzermann17/Noosphere | 7be63c122f778ef00e56ffe847a6d40d004527dd | [
"MIT"
]
| null | null | null | bin/make_browsable_snapshot.pl | holtzermann17/Noosphere | 7be63c122f778ef00e56ffe847a6d40d004527dd | [
"MIT"
]
| 1 | 2021-05-02T15:14:36.000Z | 2021-05-02T15:14:36.000Z | #!/usr/bin/perl
###############################################################################
#
# Make an offline browsable snapshot of Noosphere (l2h) entries.
#
###############################################################################
use lib '/var/www/noosphere/lib';
use strict;
use vars qw{$dbh $signature %catlookup %lookup %rlookup};
my %catlookup;
my %rlookup;
my %lookup;
$signature = "Aaron Krowne and the entire team of PlanetMath contributors.";
use Noosphere;
use Noosphere::DB;
use Noosphere::Config;
use Noosphere::Util;
use Noosphere::Latex;
use Noosphere::Classification;
# get primary category code and human-readable name
#
sub getClassification {
my $objectid = shift;
my $code = "Unknown";
my @catcodes = Noosphere::getclass('objects',$objectid);
if (@catcodes) {
$code = $catcodes[0]->{'cat'};
}
return $code;
}
sub replaceURL {
my $name = shift;
return "HREF=\"../../".getTopCat($rlookup{$1})."/$lookup{$rlookup{$1}}/$lookup{$rlookup{$1}}.html\"";
}
sub getTopCat {
my $id = shift;
my $catcode = exists $catlookup{$id} ? $catlookup{$id} : 'Unknown';
my $topcat = substr($catcode, 0 , 2);
return $topcat;
}
# grab author, owner info for an object
#
sub getAuthorInfo {
my $objectid = shift;
my @authors;
my $owner;
my $sth = $dbh->prepare("select distinct userid from authors where tbl='objects' and objectid=$objectid order by ts desc");
$sth->execute();
while (my $row = $sth->fetchrow_arrayref()) {
push @authors, $row->[0];
}
$sth->finish();
my $owner = Noosphere::lookupfield('objects', 'userid', "uid=$objectid");
return ($owner, @authors);
}
# program entry point
#
sub main {
$dbh = Noosphere::dbConnect();
Noosphere::initNoosphere();
# get project name
#
my $projname = Noosphere::getConfig('projname');
# get directories
#
my $webroot = Noosphere::getConfig('main_url');
my $basedir = Noosphere::getConfig('base_dir');
my $cachedir = "$basedir/data/cache/objects";
my $snapdir = "$basedir/data/snapshots";
# get an object id => canonical name lookup table and
# canonical name => object id lookup tables.
#
my $sth = $dbh->prepare("select objectid, cname, type from objindex where tbl='objects'");
$sth->execute();
my $objectcount = $sth->rows();
while (my $row = $sth->fetchrow_hashref()) {
$lookup{$row->{'objectid'}} = $row->{'cname'} if ($row->{'type'} == 1);
$rlookup{$row->{'cname'}} = $row->{'objectid'};
}
$sth->finish();
# get an objectid => row lookup
#
my %rowlookup;
my $sth = $dbh->prepare("select * from objects");
$sth->execute();
my $objectcount = $sth->rows();
while (my $row = $sth->fetchrow_hashref()) {
$rowlookup{$row->{'uid'}} = $row;
}
$sth->finish();
# get classification lookup
#
$sth = $dbh->prepare("select msc.id as catid, classification.objectid from msc, classification where classification.ord = 0 and classification.catid = msc.uid and classification.tbl='objects'");
$sth->execute();
while (my $row = $sth->fetchrow_hashref()) {
$catlookup{$row->{'objectid'}} = $row->{'catid'};
}
$sth->finish();
# get user id => name lookup
#
my %userlookup;
my $sth = $dbh->prepare("select uid, username from users");
$sth->execute();
while (my $row = $sth->fetchrow_hashref()) {
$userlookup{$row->{'uid'}} = $row->{'username'};
}
$sth->finish();
# we'll keep index of authors (author => [entry ids]) here
#
my %authorindex;
# build date string
#
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon++;
my $datestr = sprintf("%04d-%02d-%02d", $year, $mon, $mday);
# make a working directory for the snapshot
#
my $version = $projname.'-snapshot_'.$datestr;
my $workingdir = $snapdir.'/'.$version;
system("mkdir $workingdir") == 0
or die "couldn't make directory '$workingdir'!";
system("mkdir $workingdir/entries");
# write out index: top level (select individual index char dirs)
#
# get list of index chars, make index directories
#
my $sth = $dbh->prepare("select distinct ichar from objindex where tbl='objects' order by ichar asc");
$sth->execute();
my @ichars;
while (my $row = $sth->fetchrow_arrayref()) {
my $ichar = $row->[0];
push @ichars, $ichar;
}
$sth->finish();
# iterate over concept labels in each index char, build html index and nav
# bar.
#
my $conceptcount = 0;
open NAV, ">$workingdir/navbar.html";
print NAV "<html>
<head>
<title>$projname $datestr Snapshot: Nav bar</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<body bgcolor=\"#ffffff\">
<table align=\"center\">
";
foreach my $ichar (@ichars) {
print "building index for $ichar\n";
# print nav bar line
print NAV "<tr><td align=\"center\"><a href=\"$ichar.html\" target=\"main\">$ichar</a></td></tr>\n";
# build index for this index char
open INDEX, ">$workingdir/$ichar.html";
print INDEX "<html>
<head>
<title>$projname $datestr Snapshot: $ichar</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<body bgcolor=\"#ffffff\">
<p>
<center>
<font size=\"+2\"><b>$ichar</b></font>
</center>
<p>
<hr width=\"90%\">
<p>
<table align=\"center\">";
# iterate over concept labels, indexing them
#
my $sth = $dbh->prepare("select * from objindex where ichar = '$ichar' and tbl='objects' order by title asc");
$sth->execute();
my @concepts;
while (my $row = $sth->fetchrow_hashref()) {
push @concepts, $row;
$conceptcount++;
}
$sth->finish();
foreach my $concept (sort {Noosphere::cleanCmp(Noosphere::mangleTitle($a->{'title'}),Noosphere::mangleTitle($b->{'title'}))} @concepts) {
print INDEX "<tr><td>\n";
my $mtitle = Noosphere::mangleTitle($concept->{'title'});
# get canonical name of object containing this definition/syn.
#
my $cname = $concept->{'cname'};
if ($concept->{'type'} > 1) {
$cname = $lookup{$rlookup{$cname}};
}
my $topcat = getTopCat($concept->{'objectid'});
# add link in directory for this concept
#
print INDEX "<a href=\"entries/$topcat/$cname/$cname.html\">$mtitle</a>";
# take account of synonyms
#
if ($concept->{'type'} == 2) {
my $parenttitle = Noosphere::lookupfield('objindex','title',"objectid=$concept->{objectid} and type=1 and tbl='objects'");
print INDEX " (=<i>$parenttitle</i>)";
}
# take account of defines
#
elsif ($concept->{'type'} == 3) {
my $parenttitle = Noosphere::lookupfield('objindex','title',"objectid=$concept->{objectid} and type=1 and tbl='objects'");
print INDEX " (defined in <i>$parenttitle</i>)";
}
print INDEX "\n</td></tr>\n";
}
print INDEX "
</table>
</body>
</html>
";
close INDEX;
}
print NAV "
</table>
</body>
</html>";
close NAV;
# keep count of edits (person-contributons to any entry)
#
my $edits = 0;
# iterate through cache directories, copying over each file and
# transforming links
#
my @dirs = <$cachedir/*>;
foreach my $dir (@dirs) {
if (-d $dir && $dir =~ /\/(\d+)$/) {
print "doing $dir\n";
my $id = $1;
my $name = $lookup{$id};
my $title = $rowlookup{$id}->{'title'};
my $version = $rowlookup{$id}->{'version'};
my $hits = $rowlookup{$id}->{'hits'};
my $created = Noosphere::ymd($rowlookup{$id}->{'created'});
my $catcode = exists $catlookup{$id} ? $catlookup{$id} : 'Unknown';
my $topcat = substr($catcode, 0 , 2);
# make directory for rendered output
#
system("mkdir $workingdir/entries/$topcat 2>/dev/null");
system("mkdir $workingdir/entries/$topcat/$name");
# copy over what we can verbatim (the TeX source, the images)
#
system("cp $dir/l2h/*.png $workingdir/entries/$topcat/$name");
# system("cp $dir/l2h/$name.tex $workingdir/entries/$topcat/$name");
system("cp $dir/l2h/$name.eps $workingdir/entries/$topcat/$name 2>/dev/null");
system("cp $dir/l2h/$name.css $workingdir/entries/$topcat/$name");
# get author and owner info for entry
#
my ($owner, @authors) = getAuthorInfo($id);
# make the TeX; add header
#
open FILE, "$dir/l2h/$name.tex";
my $tex = join('', <FILE>);
close FILE;
my $authorlist = join(', ', map { $userlookup{$_} } @authors);
my $header = "%%% This file is part of $projname snapshot of $datestr
%%% Primary Title: $title
%%% Primary Category Code: $catcode
%%% Filename: $name.tex
%%% Version: $version
%%% Owner: $userlookup{$owner}
%%% Author(s): $authorlist
%%% $projname is released under the GNU Free Documentation License.
%%% You should have received a file called fdl.txt along with this file.
%%% If not, please write to gnu\@gnu.org.
";
open OUTFILE, ">$workingdir/entries/$topcat/$name/$name.tex";
print OUTFILE $header.$tex;
close OUTFILE;
# make the HTML; translate URLs
#
open FILE, "$dir/l2h/index.html";
my $html = join('', <FILE>);
close FILE;
$html =~ s/HREF=\s*"$webroot\/encyclopedia\/(\w+).html"/replaceURL($1)/gsie;
my $authorhtml = "";
$authorhtml .= "Contributors to this entry (in most recent order):
<p>
<ul>
";
foreach my $authorid (@authors) {
# add to data for master author index
#
if (defined $authorindex{$authorid}) {
push @{$authorindex{$authorid}}, $id;
} else {
$authorindex{$authorid} = [$id];
}
$edits++;
# generate in-entry list element for this author
#
my $authorname .= $userlookup{$authorid};
$authorhtml .= "<li><a href=\"../../people.html#$authorid\">$authorname</a></li>\n";
}
$authorhtml .= "</ul>\n";
$authorhtml .= "<p>\n";
my $ownername = $userlookup{$owner};
$authorhtml .= "As of this snapshot date, this entry was owned by <a href=\"../../../people.html#$owner\">$ownername</a>.\n<p>\n";
# add contributor blurb to transformed entry HTML
#
$html =~ s/(<\/body>\s*<\/html>)/$authorhtml\n\n$1/si;
# add title to top (most entries dont have a title)
#
$html =~ s/(<BODY.*?>)/$1\n<p><center><font size="+3">$title<\/font><\/center>/si;
open OUTFILE, ">$workingdir/entries/$topcat/$name/$name.html";
print OUTFILE $html;
close OUTFILE;
}
}
# copy logo image over to the directory
#
system("cp $basedir/data/images/logo.png $workingdir");
# copy FDL over to the directory
#
system("cp $basedir/data/fdl/fdl.txt $workingdir");
# write main index
#
open MAIN, ">$workingdir/index.html";
print MAIN "<html>
<head>
<title>$projname $datestr Snapshot</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<frameset rows=\"75,*\">
<frame src=\"header.html\" scrolling=\"no\">
<frameset cols=\"100,*\">
<frame src=\"navbar.html\">
<frame src=\"frontpage.html\" name=\"main\">
</frameset>
</frameset>
</html>
";
close MAIN;
# write out author/contributor index
#
open PEOPLE, ">$workingdir/people.html";
print PEOPLE "<html>
<head>
<title>$projname $datestr Snapshot: Index of Contributors</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<body bgcolor=\"#ffffff\">
<center>
<font size=\"+3\"><b>Index of $projname Contributors</b></font>
</center>
<p>
<ul>
";
# output index entry for each contributor
#
foreach my $authorid (sort {lc($userlookup{$a}) <=> lc($userlookup{$b})} keys %authorindex) {
print PEOPLE "<li>";
# anchor
print PEOPLE "<a name=\"$authorid\">";
# name and link to user info page on web site
print PEOPLE "<a href=\"$webroot/?op=getuser&id=$authorid\" target=\"_parent\">$userlookup{$authorid}</a>\n";
print PEOPLE "<ul>\n";
# list of objects contributed to, with links
#
foreach my $objectid (sort {lc($rowlookup{$a}->{'title'}) <=> lc($rowlookup{$b}->{'title'})} @{$authorindex{$authorid}}) {
print PEOPLE "<li><a href=\"entries/$lookup{$objectid}/$lookup{$objectid}\">$rowlookup{$objectid}->{title}</a></li>\n";
}
print PEOPLE "</ul>\n";
print PEOPLE "</li>\n";
}
print PEOPLE "
</body>
</html>";
close PEOPLE;
my $contribcount = scalar keys %authorindex;
my $collabcount = $edits - $contribcount;
# write out front page
#
open FRONT, ">$workingdir/frontpage.html";
print FRONT "<html>
<head>
<title>$projname $datestr Snapshot</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<body bgcolor=\"#ffffff\">
<center>
<p>
<font size=\"+3\"><b>The $projname Collection</b></font>
<p>
<i>snapshot generated on $datestr</i>
<p>
<hr>
</center>
<p>
All entries in this collection copyrighted by their respective authors.
<p>
Permission is granted to copy, distribute and/or modify these documents under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled <a href=\"fdl.txt\">\"GNU Free Documentation License\"</a>.
<p>
<hr>
<p>
Statistics for this snapshot:
<p>
<ul>
<li>$objectcount entries.</li>
<li>$conceptcount distinct concepts.</li>
<li>$contribcount contributing writers.</li>
<li>$collabcount collaborations.</li>
</ul>
<p>
<hr>
<p>
To go to an index of contributors, click <a href=\"people.html\">here</a>.
<p>
<b>To navigate this snapshot, use the alphabetical index in the left frame</b>. Within entries, you can follow links to other entries as usual.
<p>
Enjoy!
<p>
— $signature
</body>
</html>
";
close FRONT;
# make header
#
open HEADER, ">$workingdir/header.html";
print HEADER "<html>
<head>
<title>$projname $datestr Snapshot</title>
<META HTTP-EQUIV=\"content-type\" CONTENT=\"text/html; charset=UTF-8\">
</head>
<body bgcolor=\"#ffffff\">
<table width=\"100%\">
<tr>
<td align=\"left\">
<img src=\"logo.png\">
</td>
<td align=\"right\">
<a href=\"index.html\" target=\"_parent\">top</a> |
<a href=\"people.html\" target=\"main\">contributors</a> |
<a href=\"fdl.txt\" target=\"main\">license</a> |
<a href=\"$webroot\" target=\"_parent\">web site</a>
</td>
</tr>
</table>
</body>
</html>";
close HEADER;
# make working directory into tarball
#
chdir($snapdir);
system("tar -czf $version.tar.gz $version/");
system("rm -rf $version/");
$dbh->disconnect();
}
main();
| 22.982512 | 407 | 0.62161 |
ed0124c742fef94a25cc78d7895475be3bc976e7 | 2,509 | pl | Perl | scripts/examples/tree_getDistances.pl | MatBarba/ensembl-compara | e7b0ac16adca6849934b15bc37e58603be3690ff | [
"Apache-2.0"
]
| null | null | null | scripts/examples/tree_getDistances.pl | MatBarba/ensembl-compara | e7b0ac16adca6849934b15bc37e58603be3690ff | [
"Apache-2.0"
]
| null | null | null | scripts/examples/tree_getDistances.pl | MatBarba/ensembl-compara | e7b0ac16adca6849934b15bc37e58603be3690ff | [
"Apache-2.0"
]
| null | null | null | #!/usr/bin/env perl
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2018] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
#
# This script fetches the Compara tree of PAX6, identifies
# the PAX6 leaf, and a random zebrafish leaf. It prints the
# distances to these leaves from the root and their last
# common ancestor
#
my $reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db(
-host=>'ensembldb.ensembl.org',
-user=>'anonymous',
);
my $human_gene_adaptor = $reg->get_adaptor ("Homo sapiens", "core", "Gene");
my $gene_member_adaptor = $reg->get_adaptor ("Multi", "compara", "GeneMember");
my $gene_tree_adaptor = $reg->get_adaptor ("Multi", "compara", "GeneTree");
my $genes = $human_gene_adaptor-> fetch_all_by_external_name('PAX6');
foreach my $gene (@$genes) {
my $gene_member = $gene_member_adaptor-> fetch_by_stable_id($gene->stable_id);
die "no members" unless (defined $gene_member);
# Fetch the gene tree
my $tree = $gene_tree_adaptor->fetch_default_for_Member($gene_member);
next unless $tree;
my $all_leaves = $tree->get_all_leaves();
my $node_h;
my $node_z;
while (my $leaf = shift @$all_leaves) {
# finds a zebrafish gene
$node_z = $leaf if ($leaf->taxon_id == 7955);
# finds the query gene
$node_h = $leaf if ($leaf->gene_member->stable_id eq $gene->stable_id);
}
print "human: ", $node_h->toString(), "\n";
print "zebra: ", $node_z->toString(), "\n",
print "root to human: ", $node_h->distance_to_ancestor($tree->root), "\n";
print "root to zebra: ", $node_z->distance_to_ancestor($tree->root), "\n";
my $ancestor = $node_z->find_first_shared_ancestor($node_h);
print "lca: ";
$ancestor->print_node;
print "lca to human: ", $node_h->distance_to_ancestor($ancestor), "\n";
print "lca to zebra: ", $node_z->distance_to_ancestor($ancestor), "\n";
}
| 33.013158 | 102 | 0.708649 |
73d39df530ba75c7766d5d4b82a6c72ff924154b | 1,849 | t | Perl | riscv/llvm/3.5/binutils-2.21.1/gold/testsuite/script_test_2.t | HackLinux/goblin-core | 7333461b7c7ad60c7c023ce898baff356cb617f5 | [
"BSD-3-Clause"
]
| 3 | 2019-02-12T04:14:39.000Z | 2020-11-05T08:46:20.000Z | binutils/gold/testsuite/script_test_2.t | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
]
| null | null | null | binutils/gold/testsuite/script_test_2.t | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
]
| 1 | 2021-03-24T06:40:32.000Z | 2021-03-24T06:40:32.000Z | /* script_test_2.t -- linker script test 2 for gold
Copyright 2008 Free Software Foundation, Inc.
Written by Ian Lance Taylor <iant@google.com>.
This file is part of gold.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
test_addr_alias = test_addr;
SECTIONS
{
/* With luck this will work everywhere. */
. = 0x10000000;
/* With luck this will be enough to get the program working. */
.text : { *(.text) }
. += 0x100000;
. = ALIGN(0x100);
.data : { *(.data) }
.bss : { *(.bss) }
/* Now the real test. */
. = 0x20000001;
start_test_area = .;
.gold_test ALIGN(16) : SUBALIGN(32) {
start_test_area_1 = .;
/* No sections should wind up here, because of the EXCLUDE_FILE. */
*( EXCLUDE_FILE(script_test*) .gold_test)
/* This should match only script_test_2b.o. */
script_test_2b.o(.gold_test)
/* This should match the remaining sections. */
*(.gold_test)
. = . + 4;
start_data = .;
BYTE(1)
SHORT(2)
LONG(4)
QUAD(8)
end_data = .;
start_fill = .;
FILL(0x12345678);
. = . + 7;
BYTE(0)
end_fill = .;
}
end_test_area = .;
test_addr = ADDR(.gold_test);
}
| 26.797101 | 72 | 0.655489 |
73d600f855884ffe81c9371355afe384a695a2eb | 2,420 | pl | Perl | texttobr.pl | luciangreen/Text-to-Breasonings | 91250944f0d2487f62892c182e4ba2937333b091 | [
"BSD-3-Clause"
]
| null | null | null | texttobr.pl | luciangreen/Text-to-Breasonings | 91250944f0d2487f62892c182e4ba2937333b091 | [
"BSD-3-Clause"
]
| null | null | null | texttobr.pl | luciangreen/Text-to-Breasonings | 91250944f0d2487f62892c182e4ba2937333b091 | [
"BSD-3-Clause"
]
| null | null | null | %% use_module(library(pio)). In la_strings
%% texttobr - converts file stream to list of 3D dimensions of each character
texttobr(N1,Filex1,Stringx1,M1) :-
((number(N1),N=N1)->true;
(N1=u,N=1)),
((Filex1=u,Filex="file.txt")->true;
Filex=Filex1),
((number(M1),M=M1)->true;
M=all), %% If m1 is undefined or all then m=all
texttobrc1(N,Filex,Stringx1,M),!.
texttobrc1(0,_,_,_) :- !.
texttobrc1(N1,Filex,Stringx1,BreasoningLimit) :-
texttobrc2(Filex,Stringx1,BreasoningLimit),
N2 is N1-1,
texttobrc1(N2,Filex,Stringx1,BreasoningLimit).
texttobrc2(Filex,Stringx1,M) :-
((Stringx1=u,
phrase_from_file_s(string2(String1), Filex))->true;
string_codes(Stringx1,String1)),
((number(M),length(String,M),
append(String,_,String1))->true;
String=String1),
br(String),!.
string2(String) --> list2(String).
list2([]) --> [].
list2([L|Ls]) --> [L], list2(Ls).
br([]) :-
!.
br([Code|Codes]) :-
char_code(Character,Code),
br(Character,_X,_Y,_Z),
brth2(Character,_Brth),
%%writeln([Character]),%%,X,Y,Z]), %%
%%write(' '),
br(Codes).
brth2(_,sweetinvincibleandprayedfor).
br('A',1,1.5,0).
br('B',1,1.5,0).
br('C',1,1.5,0).
br('D',1,1.5,0).
br('E',1,1.5,0).
br('F',1,1.5,0).
br('G',1,1.5,0).
br('H',1,1.5,0).
br('I',1,1.5,0).
br('J',1,1.5,0).
br('K',1,1.5,0).
br('L',1,1.5,0).
br('M',1,1.5,0).
br('N',1,1.5,0).
br('O',1,1.5,0).
br('P',1,1.5,0).
br('Q',1,1.5,0).
br('R',1,1.5,0).
br('S',1,1.5,0).
br('T',1,1.5,0).
br('U',1,1.5,0).
br('V',1,1.5,0).
br('W',1,1.5,0).
br('X',1,1.5,0).
br('Y',1,1.5,0).
br('Z',1,1.5,0).
br('a',1,1,0).
br('b',1,1.5,0).
br('c',1,1,0).
br('d',1,1.5,0).
br('e',1,1,0).
br('f',1,2.5,0).
br('g',1,2,0).
br('h',1,1.5,0).
br('i',1,1.5,0).
br('j',1,2.5,0).
br('k',1,1.5,0).
br('l',1,1.5,0).
br('m',1,1,0).
br('n',1,1,0).
br('o',1,1,0).
br('p',1,2,0).
br('q',1,2,0).
br('r',1,1,0).
br('s',1,1,0).
br('t',1,1.5,0).
br('u',1,1,0).
br('v',1,1,0).
br('w',1,1,0).
br('x',1,1,0).
br('y',1,2,0).
br('z',1,1,0).
br('?',1,1.5,0).
br('-',1,1,0).
br(' ',1,1,0).
br(',',1,1,0).
br('(',1,1.5,0).
br(')',1,1.5,0).
br('|',1,2.5,0).
br('.',1,1,0).
br(':',1,1,0).
br('_',1,1,0).
br('\'',1,1.5,0).
br('[',1,1.5,0).
br(']',1,1.5,0).
br('<',1,1,0).
br('>',1,1,0).
br('0',1,1.5,0).
br('1',1,1.5,0).
br('2',1,1.5,0).
br('3',1,1.5,0).
br('4',1,1.5,0).
br('5',1,1.5,0).
br('6',1,1.5,0).
br('7',1,1.5,0).
br('8',1,1.5,0).
br('9',1,1.5,0).
br('{',1,1.5,0).
br('}',1,1.5,0).
br('\n',1,1,0).
br(_,1,1,0).
| 17.925926 | 77 | 0.518182 |
73ed4257d63b72d47d2ac234fd5443e97f13dd1c | 841 | t | Perl | t/bug-null-operation.t | fastmailops/perl-Crypt-OpenSSL-Verify | cb5eb3c7d8f6e73744edba4283f1ba14cc08b81d | [
"OpenSSL"
]
| null | null | null | t/bug-null-operation.t | fastmailops/perl-Crypt-OpenSSL-Verify | cb5eb3c7d8f6e73744edba4283f1ba14cc08b81d | [
"OpenSSL"
]
| 11 | 2020-06-13T01:05:40.000Z | 2021-01-27T22:43:51.000Z | t/bug-null-operation.t | timlegge/perl-Crypt-OpenSSL-Verify_old | 0ab1b9fdb1284fd19a714c8b7dce974e402afe88 | [
"OpenSSL"
]
| 4 | 2020-11-17T00:37:27.000Z | 2021-04-03T14:41:13.000Z | use warnings;
use strict;
use Test::More;
use Test::Exception;
use File::Spec::Functions qw(catfile);
package Test::Bug;
use Exporter qw(import);
our @EXPORT = qw(test_null_operation_bug);
use Crypt::OpenSSL::Verify;
use File::Slurp qw(read_file);
use Crypt::OpenSSL::X509;
sub test_null_operation_bug {
my ($ca, $cert) = @_;
my $x = Crypt::OpenSSL::Verify->new($ca);
my $x509 = Crypt::OpenSSL::X509->new_from_string(scalar read_file($cert));
return $x->verify($x509);
}
package main;
{
my @warn;
local $SIG{__WARN__} = sub { push(@warn, @_) };
Test::Bug::test_null_operation_bug(
catfile(qw(t cacert.pem)),
catfile(qw(t cert.pem))
);
if (!is(@warn, 0, "No warnings emitted")) {
diag explain \@warn;
}
}
done_testing();
| 19.113636 | 82 | 0.599287 |
ed12a91c1fb8463114027e283333511e5b205762 | 1,178 | pl | Perl | sdcard-wifi-ssh/initrd_extracted/usr/lib/arm-linux-gnueabihf/perl-base/unicore/lib/Bpt/O.pl | zwo-bot/keybow-firmware | 0de2da9c4be1ee588f92f486b682985dace6e633 | [
"MIT"
]
| 1 | 2019-02-22T05:19:40.000Z | 2019-02-22T05:19:40.000Z | sdcard-wifi-ssh/initrd_extracted/usr/lib/arm-linux-gnueabihf/perl-base/unicore/lib/Bpt/O.pl | zwo-bot/keybow-firmware | 0de2da9c4be1ee588f92f486b682985dace6e633 | [
"MIT"
]
| null | null | null | sdcard-wifi-ssh/initrd_extracted/usr/lib/arm-linux-gnueabihf/perl-base/unicore/lib/Bpt/O.pl | zwo-bot/keybow-firmware | 0de2da9c4be1ee588f92f486b682985dace6e633 | [
"MIT"
]
| 1 | 2020-11-04T07:54:34.000Z | 2020-11-04T07:54:34.000Z | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 10.0.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
return <<'END';
V120
40
41
91
92
123
124
3898
3899
3900
3901
5787
5788
8261
8262
8317
8318
8333
8334
8968
8969
8970
8971
9001
9002
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10181
10182
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10712
10713
10714
10715
10748
10749
11810
11811
11812
11813
11814
11815
11816
11817
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12308
12309
12310
12311
12312
12313
12314
12315
65113
65114
65115
65116
65117
65118
65288
65289
65339
65340
65371
65372
65375
65376
65378
65379
END
| 8.725926 | 77 | 0.766553 |
73ef77a4d8e9d3da7b43505684b4e017e8dbc579 | 616 | pl | Perl | misc/generate_gitrev.pl | kidd-playground/h2o | 772ce3c1bc0912bfa05ca0be48fdb762ba1b6dcb | [
"MIT"
]
| 8,657 | 2015-01-01T00:35:54.000Z | 2022-03-31T08:32:33.000Z | misc/generate_gitrev.pl | kidd-playground/h2o | 772ce3c1bc0912bfa05ca0be48fdb762ba1b6dcb | [
"MIT"
]
| 2,228 | 2015-01-01T17:42:01.000Z | 2022-03-31T12:32:04.000Z | misc/generate_gitrev.pl | kidd-playground/h2o | 772ce3c1bc0912bfa05ca0be48fdb762ba1b6dcb | [
"MIT"
]
| 911 | 2015-01-01T02:27:36.000Z | 2022-03-25T08:39:46.000Z | #!/usr/bin/env perl
use strict;
use warnings;
my $gitrev = exec_git_command('git rev-parse --short HEAD') or die "failed to get current revision";
my $content = "#define H2O_GITREV $gitrev\n";
my $outpath = 'include/h2o/gitrev.h';
my $current = -f $outpath ? do {
open(my $fh, '<', $outpath) or die "failed to open $outpath: $!";
join('', <$fh>);
} : '';
if ($content ne $current) {
open(my $fh, '>', $outpath) or die "failed to open $outpath: $!";
print $fh $content;
print "Updated $outpath\n";
}
sub exec_git_command {
my ($cmd) = @_;
my $out = `$cmd`;
chomp $out;
$out;
}
| 23.692308 | 100 | 0.592532 |
ed0eb1303813df955bbf0fa9924cb7c7692e72b6 | 2,681 | pm | Perl | lib/Perl/Critic/Utils/POD/ParseInteriorSequence.pm | atoomic/Perl-Critic | e3e5f8cf53517c9ba053585ae131216ae3a2de41 | [
"Artistic-1.0"
]
| null | null | null | lib/Perl/Critic/Utils/POD/ParseInteriorSequence.pm | atoomic/Perl-Critic | e3e5f8cf53517c9ba053585ae131216ae3a2de41 | [
"Artistic-1.0"
]
| null | null | null | lib/Perl/Critic/Utils/POD/ParseInteriorSequence.pm | atoomic/Perl-Critic | e3e5f8cf53517c9ba053585ae131216ae3a2de41 | [
"Artistic-1.0"
]
| null | null | null | package Perl::Critic::Utils::POD::ParseInteriorSequence;
use 5.006001;
use strict;
use warnings;
use base qw{ Pod::Parser };
use IO::String;
our $VERSION = '1.134';
#-----------------------------------------------------------------------------
sub interior_sequence {
my ( $self, $seq_cmd, $seq_arg, $pod_seq ) = @_;
push @{ $self->{+__PACKAGE__}{interior_sequence} ||= [] }, $pod_seq;
return $self->SUPER::interior_sequence( $seq_cmd, $seq_arg, $pod_seq );
}
#-----------------------------------------------------------------------------
sub get_interior_sequences {
my ( $self, $pod ) = @_;
$self->{+__PACKAGE__}{interior_sequence} = [];
my $result;
$self->parse_from_filehandle(
IO::String->new( \$pod ),
IO::String->new( \$result )
);
return @{ $self->{+__PACKAGE__}{interior_sequence} };
}
#-----------------------------------------------------------------------------
1;
__END__
#-----------------------------------------------------------------------------
=pod
=for stopwords
=head1 NAME
Perl::Critic::Utils::POD::ParseInteriorSequence - Pod::Parser subclass to find all interior sequences.
=head1 SYNOPSIS
use Perl::Critic::Utils::POD::ParseInteriorSequence;
my $parser = Perl::Critic::Utils::POD::ParseInteriorSequence->new();
my @sequences = $parser->parse_interior_sequences(
$pod->content() );
=head1 DESCRIPTION
Provides a means to extract interior sequences from POD text.
=head1 INTERFACE SUPPORT
This module is considered to be private to Perl::Critic. It can be
changed or removed without notice.
=head1 METHODS
=over
=item C<get_interior_sequences( $pod_text )>
Returns an array of all the interior sequences from a given chunk of POD
text, represented as L<Pod::InteriorSequence|Pod::InputObjects> objects.
The POD text is assumed to begin with a POD command (e.g. C<=pod>).
=item C<interior_sequence( $seq_cmd, $seq_arg, $pod_seq )>
Overrides the parent's method of the same name. Stashes the $pod_seq
argument, which is a C<Pod::InteriorSequence> object, so that
C<get_interior_sequences()> has access to it.
=back
=head1 AUTHOR
Thomas R. Wyant, III F<wyant at cpan dot org>
=head1 COPYRIGHT
Copyright (c) 2011 Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
=cut
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 78
# indent-tabs-mode: nil
# c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
| 23.725664 | 102 | 0.618426 |
73e7e2b65e4eb6b7abe584261cecf0155335c8ad | 17,755 | pm | Perl | lib/DBD/PgLite/MirrorPgToSQLite.pm | git-the-cpan/DBD-PgLite | 7f7fce3f920b65452ae3682438cfe3061615c6f4 | [
"Artistic-1.0-cl8"
]
| null | null | null | lib/DBD/PgLite/MirrorPgToSQLite.pm | git-the-cpan/DBD-PgLite | 7f7fce3f920b65452ae3682438cfe3061615c6f4 | [
"Artistic-1.0-cl8"
]
| null | null | null | lib/DBD/PgLite/MirrorPgToSQLite.pm | git-the-cpan/DBD-PgLite | 7f7fce3f920b65452ae3682438cfe3061615c6f4 | [
"Artistic-1.0-cl8"
]
| null | null | null | package DBD::PgLite::MirrorPgToSQLite;
use strict;
use DBI;
use Storable;
use File::Copy;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(pg_to_sqlite);
our $VERSION = '0.05';
#### MAIN SUBROUTINE ####
sub pg_to_sqlite {
my %opt = @_;
my %defaults = defaults();
for (keys %defaults) {
next if exists $opt{$_};
$opt{$_} = $defaults{$_};
}
$opt{tables} = _commasplit($opt{tables});
$opt{views} = _commasplit($opt{views});
if ($opt{where}
&& $opt{where} !~ /^\s*where\s/i
&& $opt{where} !~ /^\s*(?:natural\s+)?join\s/i) {
$opt{where} = 'where '.$opt{where};
}
die "Incompatible options: 'append' and 'snapshot'" if $opt{append} && $opt{snapshot};
die "Need either database handle (pg_dbh) or DSN (pg_dsn)" unless $opt{pg_dbh} || $opt{pg_dsn};
my $disconnect = 0;
unless ($opt{pg_dbh}) {
$disconnect++;
$opt{pg_dbh} = DBI->connect(@opt{ qw(pg_dsn pg_user pg_pass) },{RaiseError=>1})
or die "Could not connect to PostgreSQL: $DBI::errstr";
}
my $fn = $opt{sqlite_file};
die "Need both list of source tables and a SQLite file" unless @{$opt{tables}} && $fn;
$|++ if $opt{verbose};
my $lockfile = "$fn.lock";
lockfile('create',$lockfile);
if (-f "$fn.tmp") {
warn "WARNING: Removing temp file $fn.tmp - apparently left over from a previous run\n";
unlink "$fn.tmp" or die "ERROR: Could not remove file.tmp: $!\n";
}
if ($opt{append}) {
unless (copy $fn, "$fn.tmp") {
warn "WARNING: Could not copy $fn to $fn.tmp for appending: $! - turning --append off\n";
$opt{append} = 0;
}
}
$opt{sl_dbh} = DBI->connect("dbi:SQLite:dbname=$fn.tmp",undef,undef,{RaiseError=>1});
my @tables = tablelist($opt{pg_dbh}, $opt{schema}, @{ $opt{tables} }); # handle regexp
print "MIRRORING ".scalar(@tables)." table(s):\n" if $opt{verbose};
my @views = viewlist($opt{pg_dbh}, $opt{schema}, @{ $opt{views} })
if grep { /^\/.+\/$/ } @{ $opt{views} };
eval {
if ($opt{snapshot}) {
$opt{pg_dbh}->do("set session characteristics as transaction isolation level serializable");
$opt{pg_dbh}->begin_work;
mirror_table($_,%opt) for @tables;
mirror_functions(%opt) if $opt{functions};
$opt{pg_dbh}->commit;
} else {
mirror_table($_,%opt) for @tables;
mirror_functions(%opt) if $opt{functions};
}
if (@views) {
print "CREATING ".scalar(@views)." view(s):\n" if $opt{verbose};
create_view($_,%opt) for @views;
}
print "done!\n" if $opt{verbose};
};
if ($@) {
lockfile('clear',$lockfile);
die $@;
}
$opt{pg_dbh}->disconnect if $disconnect;
$opt{sl_dbh}->disconnect;
if (-f $fn) {
copy $fn, "$fn.bak" or warn "WARNING: Could not make backup copy of $fn: $!\n";
}
move "$fn.tmp", $fn or die "ERROR: Could not move temporary SQLite file $fn.tmp to $fn";
lockfile('clear',$lockfile);
}
########## OTHER SUBROUTINES ###########
sub _commasplit {
my $list = shift;
return [] unless $list;
$list = [$list] unless ref $list;
my @new = split(/\s*,\s*/,join(',',@$list));
return \@new;
}
sub defaults {
my %defaults = (
verbose => 0,
pg_dsn => ($ENV{PGDATABASE} ? "dbi:Pg:dbname=$ENV{PGDATABASE}" : undef),
pg_user => ($ENV{PGUSER} || $ENV{USER}),
pg_pass => $ENV{PGPASSWORD},
schema => 'public',
tables => [],
sqlite_file => '',
where => '',
cachedir => '/tmp/sqlite_mirror_cache',
append => 0,
snapshot => 0,
indexes => 0,
views => [],
functions => 0,
page_limit => 5000, # each page is 8K
pg_dbh => undef,
);
$defaults{pg_dsn} ||= "dbi:Pg:dbname=$defaults{pg_user}" if $defaults{pg_user};
return %defaults;
}
sub mirror_table {
my ($tn,%opt) = @_;
my $sn = $opt{schema};
print " - $sn.$tn\n" if $opt{verbose};
my ($create,$colcnt) = get_schema($sn,$tn,%opt);
my $drop = '';
if ($opt{append}) {
$drop = $opt{sl_dbh}->selectrow_array("select name from sqlite_master where type = 'table' and name = ?",{},$tn);
$opt{sl_dbh}->do("drop table $tn") if $drop;
}
$opt{sl_dbh}->do($create);
my $pages = $opt{pg_dbh}->selectrow_array("select relpages from pg_class where relnamespace = (select oid from pg_namespace where nspname = ?) and relname = ?",{},$sn,$tn);
my $ins = $opt{sl_dbh}->prepare("insert into $tn values (". join(',', ("?") x $colcnt) . ")");
if ($pages > $opt{page_limit}) {
warn " pagelimit ($opt{page_limit}) kicks in for $sn.$tn ($pages)\n" if $opt{verbose};
my @pkey = $opt{pg_dbh}->primary_key(undef,$sn,$tn);
warn " (pkey is )".join(":",@pkey)."\n" if $opt{verbose};
if (@pkey) {
my $pkey_vals = $opt{pg_dbh}->selectall_arrayref("select ".join(', ', @pkey)." from $sn.$tn");
my $sql = "select * from $sn.$tn where ".join(" and ", map {"$_ = ?"} @pkey);
my $selh = $opt{pg_dbh}->prepare($sql);
$opt{sl_dbh}->begin_work;
foreach (@$pkey_vals) {
$selh->execute(@$_);
my $row = $selh->fetchrow_arrayref;
$ins->execute(@$row);
}
$opt{sl_dbh}->commit;
$selh->finish;
}
else {
warn "*** CANNOT READ $sn.$tn ROW-BY-ROW - NO PRIMARY KEY\n*** SKIPPING TABLE!\n";
$ins->finish;
return;
}
}
else {
my $res = $opt{pg_dbh}->selectall_arrayref("select * from $sn.$tn $opt{where}");
if (@$res && scalar(@{$res->[0]}) != $colcnt) {
$ins->finish;
die "ERROR: Bad schema for table $tn: number of columns does not match\n";
}
$opt{sl_dbh}->begin_work;
$ins->execute(@$_) for @$res;
$opt{sl_dbh}->commit;
}
$ins->finish;
create_indexes($tn,%opt) if $opt{indexes};
$opt{sl_dbh}->do("vacuum") if $drop;
}
sub mirror_functions {
my %opt = @_;
unless ($opt{sl_dbh}->selectrow_array("select name from sqlite_master where name = 'pglite_functions' and type = 'table'")) {
$opt{sl_dbh}->do("CREATE TABLE pglite_functions (name text, argnum int, type text, sql text, primary key (name,argnum))");
}
my $langnum = $opt{pg_dbh}->selectrow_array("select oid from pg_language where lanname = 'sql'");
my $snum = $opt{pg_dbh}->selectrow_array("select oid from pg_namespace where nspname = ?",{},$opt{schema});
my $fun = $opt{pg_dbh}->selectall_arrayref("select proname, pronargs, prosrc from pg_proc where prolang = ? and pronamespace = ?",{},$langnum,$snum);
print "FUNCTIONS:\n" if $opt{verbose};
return unless ref $fun eq 'ARRAY' && @$fun;
for (@$fun) {
my ($name,$argnum,$sql) = @$_;
unless ($opt{sl_dbh}->selectrow_array("select name from pglite_functions where name = ? and argnum = ?",{},$name,$argnum)) {
print " - $name ($argnum)\n" if $opt{verbose};
$opt{sl_dbh}->do("insert into pglite_functions (name,argnum,type,sql) values (?,?,'sql',?)",{},$name,$argnum,$sql);
}
}
}
sub create_indexes {
my ($tn,%opt) = @_;
my $sn = $opt{schema};
my $ixn = $opt{pg_dbh}->selectcol_arrayref("select indexdef from pg_indexes where schemaname = ? and tablename = ? ", {}, $sn,$tn);
for (@$ixn) {
next if /\(oid\)/;
next if /_pkey\b/; # No need to recreate primary keys
s/USING btree //;
s/ ON \w+\.\"?([^\"]+)\"?/ ON $1/;
print " + $_\n" if $opt{verbose};
eval { $opt{sl_dbh}->do($_); };
# Pg supports multiple null values in unique columns - SQLite doesn't
if ($@ =~ /unique/i && s/ UNIQUE / /) {
print " + retry: $_\n" if $opt{verbose};
eval { $opt{sl_dbh}->do($_); };
}
}
}
sub create_view {
my ($vn,%opt) = @_;
my $sn = $opt{schema};
my $def = $opt{pg_dbh}->selectrow_array("select definition from pg_views where schemaname = ? and viewname = ?",{},$sn,$vn);
print " - $sn.$vn\n" if $opt{verbose};
$def =~ s/::\w+//g; # casting is not supported in SQLite
if ($opt{sl_dbh}->selectrow_array("select name from sqlite_master where name = ? and type = 'view'",{},$vn)) {
eval { $opt{sl_dbh}->do("drop view $vn") };
}
eval { $opt{sl_dbh}->do("create view $vn as $def"); };
warn " *** COULD NOT CREATE VIEW $sn.$vn *** \n" if $@;
}
sub tablelist {
my ($pg,$sn,@pats) = @_;
my %tables; # prevent duplicate table names
for my $pat (@pats) {
if ($pat =~ s/^\/(.+)\/$/$1/) {
my $res = $pg->selectcol_arrayref("select tablename from pg_tables where lower(schemaname) = lower('$sn') and tablename ~* '$pat'");
$tables{$_}++ for @$res;
} else {
$tables{$pat}++;
}
}
return keys %tables;
}
sub viewlist {
my ($pg,$sn,@pats) = @_;
my %views; # prevent duplicate table names
for my $pat (@pats) {
if ($pat =~ s/^\/(.+)\/$/$1/) {
my $res = $pg->selectcol_arrayref("select viewname from pg_views where lower(schemaname) = lower('$sn') and viewname ~* '$pat'");
$views{$_}++ for @$res;
} else {
$views{$pat}++;
}
}
return keys %views;
}
sub get_schema {
my ($sn,$tn,%opt) = @_;
# Constructing a schema definition can be rather slow,
# so we cache the result for up to a week
my @cached = cached_schema($sn,$tn,undef,undef,%opt);
return @cached if @cached;
my @cdef = col_def($sn,$tn,%opt);
my $colcnt = scalar @cdef;
my @pknames = $opt{pg_dbh}->primary_key(undef,$sn,$tn);
push @cdef, "primary key (" . join(',',@pknames) . ")" if @pknames && $pknames[0] ne '';
my $create = "create table $tn (\n ".join(",\n ",@cdef)."\n)\n";
cached_schema($sn,$tn,$create,$colcnt,%opt);
return ($create, $colcnt);
}
sub cached_schema {
my ($sn,$tn,$creat,$cnt,%opt) = @_;
my $database = $opt{pg_dbh}->{mbl_dbh}
? $opt{pg_dbh}->{mbl_dbh}->[0]->{Name}
: $opt{pg_dbh}->{Name};
unless (-d $opt{cachedir}) {
mkdir $opt{cachedir};
chmod 0777, $opt{cachedir};
}
my $uid = (getpwuid($>))[0] || $>;
mkdir "$opt{cachedir}/$uid" unless -d "$opt{cachedir}/$uid";
my $fn = "$opt{cachedir}/$uid/$database.$sn.$tn";
if ($cnt) {
Storable::store [$creat,$cnt], $fn;
} elsif (-f $fn && time-(stat $fn)[9]<7*24*60*60) {
my $ret = Storable::retrieve $fn || [];
return @$ret;
} else {
return ();
}
}
sub col_def {
my ($sn,$tn,%opt) = @_;
my $sth = $opt{pg_dbh}->column_info(undef,$sn,$tn,undef);
$sth->execute;
my $res = $sth->fetchall_arrayref;
my @ret;
foreach my $ci (@$res) {
my ($colnam,$typnam,$nullable) = @{$ci}[qw(3 5 10)]; #)];
my $notnull = $nullable ? "" : " not null";
push @ret, "$colnam $typnam$notnull";
}
$sth->finish;
return @ret;
}
sub lockfile {
my ($action,$lockfile) = @_;
if ($action eq 'create') {
die "ERROR: Lockfile $lockfile exists - cannot continue" if -f $lockfile;
open LOCK, ">", "$lockfile" or die "ERROR: Could not open lockfile $lockfile: $!";
print LOCK $$;
close LOCK;
} elsif ($action eq 'clear') {
if (-f $lockfile) {
unlink $lockfile or die "ERROR: Could not remove lockfile $lockfile: $!";
} else {
warn "WARNING: Lockfile $lockfile does not exist - cannot clear" unless -f $lockfile;
}
}
}
1;
__END__
=pod
=head1 NAME
DBD::PgLite::MirrorPgToSQLite - Mirror tables from PostgreSQL to SQLite
=head1 SUMMARY
use DBD::PgLite::MirrorPgToSQLite qw(pg_to_sqlite);
pg_to_sqlite(
sqlite_file => '/var/pg_mirror/news.sqlite',
pg_dbh => $dbh,
schema => 'news',
tables => [ qw(news cat img /^x_news/)],
views => [ 'v_newslist' ],
indexes => 1,
verbose => 1,
snapshot => 1,
);
=head1 USAGE
The purpose of this module is to facilitate mirroring of tables from a
PostgreSQL dataabse to a SQLite file. The module has only be tested
with PostgreSQL 7.3 and SQLite 3.0-3.2. SQLite 2.x will probably not
work; as for PostgreSQL, any version after 7.2 is supposed to work. If
it doesn't, please let me know.
As seen above, options to the pg_to_sqlite() function (which is
exported on request) are passed in as a hash. These options are
described below. The default values can be changed by overriding the
DBD::PgLite::MirrorPgToSQLite::defaults() subroutine.
=head2 Required options
Obviously, the mirroring function needs either a PosgtgreSQL database
connection or enough information to be able to connect to the database
by itself. It also needs the name of a target SQLite file, and a list
of tables to copy between the two databases.
=over 4
=item pg_dbh, pg_user, pg_pass, pg_dsn
If a database handle is specified in I<pg_dbh>, it takes
precedence. Otherwise we try to connect using I<pg_dsn>, I<pg_user>,
and I<pg_pass> (which are assigned defaults based on the environment
variables PGDATABASE, PGUSER and PGPASSWORD, if any of these is
present).
=item tables
The value of the required I<tables> option should be an arrayref of
strings or a string containing a comma-separated list of tablenames
and tablename patterns. A tablename pattern is a string or distinct
string portion delimited by forward slashes. To clarify: Suppose that
a database contains the tables news, img, img_group, cat, users,
comments, news_read_log, x_news_cat, x_news_img, and x_img_group; and
that we want to mirror news, img, cat, x_news_img and x_news_cat,
leaving the other tables alone. To achieve this, you would set the
I<tables> option to any of the following (there are of course also
other possibilities):
(1) [qw(news img cat x_news_img x_news_cat)]
(2) 'news, img, cat, x_news_img, x_news_cat'
(3) [qw(news /img$/ /cat$/)]
(4) 'news,/img$/,/cat/'
The purpose of this seemingly unneccesary flexibility in how the table
list is specified is to make the functionality of the module more
easily accessible from the command line.
Please note that the patterns between the slash delimiters are not
Perl regular expressions but rather POSIX regular expressions, used to
query the PostgreSQL system tables directly.
=item sqlite_file
This should specify the full path to a SQLite file. While the
mirroring takes place, the incoming data is not written directly to
this file, but to a file with the same name except for a '.tmp'
extension. When the operation has finished, the previous file with the
name specified (if any) is renamed with a '.bak' extension, and the
.tmp file is renamed to the requested filename. Unless you use the
I<append> option, the information previously in the file will be
totally replaced.
=back
=head2 Other options
=over 4
=item schema
This signifies the schema from which the tables on the PostgreSQL side
are to be fetched. Default: 'public'. Only one schema can be specified
at a time.
=item where
A WHERE-condition appended to the SELECT-statement used to get data
from the PostgreSQL tables.
=item views
A list of views, specified in the same manner as the list of tables
for the I<tables> option. An attempt is made to define corresponding
views on the SQLite side (though this functionality is far from
reliable).
=item indexes
A boolean option indicating whether to create indexes for the same
columns in SQLite as in PostgreSQL. Default: false. (Normally only the
primary key is created).
=item functions
A boolean indicating whether to attempt to create functions on the
SQLite side corresponding to any SQL language (NOT PL/pgSQL or other
procedural language) functions in the PostgreSQL database. This is
for use with DBD::PgLite only, since these functions are put into the
pglite_functions table. Default: false.
=item page_limit
Normally the information from the PostgreSQL tables is read into
memory in one go and transferred directly to the SQLite file. This is,
however, obviously not desireable for very large tables. If the
PostgreSQL system tables report that the page count for the table is
above the limit specified by I<page_limit>, the table is instead
transferred row-by-row. Default value: 5000; since each page normally
is 8K, this represents about 40 MB on disk and perhaps 70-100 MB of
memory usage by the Perl process. For page_limit to work, the table
must have a primary key.
NB! Do not set this limit lower than necessary: it is orders of
magnitude slower than the default "slurp into memory" mode.
=item append
If this boolean option is true, then instead of creating a new SQLite
file, the current contents of the I<sqlite_file> are added to. If a
table which is being mirrored existed previously in the file, it is
dropped and recreated, but any tables not being copied from PostgreSQL
in the current run are left alone. (This is primarily useful for
mirroring some tables in toto, and others only in part, into the same
file). Default: false. Incompatible with the I<snapshot> option.
=item snapshot
If this is true, then the copying from PostgreSQL takes place in
serialized mode (transaction isolation level serializable), which
should ensure consistency of relations between tables linked by
foreign key constraints. Currently, foreign keys are not created on
the SQLite side, however. Default: false. Incompatible with the
I<append> option.
=item cachedir
The current method for getting information about table structure in
PostgreSQL is somewhat slow, especially for databases with very many
tables. To offset this, table definitions are cached in a temporary
directory so that subsequent mirrorings of the same table will go
faster. The downside is, of course, that if the table structure
changes, the cache needs to be cleared manually. The cache directory
can be specified using this option; the default is
/tmp/sqlite_mirror_cache (with separate subdirectories for each user).
=item verbose
If this is true, a few messages will be output to stderr during the
mirroring process.
=back
=head1 TODO
=over 4
=item *
Support for foreign keys is missing.
=item *
The method used to read tables bigger than I<page_limit> needs to be
improved.
=item *
It would be nice to have a quick way of telling whether the cached
table definition of a specific table is still valid.
=item *
Tests.
=back
=head1 AUTHOR
Baldur Kristinsson (bk@mbl.is), 2004-2006.
Copyright (c) 2006 Baldur Kristinsson. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
| 32.940631 | 173 | 0.668206 |
73e3025cda62b1213090b33d829de671178e58b7 | 10,072 | pm | Perl | lib/Shared/Examples/Net/Amazon/S3.pm | kdesjard/net-amazon-s3 | fff55f3a84cf3423ad7b5fa84813dcd30580897b | [
"Artistic-1.0"
]
| 13 | 2015-03-29T05:06:35.000Z | 2021-12-23T20:51:43.000Z | lib/Shared/Examples/Net/Amazon/S3.pm | kdesjard/net-amazon-s3 | fff55f3a84cf3423ad7b5fa84813dcd30580897b | [
"Artistic-1.0"
]
| 92 | 2015-05-18T15:20:03.000Z | 2022-01-14T14:08:05.000Z | lib/Shared/Examples/Net/Amazon/S3.pm | kdesjard/net-amazon-s3 | fff55f3a84cf3423ad7b5fa84813dcd30580897b | [
"Artistic-1.0"
]
| 39 | 2015-03-01T14:12:16.000Z | 2021-12-01T17:50:18.000Z | package Shared::Examples::Net::Amazon::S3;
# ABSTRACT: used for testing and as example
use strict;
use warnings;
use parent qw[ Exporter::Tiny ];
use Hash::Util;
use Ref::Util (
qw[ is_regexpref ],
);
use Test::Deep;
use Test::More;
use Test::LWP::UserAgent;
use Net::Amazon::S3;
use Shared::Examples::Net::Amazon::S3::API;
use Shared::Examples::Net::Amazon::S3::Client;
use Shared::Examples::Net::Amazon::S3::Request;
our @EXPORT_OK = (
qw[ s3_api_with_signature_4 ],
qw[ s3_api_with_signature_2 ],
qw[ expect_net_amazon_s3_feature ],
qw[ expect_net_amazon_s3_operation ],
qw[ expect_operation_list_all_my_buckets ],
qw[ expect_operation_bucket_create ],
qw[ expect_operation_bucket_delete ],
qw[ with_fixture ],
qw[ fixture ],
qw[ with_response_fixture ],
);
my %fixtures;
sub fixture {
my ($name) = @_;
$fixtures{$name} = eval "require Shared::Examples::Net::Amazon::S3::Fixture::$name"
unless defined $fixtures{$name};
die "Fixture $name not found: $@"
unless defined $fixtures{$name};
return +{ %{ $fixtures{$name} } };
}
sub with_fixture {
my ($name) = @_;
my $fixture = fixture ($name);
return wantarray
? %$fixture
: $fixture
;
}
sub with_response_fixture {
my ($name) = @_;
my $fixture = fixture ($name);
my $response_fixture = {};
for my $key (keys %$fixture) {
my $new_key;
$new_key ||= "with_response_data" if $key eq 'content';
$new_key ||= "with_$key" if $key =~ m/^response/;
$new_key ||= "with_response_header_$key";
$response_fixture->{$new_key} = $fixture->{$key};
}
return wantarray
? %$response_fixture
: $response_fixture
;
}
sub s3_api {
my $api = Net::Amazon::S3->new (@_);
$api->ua (Test::LWP::UserAgent->new (network_fallback => 0));
$api;
}
sub s3_api_mock_http_response {
my ($self, $api, %params) = @_;
$params{with_response_code} ||= HTTP::Status::HTTP_OK;
my %headers = (
content_type => 'application/xml',
(
map {
m/^with_response_header_(.*)/;
defined $1 && length $1
? ($1 => $params{$_})
: ()
} keys %params
),
%{ $params{with_response_headers} || {} },
);
$api->ua->map_response (
sub {
${ $params{into} } = $_[0];
1;
},
HTTP::Response->new (
$params{with_response_code},
HTTP::Status::status_message ($params{with_response_code}),
[ %headers ],
$params{with_response_data},
),
);
}
sub s3_api_with_signature_4 {
s3_api (
@_,
aws_access_key_id => 'AKIDEXAMPLE',
aws_secret_access_key => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
authorization_method => 'Net::Amazon::S3::Signature::V4',
secure => 1,
use_virtual_host => 1,
);
}
sub s3_api_with_signature_2 {
s3_api (
@_,
aws_access_key_id => 'AKIDEXAMPLE',
aws_secret_access_key => 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
authorization_method => 'Net::Amazon::S3::Signature::V2',
secure => 1,
use_virtual_host => 1,
);
}
sub expect_net_amazon_s3_feature {
my ($title, %params) = @_;
my $s3 = delete $params{with_s3};
my $feature = delete $params{feature};
my $expectation = "expect_$feature";
local $Test::Builder::Level = $Test::Builder::Level + 1;
subtest $title => sub {
plan tests => 2;
if (my $code = Shared::Examples::Net::Amazon::S3::API->can ($expectation)) {
$code->( "using S3 API" => (
with_s3 => $s3,
%params
));
} else {
fail "Net::Amazon::S3 feature expectation $expectation not found";
}
if (my $code = Shared::Examples::Net::Amazon::S3::Client->can ($expectation)) {
$code->( "using S3 Client" => (
with_client => Net::Amazon::S3::Client->new (s3 => $s3),
%params
));
} else {
fail "Net::Amazon::S3::Client feature expectation $expectation not found";
}
};
}
sub _operation_parameters {
my ($params, @names) = @_;
my $map = {};
$map = shift @names if Ref::Util::is_plain_hashref ($names[0]);
return
map +( ($map->{$_} || $_) => $params->{"with_$_"} ),
grep exists $params->{"with_$_"},
@names
;
}
sub _with_keys {
map "with_$_", @_;
}
sub _keys_operation () {
return (
qw[ -shared_examples ],
qw[ -method ],
qw[ with_s3 ],
qw[ with_client ],
qw[ shared_examples ],
qw[ with_response_code ],
qw[ with_response_data ],
qw[ with_response_headers ],
qw[ with_response_header_content_type ],
qw[ with_response_header_content_length ],
qw[ expect_s3_err ],
qw[ expect_s3_errstr ],
qw[ expect_data ],
qw[ expect_request ],
qw[ expect_request_content ],
qw[ expect_request_headers ],
qw[ throws ],
);
}
sub _expect_request {
my ($request, $expect, $title) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ($method, $uri) = %$expect;
cmp_deeply
$request,
all (
methods (method => $method),
methods (uri => methods (as_string => $uri)),
),
$title || 'expect request'
;
}
sub _expect_request_content {
my ($request, $expected, $title) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $got = Shared::Examples::Net::Amazon::S3::Request::_canonical_xml ($request->content);
$expected = Shared::Examples::Net::Amazon::S3::Request::_canonical_xml ($expected);
cmp_deeply $got, $expected, $title || "expect request content";
}
sub _expect_request_headers {
my ($request, $expected, $title) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my %got = map +($_ => scalar $request->header ($_)), keys %$expected;
cmp_deeply
\ %got,
$expected,
$title || "expect request headers"
;
}
sub _expect_s3_err {
my ($got, $expected, $title) = @_;
SKIP: {
skip "Net::Amazon::S3->err test irrelevant for Client", 1
if eq_deeply $got, obj_isa ('Net::Amazon::S3::Client');
cmp_deeply $got, methods (err => $expected), $title || 'expect S3->err';
}
}
sub _expect_s3_errstr {
my ($got, $expected, $title) = @_;
SKIP: {
skip "Net::Amazon::S3->errstr test irrelevant for Client", 1
if eq_deeply $got, obj_isa ('Net::Amazon::S3::Client');
cmp_deeply $got, methods (errstr => $expected), $title || 'expect S3->errstr';
}
}
sub _expect_operation {
my ($title, %params) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $class = delete $params{-shared_examples};
my $operation = delete $params{-operation};
my $api = $class->_default_with_api (\%params);
$class->_mock_http_response ($api, %params, into => \ (my $request));
if (my $code = $class->can ($operation)) {
subtest $title => sub {
plan tests => 1
+ int (!! exists $params{expect_request})
+ int (!! exists $params{expect_request_content})
+ int (!! exists $params{expect_request_headers})
+ int (!! exists $params{expect_s3_err})
+ int (!! exists $params{expect_s3_errstr})
;
my $got;
my $lives = eval { $got = $api->$code (%params); 1 };
my $error = $@;
if ($lives) {
exists $params{throws}
? fail "operation expected to throw but lives"
: cmp_deeply $got, $params{expect_data}, "expect operation return data"
;
}
else {
$params{throws} = re $params{throws}
if is_regexpref $params{throws};
$params{throws} = obj_isa $params{throws}
if defined $params{throws} && ! ref $params{throws};
defined $params{throws}
? cmp_deeply $error, $params{throws}, "it should throw"
: do { fail "operation expected to live but died" ; diag $error }
;
}
_expect_request $request, $params{expect_request}
if exists $params{expect_request};
_expect_request_content $request, $params{expect_request_content}
if exists $params{expect_request_content};
_expect_request_headers ($request, $params{expect_request_headers})
if exists $params{expect_request_headers};
_expect_s3_err $api, $params{expect_s3_err}
if exists $params{expect_s3_err};
_expect_s3_errstr $api, $params{expect_s3_errstr}
if exists $params{expect_s3_errstr};
};
} else {
fail $title or diag "Operation ${class}::$operation not found";
}
}
sub _generate_operation_expectation {
my ($name, @parameters) = @_;
my @on = (
('bucket') x!! ($name =~ m/^ ( bucket | object )/x),
('key') x!! ($name =~ m/^ ( object )/x),
);
my $on = "qw[ ${ \ join ' ', @on } ]";
eval <<"OPERATION_DECLARATION";
sub parameters_$name {
qw[ ${ \ join ' ', @parameters } ]
}
sub expect_operation_$name {
my (\$title, \%params) = \@_;
local \$Test::Builder::Level = \$Test::Builder::Level + 1;
Hash::Util::lock_keys \%params, _with_keys ($on, parameters_$name), _keys_operation;
_expect_operation \$title, \%params, -operation => 'operation_$name';
}
OPERATION_DECLARATION
}
_generate_operation_expectation list_all_my_buckets =>
;
_generate_operation_expectation bucket_acl_get =>
;
_generate_operation_expectation bucket_acl_set =>
qw[ acl ],
qw[ acl_xml ],
qw[ acl_short ],
;
_generate_operation_expectation bucket_create =>
qw[ acl ],
qw[ acl_short ],
qw[ region ],
;
_generate_operation_expectation bucket_delete =>
;
_generate_operation_expectation bucket_objects_list =>
qw[ delimiter ],
qw[ max_keys ],
qw[ marker ],
qw[ prefix ],
;
_generate_operation_expectation bucket_objects_delete =>
qw[ keys ],
;
_generate_operation_expectation object_acl_get =>
;
_generate_operation_expectation object_acl_set =>
qw[ acl ],
qw[ acl_xml ],
qw[ acl_short ],
;
_generate_operation_expectation object_create =>
qw[ headers ],
qw[ value ],
qw[ cache_control ],
qw[ content_disposition ],
qw[ content_encoding ],
qw[ content_type ],
qw[ encryption ],
qw[ expires ],
qw[ storage_class ],
qw[ user_metadata ],
qw[ acl ],
qw[ acl_short ],
;
_generate_operation_expectation object_delete =>
;
_generate_operation_expectation object_fetch =>
qw[ range ],
;
_generate_operation_expectation object_head =>
;
_generate_operation_expectation bucket_tags_add =>
qw[ tags ],
;
_generate_operation_expectation object_tags_add =>
qw[ tags ],
qw[ version_id ],
;
_generate_operation_expectation bucket_tags_delete =>
;
_generate_operation_expectation object_tags_delete =>
qw[ version_id ],
;
1;
| 22.633708 | 90 | 0.653594 |
ed0eff6e32218c5eec3bfdd264a9bce59c6c4804 | 600 | pl | Perl | bacula-backup/backup_config.pl | vsilvar/webmin | 9c736481d7d07eb4c8dcdb2cacff2365b74efbe0 | [
"BSD-3-Clause"
]
| 1,863 | 2015-01-04T21:45:45.000Z | 2022-03-30T09:10:50.000Z | bacula-backup/backup_config.pl | vsilvar/webmin | 9c736481d7d07eb4c8dcdb2cacff2365b74efbe0 | [
"BSD-3-Clause"
]
| 1,233 | 2015-01-03T12:45:51.000Z | 2022-03-31T02:39:58.000Z | bacula-backup/backup_config.pl | vsilvar/webmin | 9c736481d7d07eb4c8dcdb2cacff2365b74efbe0 | [
"BSD-3-Clause"
]
| 546 | 2015-01-05T13:07:28.000Z | 2022-03-25T21:47:51.000Z | do 'bacula-backup-lib.pl';
# backup_config_files()
# Returns files and directories that can be backed up
sub backup_config_files
{
return ( $config{'bacula_dir'} );
}
# pre_backup(&files)
# Called before the files are actually read
sub pre_backup
{
return undef;
}
# post_backup(&files)
# Called after the files are actually read
sub post_backup
{
return undef;
}
# pre_restore(&files)
# Called before the files are restored from a backup
sub pre_restore
{
return undef;
}
# post_restore(&files)
# Called after the files are restored from a backup
sub post_restore
{
return undef;
}
1;
| 15.384615 | 53 | 0.736667 |
ed158c34fa9eddabeff159d5e6e9ca659981662a | 2,099 | pm | Perl | auto-lib/Paws/OpsWorks/BlockDeviceMapping.pm | agimenez/aws-sdk-perl | 9c4dff7d1af2ff0210c28ca44fb9e92bc625712b | [
"Apache-2.0"
]
| 2 | 2016-09-22T09:18:33.000Z | 2017-06-20T01:36:58.000Z | auto-lib/Paws/OpsWorks/BlockDeviceMapping.pm | cah-rfelsburg/paws | de9ffb8d49627635a2da588066df26f852af37e4 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Paws/OpsWorks/BlockDeviceMapping.pm | cah-rfelsburg/paws | de9ffb8d49627635a2da588066df26f852af37e4 | [
"Apache-2.0"
]
| null | null | null | package Paws::OpsWorks::BlockDeviceMapping;
use Moose;
has DeviceName => (is => 'ro', isa => 'Str');
has Ebs => (is => 'ro', isa => 'Paws::OpsWorks::EbsBlockDevice');
has NoDevice => (is => 'ro', isa => 'Str');
has VirtualName => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::OpsWorks::BlockDeviceMapping
=head1 USAGE
This class represents one of two things:
=head3 Arguments in a call to a service
Use the attributes of this class as arguments to methods. You shouldn't make instances of this class.
Each attribute should be used as a named argument in the calls that expect this type of object.
As an example, if Att1 is expected to be a Paws::OpsWorks::BlockDeviceMapping object:
$service_obj->Method(Att1 => { DeviceName => $value, ..., VirtualName => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::OpsWorks::BlockDeviceMapping object:
$result = $service_obj->Method(...);
$result->Att1->DeviceName
=head1 DESCRIPTION
Describes a block device mapping. This data type maps directly to the
Amazon EC2 BlockDeviceMapping data type.
=head1 ATTRIBUTES
=head2 DeviceName => Str
The device name that is exposed to the instance, such as C</dev/sdh>.
For the root device, you can use the explicit device name or you can
set this parameter to C<ROOT_DEVICE> and AWS OpsWorks will provide the
correct device name.
=head2 Ebs => L<Paws::OpsWorks::EbsBlockDevice>
An C<EBSBlockDevice> that defines how to configure an Amazon EBS volume
when the instance is launched.
=head2 NoDevice => Str
Suppresses the specified device included in the AMI's block device
mapping.
=head2 VirtualName => Str
The virtual device name. For more information, see BlockDeviceMapping.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::OpsWorks>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: https://github.com/pplu/aws-sdk-perl
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues
=cut
| 25.91358 | 105 | 0.73273 |
73d59594d5ba9ef014a3ea67167def90c1156e68 | 6,002 | pl | Perl | lib/unicore/lib/In/5_2.pl | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 15 | 2019-07-10T16:50:17.000Z | 2022-01-23T14:28:17.000Z | lib/unicore/lib/In/5_2.pl | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 98 | 2017-11-02T19:00:44.000Z | 2022-03-22T16:15:39.000Z | lib/unicore/lib/In/5_2.pl | Helmholtz-HIPS/prosnap | 5286cda39276d5eda85d2ddb23b8ab83c5d4960c | [
"MIT"
]
| 9 | 2017-10-24T21:53:36.000Z | 2021-11-23T07:36:59.000Z | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 8.0.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
return <<'END';
V990
0
888
890
895
900
907
908
909
910
930
931
1318
1329
1367
1369
1376
1377
1416
1417
1419
1425
1480
1488
1515
1520
1525
1536
1540
1542
1564
1566
1568
1569
1631
1632
1806
1807
1867
1869
1970
1984
2043
2048
2094
2096
2111
2304
2362
2364
2383
2384
2390
2392
2419
2425
2432
2433
2436
2437
2445
2447
2449
2451
2473
2474
2481
2482
2483
2486
2490
2492
2501
2503
2505
2507
2511
2519
2520
2524
2526
2527
2532
2534
2556
2561
2564
2565
2571
2575
2577
2579
2601
2602
2609
2610
2612
2613
2615
2616
2618
2620
2621
2622
2627
2631
2633
2635
2638
2641
2642
2649
2653
2654
2655
2662
2678
2689
2692
2693
2702
2703
2706
2707
2729
2730
2737
2738
2740
2741
2746
2748
2758
2759
2762
2763
2766
2768
2769
2784
2788
2790
2800
2801
2802
2817
2820
2821
2829
2831
2833
2835
2857
2858
2865
2866
2868
2869
2874
2876
2885
2887
2889
2891
2894
2902
2904
2908
2910
2911
2916
2918
2930
2946
2948
2949
2955
2958
2961
2962
2966
2969
2971
2972
2973
2974
2976
2979
2981
2984
2987
2990
3002
3006
3011
3014
3017
3018
3022
3024
3025
3031
3032
3046
3067
3073
3076
3077
3085
3086
3089
3090
3113
3114
3124
3125
3130
3133
3141
3142
3145
3146
3150
3157
3159
3160
3162
3168
3172
3174
3184
3192
3200
3202
3204
3205
3213
3214
3217
3218
3241
3242
3252
3253
3258
3260
3269
3270
3273
3274
3278
3285
3287
3294
3295
3296
3300
3302
3312
3313
3315
3330
3332
3333
3341
3342
3345
3346
3369
3370
3386
3389
3397
3398
3401
3402
3406
3415
3416
3424
3428
3430
3446
3449
3456
3458
3460
3461
3479
3482
3506
3507
3516
3517
3518
3520
3527
3530
3531
3535
3541
3542
3543
3544
3552
3570
3573
3585
3643
3647
3676
3713
3715
3716
3717
3719
3721
3722
3723
3725
3726
3732
3736
3737
3744
3745
3748
3749
3750
3751
3752
3754
3756
3757
3770
3771
3774
3776
3781
3782
3783
3784
3790
3792
3802
3804
3806
3840
3912
3913
3949
3953
3980
3984
3992
3993
4029
4030
4045
4046
4057
4096
4294
4304
4349
4352
4681
4682
4686
4688
4695
4696
4697
4698
4702
4704
4745
4746
4750
4752
4785
4786
4790
4792
4799
4800
4801
4802
4806
4808
4823
4824
4881
4882
4886
4888
4955
4959
4989
4992
5018
5024
5109
5120
5789
5792
5873
5888
5901
5902
5909
5920
5943
5952
5972
5984
5997
5998
6001
6002
6004
6016
6110
6112
6122
6128
6138
6144
6159
6160
6170
6176
6264
6272
6315
6320
6390
6400
6429
6432
6444
6448
6460
6464
6465
6468
6510
6512
6517
6528
6572
6576
6602
6608
6619
6622
6684
6686
6751
6752
6781
6783
6794
6800
6810
6816
6830
6912
6988
6992
7037
7040
7083
7086
7098
7168
7224
7227
7242
7245
7296
7376
7411
7424
7655
7677
7958
7960
7966
7968
8006
8008
8014
8016
8024
8025
8026
8027
8028
8029
8030
8031
8062
8064
8117
8118
8133
8134
8148
8150
8156
8157
8176
8178
8181
8182
8191
8192
8293
8298
8306
8308
8335
8336
8341
8352
8377
8400
8433
8448
8586
8592
9193
9216
9255
9280
9291
9312
9934
9935
9954
9955
9956
9960
9984
9985
9989
9990
9994
9996
10024
10025
10060
10061
10062
10063
10067
10070
10079
10081
10133
10136
10160
10161
10175
10176
10187
10188
10189
10192
11085
11088
11098
11264
11311
11312
11359
11360
11506
11513
11558
11568
11622
11631
11632
11648
11671
11680
11687
11688
11695
11696
11703
11704
11711
11712
11719
11720
11727
11728
11735
11736
11743
11744
11826
11904
11930
11931
12020
12032
12246
12272
12284
12288
12352
12353
12439
12441
12544
12549
12590
12593
12687
12688
12728
12736
12772
12784
12831
12832
13055
13056
19894
19904
40908
40960
42125
42128
42183
42192
42540
42560
42592
42594
42612
42620
42648
42656
42744
42752
42893
43003
43052
43056
43066
43072
43128
43136
43205
43214
43226
43232
43260
43264
43348
43359
43389
43392
43470
43471
43482
43486
43488
43520
43575
43584
43598
43600
43610
43612
43644
43648
43715
43739
43744
43968
44014
44016
44026
44032
55204
55216
55239
55243
55292
55296
64046
64048
64110
64112
64218
64256
64263
64275
64280
64285
64311
64312
64317
64318
64319
64320
64322
64323
64325
64326
64434
64467
64832
64848
64912
64914
64968
64976
65022
65024
65050
65056
65063
65072
65107
65108
65127
65128
65132
65136
65141
65142
65277
65279
65280
65281
65471
65474
65480
65482
65488
65490
65496
65498
65501
65504
65511
65512
65519
65529
65548
65549
65575
65576
65595
65596
65598
65599
65614
65616
65630
65664
65787
65792
65795
65799
65844
65847
65931
65936
65948
66000
66046
66176
66205
66208
66257
66304
66335
66336
66340
66352
66379
66432
66462
66463
66500
66504
66518
66560
66718
66720
66730
67584
67590
67592
67593
67594
67638
67639
67641
67644
67645
67647
67670
67671
67680
67840
67868
67871
67898
67903
67904
68096
68100
68101
68103
68108
68116
68117
68120
68121
68148
68152
68155
68159
68168
68176
68185
68192
68224
68352
68406
68409
68438
68440
68467
68472
68480
68608
68681
69216
69247
69760
69826
73728
74607
74752
74851
74864
74868
77824
78895
118784
119030
119040
119079
119081
119262
119296
119366
119552
119639
119648
119666
119808
119893
119894
119965
119966
119968
119970
119971
119973
119975
119977
119981
119982
119994
119995
119996
119997
120004
120005
120070
120071
120075
120077
120085
120086
120093
120094
120122
120123
120127
120128
120133
120134
120135
120138
120145
120146
120486
120488
120780
120782
120832
126976
127020
127024
127124
127232
127243
127248
127279
127281
127282
127293
127294
127295
127296
127298
127299
127302
127303
127306
127311
127319
127320
127327
127328
127353
127354
127355
127357
127359
127360
127370
127374
127376
127377
127488
127489
127504
127538
127552
127561
131070
173783
173824
177973
194560
195102
196606
196608
262142
262144
327678
327680
393214
393216
458750
458752
524286
524288
589822
589824
655358
655360
720894
720896
786430
786432
851966
851968
917502
917504
917505
917506
917536
917632
917760
918000
983038
1114112
END
| 5.972139 | 77 | 0.80923 |
73d4740b08ab6da8f87a4975e8f8b7be8d75b531 | 331 | pl | Perl | global/spells/2739.pl | GiverofMemory/FVProject-Quests | 8754c17305f1b9f56fff5e2952127f628be10646 | [
"MIT"
]
| 1 | 2021-11-25T23:33:55.000Z | 2021-11-25T23:33:55.000Z | global/spells/2739.pl | GiverofMemory/FVProject-Quests | 8754c17305f1b9f56fff5e2952127f628be10646 | [
"MIT"
]
| 6 | 2020-02-12T16:39:52.000Z | 2021-08-16T22:12:59.000Z | global/spells/2739.pl | GiverofMemory/FVProject-Quests | 8754c17305f1b9f56fff5e2952127f628be10646 | [
"MIT"
]
| 7 | 2019-12-28T20:06:14.000Z | 2021-11-23T17:21:38.000Z | #:: 2739 - Invisibility versus Undead
sub EVENT_SPELL_EFFECT_CLIENT {
if ($client->GetPetID()) {
$PetID = $entity_list->GetMobByID($client->GetPetID());
if ($PetID->Charmed()) {
$PetID->WipeHateList();
$PetID->SetSpecialAbility(28, 1);
$PetID->AddToHateList($client, 10000);
}
else {
$PetID->Kill();
}
}
}
| 20.6875 | 57 | 0.634441 |
ed05462e21d5a75e62547e770a70985c2401641c | 9,558 | pm | Perl | lib/Faker/Plugin/Company.pm | alnewkirk/Faker | ea2ff475aaf7fc81c782b014f836a77aaee77d45 | [
"Apache-2.0"
]
| 4 | 2021-02-08T09:41:51.000Z | 2022-01-21T20:00:42.000Z | lib/Faker/Plugin/Company.pm | iamalnewkirk/faker | ea2ff475aaf7fc81c782b014f836a77aaee77d45 | [
"Apache-2.0"
]
| 12 | 2020-03-14T02:11:30.000Z | 2020-05-12T00:40:29.000Z | lib/Faker/Plugin/Company.pm | alnewkirk/Faker | ea2ff475aaf7fc81c782b014f836a77aaee77d45 | [
"Apache-2.0"
]
| null | null | null | package Faker::Plugin::Company;
use 5.014;
use strict;
use warnings;
use registry;
use routines;
use Data::Object::Class;
use Data::Object::ClassHas;
extends 'Data::Object::Plugin';
# VERSION
# ATTRIBUTES
has 'faker' => (
is => 'ro',
isa => 'ConsumerOf["Faker::Maker"]',
req => 1,
);
# METHODS
method data_for_buzzword_type1() {
[
'implement',
'utilize',
'integrate',
'streamline',
'optimize',
'evolve',
'transform',
'embrace',
'enable',
'orchestrate',
'leverage',
'reinvent',
'aggregate',
'architect',
'enhance',
'incentivize',
'morph',
'empower',
'envisioneer',
'monetize',
'harness',
'facilitate',
'seize',
'disintermediate',
'synergize',
'strategize',
'deploy',
'brand',
'grow',
'target',
'syndicate',
'synthesize',
'deliver',
'mesh',
'incubate',
'engage',
'maximize',
'benchmark',
'expedite',
'reintermediate',
'whiteboard',
'visualize',
'repurpose',
'innovate',
'scale',
'unleash',
'drive',
'extend',
'engineer',
'revolutionize',
'generate',
'exploit',
'transition',
'e-enable',
'iterate',
'cultivate',
'matrix',
'productize',
'redefine',
'recontextualize',
]
}
method data_for_buzzword_type2() {
[
'clicks-and-mortar',
'value-added',
'vertical',
'proactive',
'robust',
'revolutionary',
'scalable',
'leading-edge',
'innovative',
'intuitive',
'strategic',
'e-business',
'mission-critical',
'sticky',
'one-to-one',
'24/7',
'end-to-end',
'global',
'B2B',
'B2C',
'granular',
'frictionless',
'virtual',
'viral',
'dynamic',
'24/365',
'best-of-breed',
'killer',
'magnetic',
'bleeding-edge',
'web-enabled',
'interactive',
'dot-com',
'sexy',
'back-end',
'real-time',
'efficient',
'front-end',
'distributed',
'seamless',
'extensible',
'turn-key',
'world-class',
'open-source',
'cross-platform',
'cross-media',
'synergistic',
'bricks-and-clicks',
'out-of-the-box',
'enterprise',
'integrated',
'impactful',
'wireless',
'transparent',
'next-generation',
'cutting-edge',
'user-centric',
'visionary',
'customized',
'ubiquitous',
'plug-and-play',
'collaborative',
'compelling',
'holistic',
'rich',
]
}
method data_for_buzzword_type3() {
[
'synergies',
'web-readiness',
'paradigms',
'markets',
'partnerships',
'infrastructures',
'platforms',
'initiatives',
'channels',
'eyeballs',
'communities',
'ROI',
'solutions',
'e-tailers',
'e-services',
'action-items',
'portals',
'niches',
'technologies',
'content',
'vortals',
'supply-chains',
'convergence',
'relationships',
'architectures',
'interfaces',
'e-markets',
'e-commerce',
'systems',
'bandwidth',
'infomediaries',
'models',
'mindshare',
'deliverables',
'users',
'schemas',
'networks',
'applications',
'metrics',
'e-business',
'functionalities',
'experiences',
'webservices',
'methodologies',
]
}
method data_for_name_suffix() {
[
'Co.',
'Consulting',
'Electronics',
'Entertainment',
'Inc.',
'Incorporated',
'and Sons',
'LLC',
'Group',
'PLC',
'Ltd.',
'Ventures',
'Worldwide',
'Pty.',
]
}
method data_for_jargon_buzz() {
[
'ability',
'access',
'adapter',
'algorithm',
'alliance',
'analyzer',
'application',
'approach',
'architecture',
'archive',
'artificialintelligence',
'array',
'attitude',
'benchmark',
'budgetarymanagement',
'capability',
'capacity',
'challenge',
'circuit',
'collaboration',
'complexity',
'concept',
'conglomeration',
'contingency',
'core',
'customerloyalty',
'database',
'data-warehouse',
'definition',
'emulation',
'encoding',
'encryption',
'extranet',
'firmware',
'flexibility',
'focusgroup',
'forecast',
'frame',
'framework',
'function',
'functionalities',
'GraphicInterface',
'groupware',
'GraphicalUserInterface',
'hardware',
'help-desk',
'hierarchy',
'hub',
'implementation',
'info-mediaries',
'infrastructure',
'initiative',
'installation',
'instructionset',
'interface',
'internetsolution',
'intranet',
'knowledgeuser',
'knowledgebase',
'localareanetwork',
'leverage',
'matrices',
'matrix',
'methodology',
'middleware',
'migration',
'model',
'moderator',
'monitoring',
'moratorium',
'neural-net',
'openarchitecture',
'opensystem',
'orchestration',
'paradigm',
'parallelism',
'policy',
'portal',
'pricingstructure',
'processimprovement',
'product',
'productivity',
'project',
'projection',
'protocol',
'securedline',
'service-desk',
'software',
'solution',
'standardization',
'strategy',
'structure',
'success',
'superstructure',
'support',
'synergy',
'systemengine',
'task-force',
'throughput',
'time-frame',
'toolset',
'utilisation',
'website',
'workforce',
]
}
method data_for_jargon_edge() {
[
'Adaptive',
'Advanced',
'Ameliorated',
'Assimilated',
'Automated',
'Balanced',
'Business-focused',
'Centralized',
'Cloned',
'Compatible',
'Configurable',
'Cross-group',
'Cross-platform',
'Customer-focused',
'Customizable',
'Decentralized',
'De-engineered',
'Devolved',
'Digitized',
'Distributed',
'Diverse',
'Down-sized',
'Enhanced',
'Enterprise-wide',
'Ergonomic',
'Exclusive',
'Expanded',
'Extended',
'Facetoface',
'Focused',
'Front-line',
'Fully-configurable',
'Function-based',
'Fundamental',
'Future-proofed',
'Grass-roots',
'Horizontal',
'Implemented',
'Innovative',
'Integrated',
'Intuitive',
'Inverse',
'Managed',
'Mandatory',
'Monitored',
'Multi-channelled',
'Multi-lateral',
'Multi-layered',
'Multi-tiered',
'Networked',
'Object-based',
'Open-architected',
'Open-source',
'Operative',
'Optimized',
'Optional',
'Organic',
'Organized',
'Persevering',
'Persistent',
'Phased',
'Polarised',
'Pre-emptive',
'Proactive',
'Profit-focused',
'Profound',
'Programmable',
'Progressive',
'Public-key',
'Quality-focused',
'Reactive',
'Realigned',
'Re-contextualized',
'Re-engineered',
'Reduced',
'Reverse-engineered',
'Right-sized',
'Robust',
'Seamless',
'Secured',
'Self-enabling',
'Sharable',
'Stand-alone',
'Streamlined',
'Switchable',
'Synchronised',
'Synergistic',
'Synergized',
'Team-oriented',
'Total',
'Triple-buffered',
'Universal',
'Up-sized',
'Upgradable',
'User-centric',
'User-friendly',
'Versatile',
'Virtual',
'Visionary',
'Vision-oriented',
]
}
method data_for_jargon_prop() {
[
'24hour',
'24/7',
'3rdgeneration',
'4thgeneration',
'5thgeneration',
'6thgeneration',
'actuating',
'analyzing',
'assymetric',
'asynchronous',
'attitude-oriented',
'background',
'bandwidth-monitored',
'bi-directional',
'bifurcated',
'bottom-line',
'clear-thinking',
'client-driven',
'client-server',
'coherent',
'cohesive',
'composite',
'context-sensitive',
'contextually-based',
'content-based',
'dedicated',
'demand-driven',
'didactic',
'directional',
'discrete',
'disintermediate',
'dynamic',
'eco-centric',
'empowering',
'encompassing',
'even-keeled',
'executive',
'explicit',
'exuding',
'fault-tolerant',
'foreground',
'fresh-thinking',
'full-range',
'global',
'grid-enabled',
'heuristic',
'high-level',
'holistic',
'homogeneous',
'human-resource',
'hybrid',
'impactful',
'incremental',
'intangible',
'interactive',
'intermediate',
'leadingedge',
'local',
'logistical',
'maximized',
'methodical',
'mission-critical',
'mobile',
'modular',
'motivating',
'multimedia',
'multi-state',
'multi-tasking',
'national',
'needs-based',
'neutral',
'nextgeneration',
'non-volatile',
'object-oriented',
'optimal',
'optimizing',
'radical',
'real-time',
'reciprocal',
'regional',
'responsive',
'scalable',
'secondary',
'solution-oriented',
'stable',
'static',
'systematic',
'systemic',
'system-worthy',
'tangible',
'tertiary',
'transitional',
'uniform',
'upward-trending',
'user-facing',
'value-added',
'web-enabled',
'well-modulated',
'zeroadministration',
'zerodefect',
'zerotolerance',
]
}
method format_for_name() {
[
'{{person.last_name}} {{company.name_suffix}}',
'{{person.last_name}}-{{person.last_name}}',
'{{person.last_name}}, {{person.last_name}} and {{person.last_name}}',
]
}
1;
| 17.067857 | 74 | 0.545616 |
73e96386fb8dc83c7bdd518b5b53d5069704e4dd | 2,023 | t | Perl | t/00-compile.t | gitpan/App-PlUtils | 4ab3f820196be452c6e725a1c228980044e96156 | [
"Artistic-1.0"
]
| null | null | null | t/00-compile.t | gitpan/App-PlUtils | 4ab3f820196be452c6e725a1c228980044e96156 | [
"Artistic-1.0"
]
| null | null | null | t/00-compile.t | gitpan/App-PlUtils | 4ab3f820196be452c6e725a1c228980044e96156 | [
"Artistic-1.0"
]
| null | null | null | use 5.006;
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
use Test::More;
plan tests => 5 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'App/PlUtils.pm'
);
my @scripts = (
'bin/plcost',
'bin/pllex',
'bin/plsub',
'bin/pluse'
);
# no fake home requested
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
use File::Spec;
use IPC::Open3;
use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
}
foreach my $file (@scripts)
{ SKIP: {
open my $fh, '<', $file or warn("Unable to open $file: $!"), next;
my $line = <$fh>;
close $fh and skip("$file isn't perl", 1) unless $line =~ /^#!\s*(?:\S*perl\S*)((?:\s+-\w*)*)(?:\s*#.*)?$/;
my @flags = $1 ? split(' ', $1) : ();
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, @flags, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
# in older perls, -c output is simply the file portion of the path being tested
if (@_warnings = grep { !/\bsyntax OK$/ }
grep { chomp; $_ ne (File::Spec->splitpath($file))[2] } @_warnings)
{
warn @_warnings;
push @warnings, @_warnings;
}
} }
is(scalar(@warnings), 0, 'no warnings found')
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
| 24.670732 | 147 | 0.562037 |
73fd27b7e23a2ea2cc658e2a36b53ccb4bde1232 | 22 | t | Perl | head/bin/ed/test/nl2.t | dplbsd/zcaplib | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
]
| 700 | 2017-12-07T02:08:09.000Z | 2022-03-31T06:42:56.000Z | head/bin/ed/test/nl2.t | dplbsd/zcaplib | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
]
| 114 | 2018-01-10T20:12:21.000Z | 2022-03-25T06:55:35.000Z | FreeBSD/bin/ed/test/nl2.t | TigerBSD/TigerBSD | 3d092f261b362f73170871403397fc5d6b89d1dc | [
"0BSD"
]
| 134 | 2018-01-08T08:33:08.000Z | 2022-03-24T11:51:27.000Z | a
hello world
.
0;/./
| 4.4 | 11 | 0.545455 |
73da9ef37cbaaa363569b7b75084c660e6b5661a | 117,049 | pl | Perl | vpx_dsp/vpx_dsp_rtcd_defs.pl | Italtel-Unimi/libvpx | ab4010e0ac7aefd4b422f5cf8bfca5652159a6a1 | [
"BSD-3-Clause"
]
| 14 | 2016-06-29T17:35:02.000Z | 2021-05-18T06:54:04.000Z | vpx_dsp/vpx_dsp_rtcd_defs.pl | Italtel-Unimi/libvpx | ab4010e0ac7aefd4b422f5cf8bfca5652159a6a1 | [
"BSD-3-Clause"
]
| null | null | null | vpx_dsp/vpx_dsp_rtcd_defs.pl | Italtel-Unimi/libvpx | ab4010e0ac7aefd4b422f5cf8bfca5652159a6a1 | [
"BSD-3-Clause"
]
| null | null | null | sub vpx_dsp_forward_decls() {
print <<EOF
/*
* DSP
*/
#include "vpx/vpx_integer.h"
#include "vpx_dsp/vpx_dsp_common.h"
EOF
}
forward_decls qw/vpx_dsp_forward_decls/;
# functions that are 64 bit only.
$mmx_x86_64 = $sse2_x86_64 = $ssse3_x86_64 = $avx_x86_64 = $avx2_x86_64 = '';
if ($opts{arch} eq "x86_64") {
$mmx_x86_64 = 'mmx';
$sse2_x86_64 = 'sse2';
$ssse3_x86_64 = 'ssse3';
$avx_x86_64 = 'avx';
$avx2_x86_64 = 'avx2';
}
#
# Intra prediction
#
add_proto qw/void vpx_d207_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d207_predictor_4x4 sse2/;
add_proto qw/void vpx_d207e_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d45_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45_predictor_4x4 neon sse2/;
add_proto qw/void vpx_d45e_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d63_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63_predictor_4x4 ssse3/;
add_proto qw/void vpx_d63e_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d63f_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_h_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_h_predictor_4x4 neon dspr2 msa sse2/;
add_proto qw/void vpx_he_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d117_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d135_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d135_predictor_4x4 neon/;
add_proto qw/void vpx_d153_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d153_predictor_4x4 ssse3/;
add_proto qw/void vpx_v_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_v_predictor_4x4 neon msa sse2/;
add_proto qw/void vpx_ve_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_tm_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_tm_predictor_4x4 neon dspr2 msa sse2/;
add_proto qw/void vpx_dc_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_predictor_4x4 dspr2 msa neon sse2/;
add_proto qw/void vpx_dc_top_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_top_predictor_4x4 msa neon sse2/;
add_proto qw/void vpx_dc_left_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_left_predictor_4x4 msa neon sse2/;
add_proto qw/void vpx_dc_128_predictor_4x4/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_128_predictor_4x4 msa neon sse2/;
add_proto qw/void vpx_d207_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d207_predictor_8x8 ssse3/;
add_proto qw/void vpx_d207e_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d45_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45_predictor_8x8 neon sse2/;
add_proto qw/void vpx_d45e_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d63_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63_predictor_8x8 ssse3/;
add_proto qw/void vpx_d63e_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_h_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_h_predictor_8x8 neon dspr2 msa sse2/;
add_proto qw/void vpx_d117_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d135_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d153_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d153_predictor_8x8 ssse3/;
add_proto qw/void vpx_v_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_v_predictor_8x8 neon msa sse2/;
add_proto qw/void vpx_tm_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_tm_predictor_8x8 neon dspr2 msa sse2/;
add_proto qw/void vpx_dc_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_predictor_8x8 dspr2 neon msa sse2/;
add_proto qw/void vpx_dc_top_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_top_predictor_8x8 neon msa sse2/;
add_proto qw/void vpx_dc_left_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_left_predictor_8x8 neon msa sse2/;
add_proto qw/void vpx_dc_128_predictor_8x8/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_128_predictor_8x8 neon msa sse2/;
add_proto qw/void vpx_d207_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d207_predictor_16x16 ssse3/;
add_proto qw/void vpx_d207e_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d45_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45_predictor_16x16 neon ssse3/;
add_proto qw/void vpx_d45e_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d63_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63_predictor_16x16 ssse3/;
add_proto qw/void vpx_d63e_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_h_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_h_predictor_16x16 neon dspr2 msa sse2/;
add_proto qw/void vpx_d117_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d135_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d153_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d153_predictor_16x16 ssse3/;
add_proto qw/void vpx_v_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_v_predictor_16x16 neon msa sse2/;
add_proto qw/void vpx_tm_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_tm_predictor_16x16 neon msa sse2/;
add_proto qw/void vpx_dc_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_predictor_16x16 dspr2 neon msa sse2/;
add_proto qw/void vpx_dc_top_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_top_predictor_16x16 neon msa sse2/;
add_proto qw/void vpx_dc_left_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_left_predictor_16x16 neon msa sse2/;
add_proto qw/void vpx_dc_128_predictor_16x16/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_128_predictor_16x16 neon msa sse2/;
add_proto qw/void vpx_d207_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d207_predictor_32x32 ssse3/;
add_proto qw/void vpx_d207e_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d45_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d45_predictor_32x32 ssse3/;
add_proto qw/void vpx_d45e_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d63_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d63_predictor_32x32 ssse3/;
add_proto qw/void vpx_d63e_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_h_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_h_predictor_32x32 neon msa sse2/;
add_proto qw/void vpx_d117_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d135_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
add_proto qw/void vpx_d153_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_d153_predictor_32x32 ssse3/;
add_proto qw/void vpx_v_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_v_predictor_32x32 neon msa sse2/;
add_proto qw/void vpx_tm_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_tm_predictor_32x32 neon msa sse2/;
add_proto qw/void vpx_dc_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_predictor_32x32 msa neon sse2/;
add_proto qw/void vpx_dc_top_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_top_predictor_32x32 msa neon sse2/;
add_proto qw/void vpx_dc_left_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_left_predictor_32x32 msa neon sse2/;
add_proto qw/void vpx_dc_128_predictor_32x32/, "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left";
specialize qw/vpx_dc_128_predictor_32x32 msa neon sse2/;
# High bitdepth functions
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vpx_highbd_d207_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d207e_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d45_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d45_predictor_4x4 neon/;
add_proto qw/void vpx_highbd_d45e_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63e_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_h_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d117_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d135_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_4x4 neon/;
add_proto qw/void vpx_highbd_d153_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_v_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_v_predictor_4x4 sse2/;
add_proto qw/void vpx_highbd_tm_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_tm_predictor_4x4 sse2/;
add_proto qw/void vpx_highbd_dc_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_predictor_4x4 neon sse2/;
add_proto qw/void vpx_highbd_dc_top_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_top_predictor_4x4 neon/;
add_proto qw/void vpx_highbd_dc_left_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_left_predictor_4x4 neon/;
add_proto qw/void vpx_highbd_dc_128_predictor_4x4/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_128_predictor_4x4 neon/;
add_proto qw/void vpx_highbd_d207_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d207e_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d45_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d45_predictor_8x8 neon/;
add_proto qw/void vpx_highbd_d45e_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63e_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_h_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d117_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d135_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_8x8 neon/;
add_proto qw/void vpx_highbd_d153_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_v_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_v_predictor_8x8 sse2/;
add_proto qw/void vpx_highbd_tm_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_tm_predictor_8x8 sse2/;
add_proto qw/void vpx_highbd_dc_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_predictor_8x8 neon sse2/;
add_proto qw/void vpx_highbd_dc_top_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_top_predictor_8x8 neon/;
add_proto qw/void vpx_highbd_dc_left_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_left_predictor_8x8 neon/;
add_proto qw/void vpx_highbd_dc_128_predictor_8x8/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_128_predictor_8x8 neon/;
add_proto qw/void vpx_highbd_d207_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d207e_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d45_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d45_predictor_16x16 neon/;
add_proto qw/void vpx_highbd_d45e_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63e_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_h_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d117_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d135_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_16x16 neon/;
add_proto qw/void vpx_highbd_d153_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_v_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_v_predictor_16x16 sse2/;
add_proto qw/void vpx_highbd_tm_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_tm_predictor_16x16 sse2/;
add_proto qw/void vpx_highbd_dc_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_predictor_16x16 neon sse2/;
add_proto qw/void vpx_highbd_dc_top_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_top_predictor_16x16 neon/;
add_proto qw/void vpx_highbd_dc_left_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_left_predictor_16x16 neon/;
add_proto qw/void vpx_highbd_dc_128_predictor_16x16/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_128_predictor_16x16 neon/;
add_proto qw/void vpx_highbd_d207_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d207e_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d45_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d45_predictor_32x32 neon/;
add_proto qw/void vpx_highbd_d45e_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d63e_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_h_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d117_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_d135_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_d135_predictor_32x32 neon/;
add_proto qw/void vpx_highbd_d153_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
add_proto qw/void vpx_highbd_v_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_v_predictor_32x32 sse2/;
add_proto qw/void vpx_highbd_tm_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_tm_predictor_32x32 sse2/;
add_proto qw/void vpx_highbd_dc_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_predictor_32x32 neon sse2/;
add_proto qw/void vpx_highbd_dc_top_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_top_predictor_32x32 neon/;
add_proto qw/void vpx_highbd_dc_left_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_left_predictor_32x32 neon/;
add_proto qw/void vpx_highbd_dc_128_predictor_32x32/, "uint16_t *dst, ptrdiff_t y_stride, const uint16_t *above, const uint16_t *left, int bd";
specialize qw/vpx_highbd_dc_128_predictor_32x32 neon/;
} # CONFIG_VP9_HIGHBITDEPTH
#
# Sub Pixel Filters
#
add_proto qw/void vpx_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve_copy neon dspr2 msa sse2/;
add_proto qw/void vpx_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve_avg neon dspr2 msa sse2/;
add_proto qw/void vpx_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8 sse2 ssse3 avx2 neon dspr2 msa/;
add_proto qw/void vpx_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8_horiz sse2 ssse3 avx2 neon dspr2 msa/;
add_proto qw/void vpx_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8_vert sse2 ssse3 avx2 neon dspr2 msa/;
add_proto qw/void vpx_convolve8_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8_avg sse2 ssse3 neon dspr2 msa/;
add_proto qw/void vpx_convolve8_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8_avg_horiz sse2 ssse3 neon dspr2 msa/;
add_proto qw/void vpx_convolve8_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_convolve8_avg_vert sse2 ssse3 neon dspr2 msa/;
add_proto qw/void vpx_scaled_2d/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
specialize qw/vpx_scaled_2d ssse3/;
add_proto qw/void vpx_scaled_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void vpx_scaled_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void vpx_scaled_avg_2d/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void vpx_scaled_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
add_proto qw/void vpx_scaled_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h";
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
#
# Sub Pixel Filters
#
add_proto qw/void vpx_highbd_convolve_copy/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve_copy sse2 neon/;
add_proto qw/void vpx_highbd_convolve_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve_avg sse2 neon/;
add_proto qw/void vpx_highbd_convolve8/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8 neon/, "$sse2_x86_64";
add_proto qw/void vpx_highbd_convolve8_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8_horiz neon/, "$sse2_x86_64";
add_proto qw/void vpx_highbd_convolve8_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8_vert neon/, "$sse2_x86_64";
add_proto qw/void vpx_highbd_convolve8_avg/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8_avg neon/, "$sse2_x86_64";
add_proto qw/void vpx_highbd_convolve8_avg_horiz/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8_avg_horiz neon/, "$sse2_x86_64";
add_proto qw/void vpx_highbd_convolve8_avg_vert/, "const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, const int16_t *filter_x, int x_step_q4, const int16_t *filter_y, int y_step_q4, int w, int h, int bps";
specialize qw/vpx_highbd_convolve8_avg_vert neon/, "$sse2_x86_64";
} # CONFIG_VP9_HIGHBITDEPTH
#
# Loopfilter
#
add_proto qw/void vpx_lpf_vertical_16/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_vertical_16 sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_vertical_16_dual/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_vertical_16_dual sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_vertical_8/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_vertical_8 sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_vertical_8_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
specialize qw/vpx_lpf_vertical_8_dual sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_vertical_4/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_vertical_4 sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_vertical_4_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
specialize qw/vpx_lpf_vertical_4_dual sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_16/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_horizontal_16 sse2 avx2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_16_dual/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_horizontal_16_dual sse2 avx2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_8/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_horizontal_8 sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_8_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
specialize qw/vpx_lpf_horizontal_8_dual sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_4/, "uint8_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh";
specialize qw/vpx_lpf_horizontal_4 sse2 neon dspr2 msa/;
add_proto qw/void vpx_lpf_horizontal_4_dual/, "uint8_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1";
specialize qw/vpx_lpf_horizontal_4_dual sse2 neon dspr2 msa/;
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vpx_highbd_lpf_vertical_16/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_vertical_16 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_vertical_16_dual/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_vertical_16_dual sse2 neon/;
add_proto qw/void vpx_highbd_lpf_vertical_8/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_vertical_8 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_vertical_8_dual/, "uint16_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1, int bd";
specialize qw/vpx_highbd_lpf_vertical_8_dual sse2 neon/;
add_proto qw/void vpx_highbd_lpf_vertical_4/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_vertical_4 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_vertical_4_dual/, "uint16_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1, int bd";
specialize qw/vpx_highbd_lpf_vertical_4_dual sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_16/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_horizontal_16 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_16_dual/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_horizontal_16_dual sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_8/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_horizontal_8 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_8_dual/, "uint16_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1, int bd";
specialize qw/vpx_highbd_lpf_horizontal_8_dual sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_4/, "uint16_t *s, int pitch, const uint8_t *blimit, const uint8_t *limit, const uint8_t *thresh, int bd";
specialize qw/vpx_highbd_lpf_horizontal_4 sse2 neon/;
add_proto qw/void vpx_highbd_lpf_horizontal_4_dual/, "uint16_t *s, int pitch, const uint8_t *blimit0, const uint8_t *limit0, const uint8_t *thresh0, const uint8_t *blimit1, const uint8_t *limit1, const uint8_t *thresh1, int bd";
specialize qw/vpx_highbd_lpf_horizontal_4_dual sse2 neon/;
} # CONFIG_VP9_HIGHBITDEPTH
#
# Encoder functions.
#
#
# Forward transform
#
if (vpx_config("CONFIG_VP9_ENCODER") eq "yes") {
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vpx_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct4x4 sse2/;
add_proto qw/void vpx_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct4x4_1 sse2/;
add_proto qw/void vpx_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct8x8 sse2/;
add_proto qw/void vpx_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct8x8_1 sse2/;
add_proto qw/void vpx_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct16x16 sse2/;
add_proto qw/void vpx_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct16x16_1 sse2/;
add_proto qw/void vpx_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32 sse2/;
add_proto qw/void vpx_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32_rd sse2/;
add_proto qw/void vpx_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32_1 sse2/;
add_proto qw/void vpx_highbd_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_highbd_fdct4x4 sse2/;
add_proto qw/void vpx_highbd_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_highbd_fdct8x8 sse2/;
add_proto qw/void vpx_highbd_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
add_proto qw/void vpx_highbd_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_highbd_fdct16x16 sse2/;
add_proto qw/void vpx_highbd_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
add_proto qw/void vpx_highbd_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_highbd_fdct32x32 sse2/;
add_proto qw/void vpx_highbd_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_highbd_fdct32x32_rd sse2/;
add_proto qw/void vpx_highbd_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
} else {
add_proto qw/void vpx_fdct4x4/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct4x4 sse2 msa/;
add_proto qw/void vpx_fdct4x4_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct4x4_1 sse2/;
add_proto qw/void vpx_fdct8x8/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct8x8 sse2 neon msa/, "$ssse3_x86_64";
add_proto qw/void vpx_fdct8x8_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct8x8_1 sse2 neon msa/;
add_proto qw/void vpx_fdct16x16/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct16x16 sse2 msa/;
add_proto qw/void vpx_fdct16x16_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct16x16_1 sse2 msa/;
add_proto qw/void vpx_fdct32x32/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32 sse2 avx2 msa/;
add_proto qw/void vpx_fdct32x32_rd/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32_rd sse2 avx2 msa/;
add_proto qw/void vpx_fdct32x32_1/, "const int16_t *input, tran_low_t *output, int stride";
specialize qw/vpx_fdct32x32_1 sse2 msa/;
} # CONFIG_VP9_HIGHBITDEPTH
} # CONFIG_VP9_ENCODER
#
# Inverse transform
if (vpx_config("CONFIG_VP9") eq "yes") {
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
# Note as optimized versions of these functions are added we need to add a check to ensure
# that when CONFIG_EMULATE_HARDWARE is on, it defaults to the C versions only.
add_proto qw/void vpx_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_iwht4x4_16_add sse2/;
add_proto qw/void vpx_highbd_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct8x8_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct32x32_1_add sse2/;
add_proto qw/void vpx_highbd_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
# Force C versions if CONFIG_EMULATE_HARDWARE is 1
if (vpx_config("CONFIG_EMULATE_HARDWARE") eq "yes") {
add_proto qw/void vpx_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_highbd_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
add_proto qw/void vpx_highbd_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
} else {
add_proto qw/void vpx_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct4x4_16_add neon sse2/;
add_proto qw/void vpx_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct4x4_1_add neon sse2/;
add_proto qw/void vpx_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_64_add neon sse2/, "$ssse3_x86_64";
add_proto qw/void vpx_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_12_add neon sse2/, "$ssse3_x86_64";
add_proto qw/void vpx_idct8x8_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_1_add neon sse2/;
add_proto qw/void vpx_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_256_add sse2/;
add_proto qw/void vpx_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_10_add sse2/;
add_proto qw/void vpx_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_1_add neon sse2/;
add_proto qw/void vpx_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_1024_add sse2/, "$ssse3_x86_64";
add_proto qw/void vpx_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_135_add sse2/, "$ssse3_x86_64";
# Need to add 135 eob idct32x32 implementations.
$vpx_idct32x32_135_add_sse2=vpx_idct32x32_1024_add_sse2;
add_proto qw/void vpx_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_34_add neon sse2/, "$ssse3_x86_64";
add_proto qw/void vpx_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_1_add neon sse2/;
add_proto qw/void vpx_highbd_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct4x4_16_add sse2/;
add_proto qw/void vpx_highbd_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct8x8_64_add sse2/;
add_proto qw/void vpx_highbd_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct8x8_12_add sse2/;
add_proto qw/void vpx_highbd_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct16x16_256_add sse2/;
add_proto qw/void vpx_highbd_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride, int bd";
specialize qw/vpx_highbd_idct16x16_10_add sse2/;
} # CONFIG_EMULATE_HARDWARE
} else {
# Force C versions if CONFIG_EMULATE_HARDWARE is 1
if (vpx_config("CONFIG_EMULATE_HARDWARE") eq "yes") {
add_proto qw/void vpx_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
add_proto qw/void vpx_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
} else {
add_proto qw/void vpx_idct4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct4x4_1_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct4x4_16_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct8x8_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_1_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct8x8_64_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_64_add sse2 neon dspr2 msa/, "$ssse3_x86_64";
add_proto qw/void vpx_idct8x8_12_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct8x8_12_add sse2 neon dspr2 msa/, "$ssse3_x86_64";
add_proto qw/void vpx_idct16x16_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_1_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct16x16_256_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_256_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct16x16_10_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct16x16_10_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_idct32x32_1024_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_1024_add sse2 neon dspr2 msa/, "$ssse3_x86_64";
add_proto qw/void vpx_idct32x32_135_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_135_add sse2 neon dspr2 msa/, "$ssse3_x86_64";
$vpx_idct32x32_135_add_sse2=vpx_idct32x32_1024_add_sse2;
$vpx_idct32x32_135_add_dspr2=vpx_idct32x32_1024_add_dspr2;
$vpx_idct32x32_135_add_msa=vpx_idct32x32_1024_add_msa;
add_proto qw/void vpx_idct32x32_34_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_34_add sse2 neon dspr2 msa/, "$ssse3_x86_64";
add_proto qw/void vpx_idct32x32_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_idct32x32_1_add sse2 neon dspr2 msa/;
add_proto qw/void vpx_iwht4x4_1_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_iwht4x4_1_add msa/;
add_proto qw/void vpx_iwht4x4_16_add/, "const tran_low_t *input, uint8_t *dest, int dest_stride";
specialize qw/vpx_iwht4x4_16_add msa sse2/;
} # CONFIG_EMULATE_HARDWARE
} # CONFIG_VP9_HIGHBITDEPTH
} # CONFIG_VP9
#
# Quantization
#
if (vpx_config("CONFIG_VP9_ENCODER") eq "yes") {
add_proto qw/void vpx_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vpx_quantize_b sse2/, "$ssse3_x86_64", "$avx_x86_64";
add_proto qw/void vpx_quantize_b_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vpx_quantize_b_32x32/, "$ssse3_x86_64", "$avx_x86_64";
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vpx_highbd_quantize_b/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vpx_highbd_quantize_b sse2/;
add_proto qw/void vpx_highbd_quantize_b_32x32/, "const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block, const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr, const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan";
specialize qw/vpx_highbd_quantize_b_32x32 sse2/;
} # CONFIG_VP9_HIGHBITDEPTH
} # CONFIG_VP9_ENCODER
if (vpx_config("CONFIG_ENCODERS") eq "yes") {
#
# Block subtraction
#
add_proto qw/void vpx_subtract_block/, "int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride";
specialize qw/vpx_subtract_block neon msa sse2/;
#
# Single block SAD
#
add_proto qw/unsigned int vpx_sad64x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad64x64 avx2 neon msa sse2/;
add_proto qw/unsigned int vpx_sad64x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad64x32 avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad32x64 avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad32x32 avx2 neon msa sse2/;
add_proto qw/unsigned int vpx_sad32x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad32x16 avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad16x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad16x32 msa sse2/;
add_proto qw/unsigned int vpx_sad16x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad16x16 neon msa sse2/;
add_proto qw/unsigned int vpx_sad16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad16x8 neon msa sse2/;
add_proto qw/unsigned int vpx_sad8x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad8x16 neon msa sse2/;
add_proto qw/unsigned int vpx_sad8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad8x8 neon msa sse2/;
add_proto qw/unsigned int vpx_sad8x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad8x4 msa sse2/;
add_proto qw/unsigned int vpx_sad4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad4x8 msa sse2/;
add_proto qw/unsigned int vpx_sad4x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_sad4x4 neon msa sse2/;
#
# Avg
#
if (vpx_config("CONFIG_VP9_ENCODER") eq "yes") {
add_proto qw/unsigned int vpx_avg_8x8/, "const uint8_t *, int p";
specialize qw/vpx_avg_8x8 sse2 neon msa/;
add_proto qw/unsigned int vpx_avg_4x4/, "const uint8_t *, int p";
specialize qw/vpx_avg_4x4 sse2 neon msa/;
add_proto qw/void vpx_minmax_8x8/, "const uint8_t *s, int p, const uint8_t *d, int dp, int *min, int *max";
specialize qw/vpx_minmax_8x8 sse2 neon/;
add_proto qw/void vpx_hadamard_8x8/, "const int16_t *src_diff, int src_stride, int16_t *coeff";
specialize qw/vpx_hadamard_8x8 sse2 neon/, "$ssse3_x86_64";
add_proto qw/void vpx_hadamard_16x16/, "const int16_t *src_diff, int src_stride, int16_t *coeff";
specialize qw/vpx_hadamard_16x16 sse2 neon/;
add_proto qw/int vpx_satd/, "const int16_t *coeff, int length";
specialize qw/vpx_satd sse2 neon/;
add_proto qw/void vpx_int_pro_row/, "int16_t *hbuf, const uint8_t *ref, const int ref_stride, const int height";
specialize qw/vpx_int_pro_row sse2 neon/;
add_proto qw/int16_t vpx_int_pro_col/, "const uint8_t *ref, const int width";
specialize qw/vpx_int_pro_col sse2 neon/;
add_proto qw/int vpx_vector_var/, "const int16_t *ref, const int16_t *src, const int bwl";
specialize qw/vpx_vector_var neon sse2/;
} # CONFIG_VP9_ENCODER
add_proto qw/unsigned int vpx_sad64x64_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad64x64_avg avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad64x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad64x32_avg avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x64_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad32x64_avg avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad32x32_avg avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad32x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad32x16_avg avx2 msa sse2/;
add_proto qw/unsigned int vpx_sad16x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad16x32_avg msa sse2/;
add_proto qw/unsigned int vpx_sad16x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad16x16_avg msa sse2/;
add_proto qw/unsigned int vpx_sad16x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad16x8_avg msa sse2/;
add_proto qw/unsigned int vpx_sad8x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad8x16_avg msa sse2/;
add_proto qw/unsigned int vpx_sad8x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad8x8_avg msa sse2/;
add_proto qw/unsigned int vpx_sad8x4_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad8x4_avg msa sse2/;
add_proto qw/unsigned int vpx_sad4x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad4x8_avg msa sse2/;
add_proto qw/unsigned int vpx_sad4x4_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_sad4x4_avg msa sse2/;
#
# Multi-block SAD, comparing a reference to N blocks 1 pixel apart horizontally
#
# Blocks of 3
add_proto qw/void vpx_sad64x64x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad64x64x3 msa/;
add_proto qw/void vpx_sad32x32x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad32x32x3 msa/;
add_proto qw/void vpx_sad16x16x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x16x3 sse3 ssse3 msa/;
add_proto qw/void vpx_sad16x8x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x8x3 sse3 ssse3 msa/;
add_proto qw/void vpx_sad8x16x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x16x3 sse3 msa/;
add_proto qw/void vpx_sad8x8x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x8x3 sse3 msa/;
add_proto qw/void vpx_sad4x4x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad4x4x3 sse3 msa/;
# Blocks of 8
add_proto qw/void vpx_sad64x64x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad64x64x8 msa/;
add_proto qw/void vpx_sad32x32x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad32x32x8 msa/;
add_proto qw/void vpx_sad16x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x16x8 sse4_1 msa/;
add_proto qw/void vpx_sad16x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x8x8 sse4_1 msa/;
add_proto qw/void vpx_sad8x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x16x8 sse4_1 msa/;
add_proto qw/void vpx_sad8x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x8x8 sse4_1 msa/;
add_proto qw/void vpx_sad8x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x4x8 msa/;
add_proto qw/void vpx_sad4x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad4x8x8 msa/;
add_proto qw/void vpx_sad4x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad4x4x8 sse4_1 msa/;
#
# Multi-block SAD, comparing a reference to N independent blocks
#
add_proto qw/void vpx_sad64x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad64x64x4d avx2 neon msa sse2/;
add_proto qw/void vpx_sad64x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad64x32x4d msa sse2/;
add_proto qw/void vpx_sad32x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad32x64x4d msa sse2/;
add_proto qw/void vpx_sad32x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad32x32x4d avx2 neon msa sse2/;
add_proto qw/void vpx_sad32x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad32x16x4d msa sse2/;
add_proto qw/void vpx_sad16x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x32x4d msa sse2/;
add_proto qw/void vpx_sad16x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x16x4d neon msa sse2/;
add_proto qw/void vpx_sad16x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad16x8x4d msa sse2/;
add_proto qw/void vpx_sad8x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x16x4d msa sse2/;
add_proto qw/void vpx_sad8x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x8x4d msa sse2/;
add_proto qw/void vpx_sad8x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad8x4x4d msa sse2/;
add_proto qw/void vpx_sad4x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad4x8x4d msa sse2/;
add_proto qw/void vpx_sad4x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t * const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_sad4x4x4d msa sse2/;
add_proto qw/uint64_t vpx_sum_squares_2d_i16/, "const int16_t *src, int stride, int size";
specialize qw/vpx_sum_squares_2d_i16 sse2/;
#
# Structured Similarity (SSIM)
#
if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
add_proto qw/void vpx_ssim_parms_8x8/, "const uint8_t *s, int sp, const uint8_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
specialize qw/vpx_ssim_parms_8x8/, "$sse2_x86_64";
add_proto qw/void vpx_ssim_parms_16x16/, "const uint8_t *s, int sp, const uint8_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
specialize qw/vpx_ssim_parms_16x16/, "$sse2_x86_64";
}
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
#
# Block subtraction
#
add_proto qw/void vpx_highbd_subtract_block/, "int rows, int cols, int16_t *diff_ptr, ptrdiff_t diff_stride, const uint8_t *src_ptr, ptrdiff_t src_stride, const uint8_t *pred_ptr, ptrdiff_t pred_stride, int bd";
#
# Single block SAD
#
add_proto qw/unsigned int vpx_highbd_sad64x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad64x64 sse2/;
add_proto qw/unsigned int vpx_highbd_sad64x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad64x32 sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x64/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad32x64 sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad32x32 sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad32x16 sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x32/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad16x32 sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad16x8 sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x16/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad8x16 sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
specialize qw/vpx_highbd_sad8x4 sse2/;
add_proto qw/unsigned int vpx_highbd_sad4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
add_proto qw/unsigned int vpx_highbd_sad4x4/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride";
#
# Avg
#
add_proto qw/unsigned int vpx_highbd_avg_8x8/, "const uint8_t *, int p";
add_proto qw/unsigned int vpx_highbd_avg_4x4/, "const uint8_t *, int p";
add_proto qw/void vpx_highbd_minmax_8x8/, "const uint8_t *s, int p, const uint8_t *d, int dp, int *min, int *max";
add_proto qw/unsigned int vpx_highbd_sad64x64_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad64x64_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad64x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad64x32_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x64_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad32x64_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad32x32_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad32x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad32x16_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x32_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad16x32_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad16x16_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad16x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad16x8_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x16_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad8x16_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad8x8_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad8x4_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
specialize qw/vpx_highbd_sad8x4_avg sse2/;
add_proto qw/unsigned int vpx_highbd_sad4x8_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
add_proto qw/unsigned int vpx_highbd_sad4x4_avg/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, const uint8_t *second_pred";
#
# Multi-block SAD, comparing a reference to N blocks 1 pixel apart horizontally
#
# Blocks of 3
add_proto qw/void vpx_highbd_sad64x64x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad32x32x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad16x16x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad16x8x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad8x16x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad8x8x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad4x4x3/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
# Blocks of 8
add_proto qw/void vpx_highbd_sad64x64x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad32x32x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad16x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad16x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad8x16x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad8x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad8x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad4x8x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
add_proto qw/void vpx_highbd_sad4x4x8/, "const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, uint32_t *sad_array";
#
# Multi-block SAD, comparing a reference to N independent blocks
#
add_proto qw/void vpx_highbd_sad64x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad64x64x4d sse2/;
add_proto qw/void vpx_highbd_sad64x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad64x32x4d sse2/;
add_proto qw/void vpx_highbd_sad32x64x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad32x64x4d sse2/;
add_proto qw/void vpx_highbd_sad32x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad32x32x4d sse2/;
add_proto qw/void vpx_highbd_sad32x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad32x16x4d sse2/;
add_proto qw/void vpx_highbd_sad16x32x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad16x32x4d sse2/;
add_proto qw/void vpx_highbd_sad16x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad16x16x4d sse2/;
add_proto qw/void vpx_highbd_sad16x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad16x8x4d sse2/;
add_proto qw/void vpx_highbd_sad8x16x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad8x16x4d sse2/;
add_proto qw/void vpx_highbd_sad8x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad8x8x4d sse2/;
add_proto qw/void vpx_highbd_sad8x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad8x4x4d sse2/;
add_proto qw/void vpx_highbd_sad4x8x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad4x8x4d sse2/;
add_proto qw/void vpx_highbd_sad4x4x4d/, "const uint8_t *src_ptr, int src_stride, const uint8_t* const ref_ptr[], int ref_stride, uint32_t *sad_array";
specialize qw/vpx_highbd_sad4x4x4d sse2/;
#
# Structured Similarity (SSIM)
#
if (vpx_config("CONFIG_INTERNAL_STATS") eq "yes") {
add_proto qw/void vpx_highbd_ssim_parms_8x8/, "const uint16_t *s, int sp, const uint16_t *r, int rp, uint32_t *sum_s, uint32_t *sum_r, uint32_t *sum_sq_s, uint32_t *sum_sq_r, uint32_t *sum_sxr";
}
} # CONFIG_VP9_HIGHBITDEPTH
} # CONFIG_ENCODERS
if (vpx_config("CONFIG_ENCODERS") eq "yes" || vpx_config("CONFIG_POSTPROC") eq "yes" || vpx_config("CONFIG_VP9_POSTPROC") eq "yes") {
#
# Variance
#
add_proto qw/unsigned int vpx_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance64x64 sse2 avx2 neon msa/;
add_proto qw/unsigned int vpx_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance64x32 sse2 avx2 neon msa/;
add_proto qw/unsigned int vpx_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance32x64 sse2 neon msa/;
add_proto qw/unsigned int vpx_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance32x32 sse2 avx2 neon msa/;
add_proto qw/unsigned int vpx_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance32x16 sse2 avx2 msa/;
add_proto qw/unsigned int vpx_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance16x32 sse2 msa/;
add_proto qw/unsigned int vpx_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance16x16 sse2 avx2 neon msa/;
add_proto qw/unsigned int vpx_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance16x8 sse2 neon msa/;
add_proto qw/unsigned int vpx_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance8x16 sse2 neon msa/;
add_proto qw/unsigned int vpx_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance8x8 sse2 neon msa/;
add_proto qw/unsigned int vpx_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance8x4 sse2 msa/;
add_proto qw/unsigned int vpx_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance4x8 sse2 msa/;
add_proto qw/unsigned int vpx_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_variance4x4 sse2 msa/;
#
# Specialty Variance
#
add_proto qw/void vpx_get16x16var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
specialize qw/vpx_get16x16var sse2 avx2 neon msa/;
add_proto qw/void vpx_get8x8var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
specialize qw/vpx_get8x8var sse2 neon msa/;
add_proto qw/unsigned int vpx_mse16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_mse16x16 sse2 avx2 neon msa/;
add_proto qw/unsigned int vpx_mse16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_mse16x8 sse2 msa/;
add_proto qw/unsigned int vpx_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_mse8x16 sse2 msa/;
add_proto qw/unsigned int vpx_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_mse8x8 sse2 msa/;
add_proto qw/unsigned int vpx_get_mb_ss/, "const int16_t *";
specialize qw/vpx_get_mb_ss sse2 msa/;
add_proto qw/unsigned int vpx_get4x4sse_cs/, "const unsigned char *src_ptr, int source_stride, const unsigned char *ref_ptr, int ref_stride";
specialize qw/vpx_get4x4sse_cs neon msa/;
add_proto qw/void vpx_comp_avg_pred/, "uint8_t *comp_pred, const uint8_t *pred, int width, int height, const uint8_t *ref, int ref_stride";
#
# Subpixel Variance
#
add_proto qw/uint32_t vpx_sub_pixel_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance64x64 avx2 neon msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance64x32 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance32x64 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance32x32 avx2 neon msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance32x16 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance16x32 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance16x16 neon msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance16x8 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance8x16 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance8x8 neon msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance8x4 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance4x8 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_sub_pixel_variance4x4 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance64x64 avx2 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance64x32 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance32x64 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance32x32 avx2 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance32x16 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance16x32 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance16x16 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance16x8 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance8x16 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance8x8 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance8x4 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance4x8 msa sse2 ssse3/;
add_proto qw/uint32_t vpx_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_sub_pixel_avg_variance4x4 msa sse2 ssse3/;
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/unsigned int vpx_highbd_12_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance64x64 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance64x32 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance32x64 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance32x32 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance32x16 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance16x32 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance16x8 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance8x16 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_variance8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_12_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_12_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_12_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_10_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance64x64 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance64x32 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance32x64 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance32x32 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance32x16 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance16x32 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance16x8 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance8x16 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_variance8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_10_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_10_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_10_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_8_variance64x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance64x64 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance64x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance64x32 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance32x64/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance32x64 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance32x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance32x32 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance32x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance32x16 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance16x32/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance16x32 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance16x8 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance8x16 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_variance8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_8_variance8x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_8_variance4x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_8_variance4x4/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse";
add_proto qw/void vpx_highbd_8_get16x16var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/void vpx_highbd_8_get8x8var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/void vpx_highbd_10_get16x16var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/void vpx_highbd_10_get8x8var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/void vpx_highbd_12_get16x16var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/void vpx_highbd_12_get8x8var/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int ref_stride, unsigned int *sse, int *sum";
add_proto qw/unsigned int vpx_highbd_8_mse16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_mse16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_8_mse16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_8_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_8_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_8_mse8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_10_mse16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_mse16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_10_mse16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_10_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_10_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_10_mse8x8 sse2/;
add_proto qw/unsigned int vpx_highbd_12_mse16x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_mse16x16 sse2/;
add_proto qw/unsigned int vpx_highbd_12_mse16x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_12_mse8x16/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
add_proto qw/unsigned int vpx_highbd_12_mse8x8/, "const uint8_t *src_ptr, int source_stride, const uint8_t *ref_ptr, int recon_stride, unsigned int *sse";
specialize qw/vpx_highbd_12_mse8x8 sse2/;
add_proto qw/void vpx_highbd_comp_avg_pred/, "uint16_t *comp_pred, const uint8_t *pred8, int width, int height, const uint8_t *ref8, int ref_stride";
#
# Subpixel Variance
#
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_12_sub_pixel_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_10_sub_pixel_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
specialize qw/vpx_highbd_8_sub_pixel_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse";
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_12_sub_pixel_avg_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t vpx_highbd_12_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_10_sub_pixel_avg_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t vpx_highbd_10_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance64x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance64x64 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance64x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance64x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance32x64/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance32x64 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance32x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance32x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance32x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance32x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance16x32/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance16x32 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance16x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance16x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance16x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance16x8 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance8x16/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance8x16 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance8x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance8x8 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance8x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
specialize qw/vpx_highbd_8_sub_pixel_avg_variance8x4 sse2/;
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance4x8/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
add_proto qw/uint32_t vpx_highbd_8_sub_pixel_avg_variance4x4/, "const uint8_t *src_ptr, int source_stride, int xoffset, int yoffset, const uint8_t *ref_ptr, int ref_stride, uint32_t *sse, const uint8_t *second_pred";
} # CONFIG_VP9_HIGHBITDEPTH
#
# Post Processing
#
if (vpx_config("CONFIG_POSTPROC") eq "yes" || vpx_config("CONFIG_VP9_POSTPROC") eq "yes") {
add_proto qw/void vpx_plane_add_noise/, "uint8_t *start, const int8_t *noise, int blackclamp, int whiteclamp, int width, int height, int pitch";
specialize qw/vpx_plane_add_noise sse2 msa/;
add_proto qw/void vpx_mbpost_proc_down/, "unsigned char *dst, int pitch, int rows, int cols,int flimit";
specialize qw/vpx_mbpost_proc_down sse2 msa/;
$vpx_mbpost_proc_down_sse2=vpx_mbpost_proc_down_xmm;
add_proto qw/void vpx_mbpost_proc_across_ip/, "unsigned char *dst, int pitch, int rows, int cols,int flimit";
specialize qw/vpx_mbpost_proc_across_ip sse2 msa/;
$vpx_mbpost_proc_across_ip_sse2=vpx_mbpost_proc_across_ip_xmm;
add_proto qw/void vpx_post_proc_down_and_across_mb_row/, "unsigned char *src, unsigned char *dst, int src_pitch, int dst_pitch, int cols, unsigned char *flimits, int size";
specialize qw/vpx_post_proc_down_and_across_mb_row sse2 msa/;
}
} # CONFIG_ENCODERS || CONFIG_POSTPROC || CONFIG_VP9_POSTPROC
1;
| 66.505114 | 365 | 0.794163 |
ed1465b84237be6d855b0112dbab31817649da9b | 1,045 | pm | Perl | lib/Google/Ads/GoogleAds/V6/Services/LandingPageViewService.pm | PierrickVoulet/google-ads-perl | bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/GoogleAds/V6/Services/LandingPageViewService.pm | PierrickVoulet/google-ads-perl | bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4 | [
"Apache-2.0"
]
| null | null | null | lib/Google/Ads/GoogleAds/V6/Services/LandingPageViewService.pm | PierrickVoulet/google-ads-perl | bc9fa2de22aa3e11b99dc22251d90a1723dd8cc4 | [
"Apache-2.0"
]
| null | null | null | # Copyright 2020, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package Google::Ads::GoogleAds::V6::Services::LandingPageViewService;
use strict;
use warnings;
use base qw(Google::Ads::GoogleAds::BaseService);
sub get {
my $self = shift;
my $request_body = shift;
my $http_method = 'GET';
my $request_path = 'v6/{+resourceName}';
my $response_type = 'Google::Ads::GoogleAds::V6::Resources::LandingPageView';
return $self->SUPER::call($http_method, $request_path, $request_body,
$response_type);
}
1;
| 31.666667 | 79 | 0.727273 |
73f3f56d771019cd3713d66bc37f55e9376bc08c | 8,277 | pm | Perl | modules/EnsEMBL/Web/Template/Legacy.pm | leannehaggerty/ensembl-webcode | 69d419c3ced465e36f41ff7531dc8e6bdc21296a | [
"Apache-2.0"
]
| null | null | null | modules/EnsEMBL/Web/Template/Legacy.pm | leannehaggerty/ensembl-webcode | 69d419c3ced465e36f41ff7531dc8e6bdc21296a | [
"Apache-2.0"
]
| null | null | null | modules/EnsEMBL/Web/Template/Legacy.pm | leannehaggerty/ensembl-webcode | 69d419c3ced465e36f41ff7531dc8e6bdc21296a | [
"Apache-2.0"
]
| null | null | null | =head1 LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2018] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=cut
package EnsEMBL::Web::Template::Legacy;
### Legacy page template, used by standard HTML pages
use parent qw(EnsEMBL::Web::Template);
use HTML::Entities qw(encode_entities);
sub init {
my $self = shift;
$self->{'main_class'} = 'main';
$self->{'lefthand_menu'} = 1;
$self->{'has_species_bar'} = $self->hub->species && $self->hub->species !~ /multi|common/i ? 1 : 0;
$self->{'has_tabs'} = $self->hub->controller->configuration->has_tabs;
$self->add_head;
$self->add_body;
}
sub add_head {
my $self = shift;
my $page = $self->page;
$page->add_head_elements(qw(
title EnsEMBL::Web::Document::Element::Title
stylesheet EnsEMBL::Web::Document::Element::Stylesheet
links EnsEMBL::Web::Document::Element::Links
meta EnsEMBL::Web::Document::Element::Meta
prefetch EnsEMBL::Web::Document::Element::Prefetch
head_javascript EnsEMBL::Web::Document::Element::HeadJavascript
));
}
sub add_body {
my $self = shift;
my $page = $self->page;
$page->add_body_elements(qw(
logo EnsEMBL::Web::Document::Element::Logo
account EnsEMBL::Web::Document::Element::AccountLinks
search_box EnsEMBL::Web::Document::Element::SearchBox
tools EnsEMBL::Web::Document::Element::ToolLinks
));
if ($self->{'has_species_bar'}) {
$page->add_body_elements(qw(
species_bar EnsEMBL::Web::Document::Element::SpeciesBar
));
}
if ($self->{'has_tabs'}) {
$page->add_body_elements(qw(
tabs EnsEMBL::Web::Document::Element::Tabs
));
}
$page->add_body_elements(qw(
navigation EnsEMBL::Web::Document::Element::Navigation
tool_buttons EnsEMBL::Web::Document::Element::ToolButtons
summary EnsEMBL::Web::Document::Element::Summary
content EnsEMBL::Web::Document::Element::Content
modal EnsEMBL::Web::Document::Element::Modal
acknowledgements EnsEMBL::Web::Document::Element::Acknowledgements
mobile_nav EnsEMBL::Web::Document::Element::MobileNavigation
copyright EnsEMBL::Web::Document::Element::Copyright
footerlinks EnsEMBL::Web::Document::Element::FooterLinks
fatfooter EnsEMBL::Web::Document::Element::FatFooter
tmp_message EnsEMBL::Web::Document::Element::TmpMessage
body_javascript EnsEMBL::Web::Document::Element::BodyJavascript
));
}
sub render {
my ($self, $elements) = @_;
my $hub = $self->hub;
my $HTML;
$HTML .= $self->render_masthead($elements);
$HTML .= $self->render_content($elements);
$HTML .= $self->render_footer($elements);
$HTML .= $self->render_page_end($elements);
return $HTML;
}
sub render_masthead {
my ($self, $elements) = @_;
## MASTHEAD & GLOBAL NAVIGATION
my $masthead_class = '';
if ($self->{'has_species_bar'}) {
$masthead_class = $self->{'has_tabs'} ? ' bar_and_tabs' : ' bar_only';
}
elsif ($self->{'has_tabs'}) {
$masthead_class = ' tabs_only';
}
return qq(
<div id="min_width_container">
<div id="min_width_holder">
<div id="masthead" class="js_panel$masthead_class">
<input type="hidden" class="panel_type" value="Masthead" />
<div class="logo_holder">$elements->{'logo'}</div>
<div class="mh print_hide">
<div class="account_holder">$elements->{'account'}</div>
<div class="tools_holder">$elements->{'tools'}</div>
<div class="search_holder print_hide">$elements->{'search_box'}</div>
</div>
);
}
sub render_content {
my ($self, $elements) = @_;
my $hub = $self->hub;
my $page = $self->page;
## LOCAL NAVIGATION & MAIN CONTENT
my $sp_bar = $elements->{'species_bar'} ? qq(<div class="spbar_holder">$elements->{'species_bar'}</div>) : '';
my $tabs = $elements->{'tabs'} ? qq(<div class="tabs_holder print_hide">$elements->{'tabs'}</div>) : '';
my $icons = $page->icon_bar if $page->can('icon_bar');
my $panel_type = $page->can('panel_type') ? $page->panel_type : '';
my $main_holder = $panel_type ? qq(<div id="main_holder" class="js_panel">$panel_type) : '<div id="main_holder">';
my $main_class = $self->{'main_class'};
my $nav;
my $nav_class = $page->isa('EnsEMBL::Web::Document::Page::Configurator') ? 'cp_nav' : 'nav';
if ($self->{'lefthand_menu'}) {
$nav = qq(
<div id="page_nav_wrapper">
<div id="page_nav" class="$nav_class print_hide js_panel floating">
$elements->{'navigation'}
$elements->{'tool_buttons'}
$elements->{'acknowledgements'}
<p class="invisible">.</p>
</div>
</div>
);
}
return qq(
$sp_bar
$tabs
$icons
</div>
$main_holder
$nav
<div id="$main_class">
$elements->{'breadcrumbs'}
$elements->{'message'}
$elements->{'content'}
$elements->{'mobile_nav'}
</div>
);
}
sub render_footer {
my ($self, $elements) = @_;
my $hub = $self->hub;
my $page = $self->page;
my $footer_id = $self->{'lefthand_menu'} ? 'footer' : 'wide-footer';
my $html = qq(
<div id="$footer_id">
<div class="column-wrapper">$elements->{'copyright'}$elements->{'footerlinks'}
<p class="invisible">.</p>
</div>
<div class="column-wrapper">$elements->{'fatfooter'}
<p class="invisible">.</p>
</div>
</div>
);
if ($self->{'show_banner'}) {
$html .= $elements->{'bottom_banner'};
}
return $html;
}
sub render_page_end {
my ($self, $elements) = @_;
my $hub = $self->hub;
my $page = $self->page;
## JAVASCRIPT AND OTHER STUFF THAT NEEDS TO BE HIDDEN AT BOTTOM OF PAGE
my $species_path = $hub->species_defs->species_path;
my $gdpr_version = $hub->species_defs->GDPR_VERSION;
my $gdpr_policy_url = $hub->species_defs->GDPR_POLICY_URL;
my $gdpr_terms_url = $hub->species_defs->GDPR_TERMS_URL;
my $gdpr_cookie_name = $hub->species_defs->GDPR_COOKIE_NAME;
my $species_common_name = $hub->species_defs->SPECIES_COMMON_NAME;
my $max_region_length = 1000100 * ($hub->species_defs->ENSEMBL_GENOME_SIZE || 1);
my $ensembl_image_root = $hub->species_defs->ENSEMBL_IMAGE_ROOT;
my $core_params = $hub->core_params || {};
my $core_params_html = join('',map {
$v = encode_entities($core_params->{$_});
qq(<input type="hidden" name="$_" value="$v" />)
} keys %$core_params);
return qq(
</div>
</div>
</div>
<form id="core_params" action="#" style="display:none">
<fieldset>$core_params_html</fieldset>
</form>
<input type="hidden" id="species_path" name="species_path" value="$species_path" />
<input type="hidden" id="gdpr_version" name="gdpr_version" value="$gdpr_version" />
<input type="hidden" id="gdpr_policy_url" name="gdpr_policy_url" value="$gdpr_policy_url" />
<input type="hidden" id="gdpr_terms_url" name="gdpr_terms_url" value="$gdpr_terms_url" />
<input type="hidden" id="gdpr_cookie_name" name="gdpr_cookie_name" value="$gdpr_cookie_name" />
<input type="hidden" id="species_common_name" name="species_common_name" value="$species_common_name" />
<input type="hidden" id="ensembl_image_root" name="ensembl_image_root" value="$ensembl_image_root" />
<input type="hidden" id="max_region_length" name="max_region_length" value="$max_region_length" />
$elements->{'modal'}
$elements->{'tmp_message'}
$elements->{'body_javascript'}
);
}
1;
| 34.061728 | 117 | 0.635375 |
ed16ef70b02d96a772c13bca96e7690c33bdb825 | 108 | pl | Perl | HelloWorld/ProgrammingPerl/ch04/ch04.092.pl | grtlinux/KieaPerl | ed8e1e3359ad0186d5cc4f7ed037e956d2f26c9e | [
"Apache-2.0"
]
| null | null | null | HelloWorld/ProgrammingPerl/ch04/ch04.092.pl | grtlinux/KieaPerl | ed8e1e3359ad0186d5cc4f7ed037e956d2f26c9e | [
"Apache-2.0"
]
| null | null | null | HelloWorld/ProgrammingPerl/ch04/ch04.092.pl | grtlinux/KieaPerl | ed8e1e3359ad0186d5cc4f7ed037e956d2f26c9e | [
"Apache-2.0"
]
| null | null | null | {
local our @Current_Inventory = qw(bananas);
check_warehouse(); # no, we haven't no bananas :-)
}
| 21.6 | 55 | 0.62963 |
ed0f8c1e4dfcf1ace929d86fae41c8da4f723646 | 100 | t | Perl | t/RequiredModules.t | jdv/perl-chi | 8b3532a28d3e9d6c9028998d0b47335ffc2e1acc | [
"Artistic-1.0-cl8"
]
| 1 | 2016-05-08T23:05:34.000Z | 2016-05-08T23:05:34.000Z | t/RequiredModules.t | jdv/perl-chi | 8b3532a28d3e9d6c9028998d0b47335ffc2e1acc | [
"Artistic-1.0-cl8"
]
| null | null | null | t/RequiredModules.t | jdv/perl-chi | 8b3532a28d3e9d6c9028998d0b47335ffc2e1acc | [
"Artistic-1.0-cl8"
]
| null | null | null | #!perl -w
use strict;
use warnings;
use CHI::t::RequiredModules;
CHI::t::RequiredModules->runtests;
| 16.666667 | 34 | 0.74 |
ed081414c3683dfe08cb44ba6bd8ff9a90e66804 | 1,334 | pl | Perl | tests/libtest/notexists.pl | baruchsiach/curl | 7de2a4ce35dee7a9409ab78962ae12894a073d60 | [
"curl"
]
| 12 | 2016-10-04T11:36:23.000Z | 2021-04-29T00:15:18.000Z | tests/libtest/notexists.pl | baruchsiach/curl | 7de2a4ce35dee7a9409ab78962ae12894a073d60 | [
"curl"
]
| 70 | 2020-04-24T21:56:29.000Z | 2020-05-18T16:48:04.000Z | tests/libtest/notexists.pl | baruchsiach/curl | 7de2a4ce35dee7a9409ab78962ae12894a073d60 | [
"curl"
]
| 7 | 2016-12-14T09:56:11.000Z | 2020-01-07T12:25:34.000Z | #!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
# Check that given arguments do not exist on filesystem.
my $code = 0;
if ($#ARGV < 0) {
print "Usage: $0 file1 [fileN]\n";
exit 2;
}
while (@ARGV) {
my $fname = shift @ARGV;
if (-e $fname) {
print "Found '$fname' when not supposed to exist.\n";
$code = 1;
}
}
exit $code;
| 36.054054 | 76 | 0.49925 |
73e25a971f826bd58a1fb042457ae823863b9927 | 42,531 | pm | Perl | lib/YAML/Tiny.pm | Perl-Toolchain-Gang/YAML-Tiny | e94a4943edc47f6df66b5353a4791e356c222b40 | [
"Artistic-1.0"
]
| 11 | 2015-02-11T14:00:22.000Z | 2021-11-17T22:28:37.000Z | lib/YAML/Tiny.pm | Perl-Toolchain-Gang/YAML-Tiny | e94a4943edc47f6df66b5353a4791e356c222b40 | [
"Artistic-1.0"
]
| 26 | 2015-03-01T19:17:39.000Z | 2021-11-19T14:45:09.000Z | lib/YAML/Tiny.pm | Perl-Toolchain-Gang/YAML-Tiny | e94a4943edc47f6df66b5353a4791e356c222b40 | [
"Artistic-1.0"
]
| 16 | 2015-03-06T14:17:21.000Z | 2021-01-30T23:26:25.000Z | use 5.008001; # sane UTF-8 support
use strict;
use warnings;
package YAML::Tiny;
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
our $VERSION = '1.74';
#####################################################################
# The YAML::Tiny API.
#
# These are the currently documented API functions/methods and
# exports:
use Exporter;
our @ISA = qw{ Exporter };
our @EXPORT = qw{ Load Dump };
our @EXPORT_OK = qw{ LoadFile DumpFile freeze thaw };
###
# Functional/Export API:
sub Dump {
return YAML::Tiny->new(@_)->_dump_string;
}
# XXX-INGY Returning last document seems a bad behavior.
# XXX-XDG I think first would seem more natural, but I don't know
# that it's worth changing now
sub Load {
my $self = YAML::Tiny->_load_string(@_);
if ( wantarray ) {
return @$self;
} else {
# To match YAML.pm, return the last document
return $self->[-1];
}
}
# XXX-INGY Do we really need freeze and thaw?
# XXX-XDG I don't think so. I'd support deprecating them.
BEGIN {
*freeze = \&Dump;
*thaw = \&Load;
}
sub DumpFile {
my $file = shift;
return YAML::Tiny->new(@_)->_dump_file($file);
}
sub LoadFile {
my $file = shift;
my $self = YAML::Tiny->_load_file($file);
if ( wantarray ) {
return @$self;
} else {
# Return only the last document to match YAML.pm,
return $self->[-1];
}
}
###
# Object Oriented API:
# Create an empty YAML::Tiny object
# XXX-INGY Why do we use ARRAY object?
# NOTE: I get it now, but I think it's confusing and not needed.
# Will change it on a branch later, for review.
#
# XXX-XDG I don't support changing it yet. It's a very well-documented
# "API" of YAML::Tiny. I'd support deprecating it, but Adam suggested
# we not change it until YAML.pm's own OO API is established so that
# users only have one API change to digest, not two
sub new {
my $class = shift;
bless [ @_ ], $class;
}
# XXX-INGY It probably doesn't matter, and it's probably too late to
# change, but 'read/write' are the wrong names. Read and Write
# are actions that take data from storage to memory
# characters/strings. These take the data to/from storage to native
# Perl objects, which the terms dump and load are meant. As long as
# this is a legacy quirk to YAML::Tiny it's ok, but I'd prefer not
# to add new {read,write}_* methods to this API.
sub read_string {
my $self = shift;
$self->_load_string(@_);
}
sub write_string {
my $self = shift;
$self->_dump_string(@_);
}
sub read {
my $self = shift;
$self->_load_file(@_);
}
sub write {
my $self = shift;
$self->_dump_file(@_);
}
#####################################################################
# Constants
# Printed form of the unprintable characters in the lowest range
# of ASCII characters, listed by ASCII ordinal position.
my @UNPRINTABLE = qw(
0 x01 x02 x03 x04 x05 x06 a
b t n v f r x0E x0F
x10 x11 x12 x13 x14 x15 x16 x17
x18 x19 x1A e x1C x1D x1E x1F
);
# Printable characters for escapes
my %UNESCAPES = (
0 => "\x00", z => "\x00", N => "\x85",
a => "\x07", b => "\x08", t => "\x09",
n => "\x0a", v => "\x0b", f => "\x0c",
r => "\x0d", e => "\x1b", '\\' => '\\',
);
# XXX-INGY
# I(ngy) need to decide if these values should be quoted in
# YAML::Tiny or not. Probably yes.
# These 3 values have special meaning when unquoted and using the
# default YAML schema. They need quotes if they are strings.
my %QUOTE = map { $_ => 1 } qw{
null true false
};
# The commented out form is simpler, but overloaded the Perl regex
# engine due to recursion and backtracking problems on strings
# larger than 32,000ish characters. Keep it for reference purposes.
# qr/\"((?:\\.|[^\"])*)\"/
my $re_capture_double_quoted = qr/\"([^\\"]*(?:\\.[^\\"]*)*)\"/;
my $re_capture_single_quoted = qr/\'([^\']*(?:\'\'[^\']*)*)\'/;
# unquoted re gets trailing space that needs to be stripped
my $re_capture_unquoted_key = qr/([^:]+(?::+\S(?:[^:]*|.*?(?=:)))*)(?=\s*\:(?:\s+|$))/;
my $re_trailing_comment = qr/(?:\s+\#.*)?/;
my $re_key_value_separator = qr/\s*:(?:\s+(?:\#.*)?|$)/;
#####################################################################
# YAML::Tiny Implementation.
#
# These are the private methods that do all the work. They may change
# at any time.
###
# Loader functions:
# Create an object from a file
sub _load_file {
my $class = ref $_[0] ? ref shift : shift;
# Check the file
my $file = shift or $class->_error( 'You did not specify a file name' );
$class->_error( "File '$file' does not exist" )
unless -e $file;
$class->_error( "'$file' is a directory, not a file" )
unless -f _;
$class->_error( "Insufficient permissions to read '$file'" )
unless -r _;
# Open unbuffered with strict UTF-8 decoding and no translation layers
open( my $fh, "<:unix:encoding(UTF-8)", $file );
unless ( $fh ) {
$class->_error("Failed to open file '$file': $!");
}
# flock if available (or warn if not possible for OS-specific reasons)
if ( _can_flock() ) {
flock( $fh, Fcntl::LOCK_SH() )
or warn "Couldn't lock '$file' for reading: $!";
}
# slurp the contents
my $contents = eval {
use warnings FATAL => 'utf8';
local $/;
<$fh>
};
if ( my $err = $@ ) {
$class->_error("Error reading from file '$file': $err");
}
# close the file (release the lock)
unless ( close $fh ) {
$class->_error("Failed to close file '$file': $!");
}
$class->_load_string( $contents );
}
# Create an object from a string
sub _load_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
eval {
unless ( defined $string ) {
die \"Did not provide a string to load";
}
# Check if Perl has it marked as characters, but it's internally
# inconsistent. E.g. maybe latin1 got read on a :utf8 layer
if ( utf8::is_utf8($string) && ! utf8::valid($string) ) {
die \<<'...';
Read an invalid UTF-8 string (maybe mixed UTF-8 and 8-bit character set).
Did you decode with lax ":utf8" instead of strict ":encoding(UTF-8)"?
...
}
# Ensure Unicode character semantics, even for 0x80-0xff
utf8::upgrade($string);
# Check for and strip any leading UTF-8 BOM
$string =~ s/^\x{FEFF}//;
# Check for some special cases
return $self unless length $string;
# Split the file into lines
my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
split /(?:\015{1,2}\012|\015|\012)/, $string;
# Strip the initial YAML header
@lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;
# A nibbling parser
my $in_document = 0;
while ( @lines ) {
# Do we have a document header?
if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {
# Handle scalar documents
shift @lines;
if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {
push @$self,
$self->_load_scalar( "$1", [ undef ], \@lines );
next;
}
$in_document = 1;
}
if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {
# A naked document
push @$self, undef;
while ( @lines and $lines[0] !~ /^---/ ) {
shift @lines;
}
$in_document = 0;
# XXX The final '-+$' is to look for -- which ends up being an
# error later.
} elsif ( ! $in_document && @$self ) {
# only the first document can be explicit
die \"YAML::Tiny failed to classify the line '$lines[0]'";
} elsif ( $lines[0] =~ /^\s*\-(?:\s|$|-+$)/ ) {
# An array at the root
my $document = [ ];
push @$self, $document;
$self->_load_array( $document, [ 0 ], \@lines );
} elsif ( $lines[0] =~ /^(\s*)\S/ ) {
# A hash at the root
my $document = { };
push @$self, $document;
$self->_load_hash( $document, [ length($1) ], \@lines );
} else {
# Shouldn't get here. @lines have whitespace-only lines
# stripped, and previous match is a line with any
# non-whitespace. So this clause should only be reachable via
# a perlbug where \s is not symmetric with \S
# uncoverable statement
die \"YAML::Tiny failed to classify the line '$lines[0]'";
}
}
};
my $err = $@;
if ( ref $err eq 'SCALAR' ) {
$self->_error(${$err});
} elsif ( $err ) {
$self->_error($err);
}
return $self;
}
sub _unquote_single {
my ($self, $string) = @_;
return '' unless length $string;
$string =~ s/\'\'/\'/g;
return $string;
}
sub _unquote_double {
my ($self, $string) = @_;
return '' unless length $string;
$string =~ s/\\"/"/g;
$string =~
s{\\([Nnever\\fartz0b]|x([0-9a-fA-F]{2}))}
{(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}}gex;
return $string;
}
# Load a YAML scalar string to the actual Perl scalar
sub _load_scalar {
my ($self, $string, $indent, $lines) = @_;
# Trim trailing whitespace
$string =~ s/\s*\z//;
# Explitic null/undef
return undef if $string eq '~';
# Single quote
if ( $string =~ /^$re_capture_single_quoted$re_trailing_comment\z/ ) {
return $self->_unquote_single($1);
}
# Double quote.
if ( $string =~ /^$re_capture_double_quoted$re_trailing_comment\z/ ) {
return $self->_unquote_double($1);
}
# Special cases
if ( $string =~ /^[\'\"!&]/ ) {
die \"YAML::Tiny does not support a feature in line '$string'";
}
return {} if $string =~ /^{}(?:\s+\#.*)?\z/;
return [] if $string =~ /^\[\](?:\s+\#.*)?\z/;
# Regular unquoted string
if ( $string !~ /^[>|]/ ) {
die \"YAML::Tiny found illegal characters in plain scalar: '$string'"
if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or
$string =~ /:(?:\s|$)/;
$string =~ s/\s+#.*\z//;
return $string;
}
# Error
die \"YAML::Tiny failed to find multi-line scalar content" unless @$lines;
# Check the indent depth
$lines->[0] =~ /^(\s*)/;
$indent->[-1] = length("$1");
if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
# Pull the lines
my @multiline = ();
while ( @$lines ) {
$lines->[0] =~ /^(\s*)/;
last unless length($1) >= $indent->[-1];
push @multiline, substr(shift(@$lines), $indent->[-1]);
}
my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
my $t = (substr($string, 1, 1) eq '-') ? '' : "\n";
return join( $j, @multiline ) . $t;
}
# Load an array
sub _load_array {
my ($self, $array, $indent, $lines) = @_;
while ( @$lines ) {
# Check for a new document
if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
while ( @$lines and $lines->[0] !~ /^---/ ) {
shift @$lines;
}
return 1;
}
# Check the indent level
$lines->[0] =~ /^(\s*)/;
if ( length($1) < $indent->[-1] ) {
return 1;
} elsif ( length($1) > $indent->[-1] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {
# Inline nested hash
my $indent2 = length("$1");
$lines->[0] =~ s/-/ /;
push @$array, { };
$self->_load_hash( $array->[-1], [ @$indent, $indent2 ], $lines );
} elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {
shift @$lines;
unless ( @$lines ) {
push @$array, undef;
return 1;
}
if ( $lines->[0] =~ /^(\s*)\-/ ) {
my $indent2 = length("$1");
if ( $indent->[-1] == $indent2 ) {
# Null array entry
push @$array, undef;
} else {
# Naked indenter
push @$array, [ ];
$self->_load_array(
$array->[-1], [ @$indent, $indent2 ], $lines
);
}
} elsif ( $lines->[0] =~ /^(\s*)\S/ ) {
push @$array, { };
$self->_load_hash(
$array->[-1], [ @$indent, length("$1") ], $lines
);
} else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
} elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {
# Array entry with a value
shift @$lines;
push @$array, $self->_load_scalar(
"$2", [ @$indent, undef ], $lines
);
} elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {
# This is probably a structure like the following...
# ---
# foo:
# - list
# bar: value
#
# ... so lets return and let the hash parser handle it
return 1;
} else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
}
return 1;
}
# Load a hash
sub _load_hash {
my ($self, $hash, $indent, $lines) = @_;
while ( @$lines ) {
# Check for a new document
if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
while ( @$lines and $lines->[0] !~ /^---/ ) {
shift @$lines;
}
return 1;
}
# Check the indent level
$lines->[0] =~ /^(\s*)/;
if ( length($1) < $indent->[-1] ) {
return 1;
} elsif ( length($1) > $indent->[-1] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
# Find the key
my $key;
# Quoted keys
if ( $lines->[0] =~
s/^\s*$re_capture_single_quoted$re_key_value_separator//
) {
$key = $self->_unquote_single($1);
}
elsif ( $lines->[0] =~
s/^\s*$re_capture_double_quoted$re_key_value_separator//
) {
$key = $self->_unquote_double($1);
}
elsif ( $lines->[0] =~
s/^\s*$re_capture_unquoted_key$re_key_value_separator//
) {
$key = $1;
$key =~ s/\s+$//;
}
elsif ( $lines->[0] =~ /^\s*\?/ ) {
die \"YAML::Tiny does not support a feature in line '$lines->[0]'";
}
else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
if ( exists $hash->{$key} ) {
warn "YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'";
}
# Do we have a value?
if ( length $lines->[0] ) {
# Yes
$hash->{$key} = $self->_load_scalar(
shift(@$lines), [ @$indent, undef ], $lines
);
} else {
# An indent
shift @$lines;
unless ( @$lines ) {
$hash->{$key} = undef;
return 1;
}
if ( $lines->[0] =~ /^(\s*)-/ ) {
$hash->{$key} = [];
$self->_load_array(
$hash->{$key}, [ @$indent, length($1) ], $lines
);
} elsif ( $lines->[0] =~ /^(\s*)./ ) {
my $indent2 = length("$1");
if ( $indent->[-1] >= $indent2 ) {
# Null hash entry
$hash->{$key} = undef;
} else {
$hash->{$key} = {};
$self->_load_hash(
$hash->{$key}, [ @$indent, length($1) ], $lines
);
}
}
}
}
return 1;
}
###
# Dumper functions:
# Save an object to a file
sub _dump_file {
my $self = shift;
require Fcntl;
# Check the file
my $file = shift or $self->_error( 'You did not specify a file name' );
my $fh;
# flock if available (or warn if not possible for OS-specific reasons)
if ( _can_flock() ) {
# Open without truncation (truncate comes after lock)
my $flags = Fcntl::O_WRONLY()|Fcntl::O_CREAT();
sysopen( $fh, $file, $flags )
or $self->_error("Failed to open file '$file' for writing: $!");
# Use no translation and strict UTF-8
binmode( $fh, ":raw:encoding(UTF-8)");
flock( $fh, Fcntl::LOCK_EX() )
or warn "Couldn't lock '$file' for reading: $!";
# truncate and spew contents
truncate $fh, 0;
seek $fh, 0, 0;
}
else {
open $fh, ">:unix:encoding(UTF-8)", $file;
}
# serialize and spew to the handle
print {$fh} $self->_dump_string;
# close the file (release the lock)
unless ( close $fh ) {
$self->_error("Failed to close file '$file': $!");
}
return 1;
}
# Save an object to a string
sub _dump_string {
my $self = shift;
return '' unless ref $self && @$self;
# Iterate over the documents
my $indent = 0;
my @lines = ();
eval {
foreach my $cursor ( @$self ) {
push @lines, '---';
# An empty document
if ( ! defined $cursor ) {
# Do nothing
# A scalar document
} elsif ( ! ref $cursor ) {
$lines[-1] .= ' ' . $self->_dump_scalar( $cursor );
# A list at the root
} elsif ( ref $cursor eq 'ARRAY' ) {
unless ( @$cursor ) {
$lines[-1] .= ' []';
next;
}
push @lines, $self->_dump_array( $cursor, $indent, {} );
# A hash at the root
} elsif ( ref $cursor eq 'HASH' ) {
unless ( %$cursor ) {
$lines[-1] .= ' {}';
next;
}
push @lines, $self->_dump_hash( $cursor, $indent, {} );
} else {
die \("Cannot serialize " . ref($cursor));
}
}
};
if ( ref $@ eq 'SCALAR' ) {
$self->_error(${$@});
} elsif ( $@ ) {
$self->_error($@);
}
join '', map { "$_\n" } @lines;
}
sub _has_internal_string_value {
my $value = shift;
my $b_obj = B::svref_2object(\$value); # for round trip problem
return $b_obj->FLAGS & B::SVf_POK();
}
sub _dump_scalar {
my $string = $_[1];
my $is_key = $_[2];
# Check this before checking length or it winds up looking like a string!
my $has_string_flag = _has_internal_string_value($string);
return '~' unless defined $string;
return "''" unless length $string;
if (Scalar::Util::looks_like_number($string)) {
# keys and values that have been used as strings get quoted
if ( $is_key || $has_string_flag ) {
return qq['$string'];
}
else {
return $string;
}
}
if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
$string =~ s/\\/\\\\/g;
$string =~ s/"/\\"/g;
$string =~ s/\n/\\n/g;
$string =~ s/[\x85]/\\N/g;
$string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g;
$string =~ s/([\x7f-\x9f])/'\x' . sprintf("%X",ord($1))/ge;
return qq|"$string"|;
}
if ( $string =~ /(?:^[~!@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or
$QUOTE{$string}
) {
return "'$string'";
}
return $string;
}
sub _dump_array {
my ($self, $array, $indent, $seen) = @_;
if ( $seen->{refaddr($array)}++ ) {
die \"YAML::Tiny does not support circular references";
}
my @lines = ();
foreach my $el ( @$array ) {
my $line = (' ' x $indent) . '-';
my $type = ref $el;
if ( ! $type ) {
$line .= ' ' . $self->_dump_scalar( $el );
push @lines, $line;
} elsif ( $type eq 'ARRAY' ) {
if ( @$el ) {
push @lines, $line;
push @lines, $self->_dump_array( $el, $indent + 1, $seen );
} else {
$line .= ' []';
push @lines, $line;
}
} elsif ( $type eq 'HASH' ) {
if ( keys %$el ) {
push @lines, $line;
push @lines, $self->_dump_hash( $el, $indent + 1, $seen );
} else {
$line .= ' {}';
push @lines, $line;
}
} else {
die \"YAML::Tiny does not support $type references";
}
}
@lines;
}
sub _dump_hash {
my ($self, $hash, $indent, $seen) = @_;
if ( $seen->{refaddr($hash)}++ ) {
die \"YAML::Tiny does not support circular references";
}
my @lines = ();
foreach my $name ( sort keys %$hash ) {
my $el = $hash->{$name};
my $line = (' ' x $indent) . $self->_dump_scalar($name, 1) . ":";
my $type = ref $el;
if ( ! $type ) {
$line .= ' ' . $self->_dump_scalar( $el );
push @lines, $line;
} elsif ( $type eq 'ARRAY' ) {
if ( @$el ) {
push @lines, $line;
push @lines, $self->_dump_array( $el, $indent + 1, $seen );
} else {
$line .= ' []';
push @lines, $line;
}
} elsif ( $type eq 'HASH' ) {
if ( keys %$el ) {
push @lines, $line;
push @lines, $self->_dump_hash( $el, $indent + 1, $seen );
} else {
$line .= ' {}';
push @lines, $line;
}
} else {
die \"YAML::Tiny does not support $type references";
}
}
@lines;
}
#####################################################################
# DEPRECATED API methods:
# Error storage (DEPRECATED as of 1.57)
our $errstr = '';
# Set error
sub _error {
require Carp;
$errstr = $_[1];
$errstr =~ s/ at \S+ line \d+.*//;
Carp::croak( $errstr );
}
# Retrieve error
my $errstr_warned;
sub errstr {
require Carp;
Carp::carp( "YAML::Tiny->errstr and \$YAML::Tiny::errstr is deprecated" )
unless $errstr_warned++;
$errstr;
}
#####################################################################
# Helper functions. Possibly not needed.
# Use to detect nv or iv
use B;
# XXX-INGY Is flock YAML::Tiny's responsibility?
# Some platforms can't flock :-(
# XXX-XDG I think it is. When reading and writing files, we ought
# to be locking whenever possible. People (foolishly) use YAML
# files for things like session storage, which has race issues.
my $HAS_FLOCK;
sub _can_flock {
if ( defined $HAS_FLOCK ) {
return $HAS_FLOCK;
}
else {
require Config;
my $c = \%Config::Config;
$HAS_FLOCK = grep { $c->{$_} } qw/d_flock d_fcntl_can_lock d_lockf/;
require Fcntl if $HAS_FLOCK;
return $HAS_FLOCK;
}
}
# XXX-INGY Is this core in 5.8.1? Can we remove this?
# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this
#####################################################################
# Use Scalar::Util if possible, otherwise emulate it
use Scalar::Util ();
BEGIN {
local $@;
if ( eval { Scalar::Util->VERSION(1.18); } ) {
*refaddr = *Scalar::Util::refaddr;
}
else {
eval <<'END_PERL';
# Scalar::Util failed to load or too old
sub refaddr {
my $pkg = ref($_[0]) or return undef;
if ( !! UNIVERSAL::can($_[0], 'can') ) {
bless $_[0], 'Scalar::Util::Fake';
} else {
$pkg = undef;
}
"$_[0]" =~ /0x(\w+)/;
my $i = do { no warnings 'portable'; hex $1 };
bless $_[0], $pkg if defined $pkg;
$i;
}
END_PERL
}
}
delete $YAML::Tiny::{refaddr};
1;
# XXX-INGY Doc notes I'm putting up here. Changing the doc when it's wrong
# but leaving grey area stuff up here.
#
# I would like to change Read/Write to Load/Dump below without
# changing the actual API names.
#
# It might be better to put Load/Dump API in the SYNOPSIS instead of the
# dubious OO API.
#
# null and bool explanations may be outdated.
__END__
=pod
=head1 NAME
YAML::Tiny - Read/Write YAML files with as little code as possible
=head1 PREAMBLE
The YAML specification is huge. Really, B<really> huge. It contains all the
functionality of XML, except with flexibility and choice, which makes it
easier to read, but with a formal specification that is more complex than
XML.
The original pure-Perl implementation L<YAML> costs just over 4 megabytes
of memory to load. Just like with Windows F<.ini> files (3 meg to load) and
CSS (3.5 meg to load) the situation is just asking for a B<YAML::Tiny>
module, an incomplete but correct and usable subset of the functionality,
in as little code as possible.
Like the other C<::Tiny> modules, YAML::Tiny has no non-core dependencies,
does not require a compiler to install, is back-compatible to Perl v5.8.1,
and can be inlined into other modules if needed.
In exchange for adding this extreme flexibility, it provides support
for only a limited subset of YAML. But the subset supported contains most
of the features for the more common uses of YAML.
=head1 SYNOPSIS
Assuming F<file.yml> like this:
---
rootproperty: blah
section:
one: two
three: four
Foo: Bar
empty: ~
Read and write F<file.yml> like this:
use YAML::Tiny;
# Open the config
my $yaml = YAML::Tiny->read( 'file.yml' );
# Get a reference to the first document
my $config = $yaml->[0];
# Or read properties directly
my $root = $yaml->[0]->{rootproperty};
my $one = $yaml->[0]->{section}->{one};
my $Foo = $yaml->[0]->{section}->{Foo};
# Change data directly
$yaml->[0]->{newsection} = { this => 'that' }; # Add a section
$yaml->[0]->{section}->{Foo} = 'Not Bar!'; # Change a value
delete $yaml->[0]->{section}; # Delete a value
# Save the document back to the file
$yaml->write( 'file.yml' );
To create a new YAML file from scratch:
# Create a new object with a single hashref document
my $yaml = YAML::Tiny->new( { wibble => "wobble" } );
# Add an arrayref document
push @$yaml, [ 'foo', 'bar', 'baz' ];
# Save both documents to a file
$yaml->write( 'data.yml' );
Then F<data.yml> will contain:
---
wibble: wobble
---
- foo
- bar
- baz
=head1 DESCRIPTION
B<YAML::Tiny> is a perl class for reading and writing YAML-style files,
written with as little code as possible, reducing load time and memory
overhead.
Most of the time it is accepted that Perl applications use a lot
of memory and modules. The B<::Tiny> family of modules is specifically
intended to provide an ultralight and zero-dependency alternative to
many more-thorough standard modules.
This module is primarily for reading human-written files (like simple
config files) and generating very simple human-readable files. Note that
I said B<human-readable> and not B<geek-readable>. The sort of files that
your average manager or secretary should be able to look at and make
sense of.
=for stopwords normalise
L<YAML::Tiny> does not generate comments, it won't necessarily preserve the
order of your hashes, and it will normalise if reading in and writing out
again.
It only supports a very basic subset of the full YAML specification.
=for stopwords embeddable
Usage is targeted at files like Perl's META.yml, for which a small and
easily-embeddable module is extremely attractive.
Features will only be added if they are human readable, and can be written
in a few lines of code. Please don't be offended if your request is
refused. Someone has to draw the line, and for YAML::Tiny that someone
is me.
If you need something with more power move up to L<YAML> (7 megabytes of
memory overhead) or L<YAML::XS> (6 megabytes memory overhead and requires
a C compiler).
To restate, L<YAML::Tiny> does B<not> preserve your comments, whitespace,
or the order of your YAML data. But it should round-trip from Perl
structure to file and back again just fine.
=head1 METHODS
=for Pod::Coverage HAVE_UTF8 refaddr
=head2 new
The constructor C<new> creates a C<YAML::Tiny> object as a blessed array
reference. Any arguments provided are taken as separate documents
to be serialized.
=head2 read $filename
The C<read> constructor reads a YAML file from a file name,
and returns a new C<YAML::Tiny> object containing the parsed content.
Returns the object on success or throws an error on failure.
=head2 read_string $string;
The C<read_string> constructor reads YAML data from a character string, and
returns a new C<YAML::Tiny> object containing the parsed content. If you have
read the string from a file yourself, be sure that you have correctly decoded
it into characters first.
Returns the object on success or throws an error on failure.
=head2 write $filename
The C<write> method generates the file content for the properties, and
writes it to disk using UTF-8 encoding to the filename specified.
Returns true on success or throws an error on failure.
=head2 write_string
Generates the file content for the object and returns it as a character
string. This may contain non-ASCII characters and should be encoded
before writing it to a file.
Returns true on success or throws an error on failure.
=for stopwords errstr
=head2 errstr (DEPRECATED)
Prior to version 1.57, some errors were fatal and others were available only
via the C<$YAML::Tiny::errstr> variable, which could be accessed via the
C<errstr()> method.
Starting with version 1.57, all errors are fatal and throw exceptions.
The C<$errstr> variable is still set when exceptions are thrown, but
C<$errstr> and the C<errstr()> method are deprecated and may be removed in a
future release. The first use of C<errstr()> will issue a deprecation
warning.
=head1 FUNCTIONS
YAML::Tiny implements a number of functions to add compatibility with
the L<YAML> API. These should be a drop-in replacement.
=head2 Dump
my $string = Dump(list-of-Perl-data-structures);
Turn Perl data into YAML. This function works very much like
Data::Dumper::Dumper().
It takes a list of Perl data structures and dumps them into a serialized
form.
It returns a character string containing the YAML stream. Be sure to encode
it as UTF-8 before serializing to a file or socket.
The structures can be references or plain scalars.
Dies on any error.
=head2 Load
my @data_structures = Load(string-containing-a-YAML-stream);
Turn YAML into Perl data. This is the opposite of Dump.
Just like L<Storable>'s thaw() function or the eval() function in relation
to L<Data::Dumper>.
It parses a character string containing a valid YAML stream into a list of
Perl data structures representing the individual YAML documents. Be sure to
decode the character string correctly if the string came from a file or
socket.
my $last_data_structure = Load(string-containing-a-YAML-stream);
For consistency with YAML.pm, when Load is called in scalar context, it
returns the data structure corresponding to the last of the YAML documents
found in the input stream.
Dies on any error.
=head2 freeze() and thaw()
Aliases to Dump() and Load() for L<Storable> fans. This will also allow
YAML::Tiny to be plugged directly into modules like POE.pm, that use the
freeze/thaw API for internal serialization.
=head2 DumpFile(filepath, list)
Writes the YAML stream to a file with UTF-8 encoding instead of just
returning a string.
Dies on any error.
=head2 LoadFile(filepath)
Reads the YAML stream from a UTF-8 encoded file instead of a string.
Dies on any error.
=head1 YAML TINY SPECIFICATION
This section of the documentation provides a specification for "YAML Tiny",
a subset of the YAML specification.
It is based on and described comparatively to the YAML 1.1 Working Draft
2004-12-28 specification, located at L<http://yaml.org/spec/current.html>.
Terminology and chapter numbers are based on that specification.
=head2 1. Introduction and Goals
The purpose of the YAML Tiny specification is to describe a useful subset
of the YAML specification that can be used for typical document-oriented
use cases such as configuration files and simple data structure dumps.
=for stopwords extensibility
Many specification elements that add flexibility or extensibility are
intentionally removed, as is support for complex data structures, class
and object-orientation.
In general, the YAML Tiny language targets only those data structures
available in JSON, with the additional limitation that only simple keys
are supported.
As a result, all possible YAML Tiny documents should be able to be
transformed into an equivalent JSON document, although the reverse is
not necessarily true (but will be true in simple cases).
=for stopwords PCRE
As a result of these simplifications the YAML Tiny specification should
be implementable in a (relatively) small amount of code in any language
that supports Perl Compatible Regular Expressions (PCRE).
=head2 2. Introduction
YAML Tiny supports three data structures. These are scalars (in a variety
of forms), block-form sequences and block-form mappings. Flow-style
sequences and mappings are not supported, with some minor exceptions
detailed later.
The use of three dashes "---" to indicate the start of a new document is
supported, and multiple documents per file/stream is allowed.
Both line and inline comments are supported.
Scalars are supported via the plain style, single quote and double quote,
as well as literal-style and folded-style multi-line scalars.
The use of explicit tags is not supported.
The use of "null" type scalars is supported via the ~ character.
The use of "bool" type scalars is not supported.
=for stopwords serializer
However, serializer implementations should take care to explicitly escape
strings that match a "bool" keyword in the following set to prevent other
implementations that do support "bool" accidentally reading a string as a
boolean
y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF
The use of anchors and aliases is not supported.
The use of directives is supported only for the %YAML directive.
=head2 3. Processing YAML Tiny Information
B<Processes>
=for stopwords deserialization
The YAML specification dictates three-phase serialization and three-phase
deserialization.
The YAML Tiny specification does not mandate any particular methodology
or mechanism for parsing.
Any compliant parser is only required to parse a single document at a
time. The ability to support streaming documents is optional and most
likely non-typical.
=for stopwords acyclic
Because anchors and aliases are not supported, the resulting representation
graph is thus directed but (unlike the main YAML specification) B<acyclic>.
Circular references/pointers are not possible, and any YAML Tiny serializer
detecting a circular reference should error with an appropriate message.
B<Presentation Stream>
=for stopwords unicode
YAML Tiny reads and write UTF-8 encoded files. Operations on strings expect
or produce Unicode characters not UTF-8 encoded bytes.
B<Loading Failure Points>
=for stopwords modality
=for stopwords parsers
YAML Tiny parsers and emitters are not expected to recover from, or
adapt to, errors. The specific error modality of any implementation is
not dictated (return codes, exceptions, etc.) but is expected to be
consistent.
=head2 4. Syntax
B<Character Set>
YAML Tiny streams are processed in memory as Unicode characters and
read/written with UTF-8 encoding.
The escaping and unescaping of the 8-bit YAML escapes is required.
The escaping and unescaping of 16-bit and 32-bit YAML escapes is not
required.
B<Indicator Characters>
Support for the "~" null/undefined indicator is required.
Implementations may represent this as appropriate for the underlying
language.
Support for the "-" block sequence indicator is required.
Support for the "?" mapping key indicator is B<not> required.
Support for the ":" mapping value indicator is required.
Support for the "," flow collection indicator is B<not> required.
Support for the "[" flow sequence indicator is B<not> required, with
one exception (detailed below).
Support for the "]" flow sequence indicator is B<not> required, with
one exception (detailed below).
Support for the "{" flow mapping indicator is B<not> required, with
one exception (detailed below).
Support for the "}" flow mapping indicator is B<not> required, with
one exception (detailed below).
Support for the "#" comment indicator is required.
Support for the "&" anchor indicator is B<not> required.
Support for the "*" alias indicator is B<not> required.
Support for the "!" tag indicator is B<not> required.
Support for the "|" literal block indicator is required.
Support for the ">" folded block indicator is required.
Support for the "'" single quote indicator is required.
Support for the """ double quote indicator is required.
Support for the "%" directive indicator is required, but only
for the special case of a %YAML version directive before the
"---" document header, or on the same line as the document header.
For example:
%YAML 1.1
---
- A sequence with a single element
Special Exception:
To provide the ability to support empty sequences
and mappings, support for the constructs [] (empty sequence) and {}
(empty mapping) are required.
For example,
%YAML 1.1
# A document consisting of only an empty mapping
--- {}
# A document consisting of only an empty sequence
--- []
# A document consisting of an empty mapping within a sequence
- foo
- {}
- bar
B<Syntax Primitives>
Other than the empty sequence and mapping cases described above, YAML Tiny
supports only the indentation-based block-style group of contexts.
All five scalar contexts are supported.
Indentation spaces work as per the YAML specification in all cases.
Comments work as per the YAML specification in all simple cases.
Support for indented multi-line comments is B<not> required.
Separation spaces work as per the YAML specification in all cases.
B<YAML Tiny Character Stream>
The only directive supported by the YAML Tiny specification is the
%YAML language/version identifier. Although detected, this directive
will have no control over the parsing itself.
=for stopwords recognise
The parser must recognise both the YAML 1.0 and YAML 1.1+ formatting
of this directive (as well as the commented form, although no explicit
code should be needed to deal with this case, being a comment anyway)
That is, all of the following should be supported.
--- #YAML:1.0
- foo
%YAML:1.0
---
- foo
% YAML 1.1
---
- foo
Support for the %TAG directive is B<not> required.
Support for additional directives is B<not> required.
Support for the document boundary marker "---" is required.
Support for the document boundary market "..." is B<not> required.
If necessary, a document boundary should simply by indicated with a
"---" marker, with not preceding "..." marker.
Support for empty streams (containing no documents) is required.
Support for implicit document starts is required.
That is, the following must be equivalent.
# Full form
%YAML 1.1
---
foo: bar
# Implicit form
foo: bar
B<Nodes>
Support for nodes optional anchor and tag properties is B<not> required.
Support for node anchors is B<not> required.
Support for node tags is B<not> required.
Support for alias nodes is B<not> required.
Support for flow nodes is B<not> required.
Support for block nodes is required.
B<Scalar Styles>
Support for all five scalar styles is required as per the YAML
specification, although support for quoted scalars spanning more
than one line is B<not> required.
Support for multi-line scalar documents starting on the header
is not required.
Support for the chomping indicators on multi-line scalar styles
is required.
B<Collection Styles>
Support for block-style sequences is required.
Support for flow-style sequences is B<not> required.
Support for block-style mappings is required.
Support for flow-style mappings is B<not> required.
Both sequences and mappings should be able to be arbitrarily
nested.
Support for plain-style mapping keys is required.
Support for quoted keys in mappings is B<not> required.
Support for "?"-indicated explicit keys is B<not> required.
=for stopwords endeth
Here endeth the specification.
=head2 Additional Perl-Specific Notes
For some Perl applications, it's important to know if you really have a
number and not a string.
That is, in some contexts is important that 3 the number is distinctive
from "3" the string.
Because even Perl itself is not trivially able to understand the difference
(certainly without XS-based modules) Perl implementations of the YAML Tiny
specification are not required to retain the distinctiveness of 3 vs "3".
=head1 SUPPORT
Bugs should be reported via the CPAN bug tracker at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=YAML-Tiny>
=begin html
For other issues, or commercial enhancement or support, please contact
<a href="http://ali.as/">Adam Kennedy</a> directly.
=end html
=head1 AUTHOR
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
=head1 SEE ALSO
=over 4
=item * L<YAML>
=item * L<YAML::Syck>
=item * L<Config::Tiny>
=item * L<CSS::Tiny>
=item * L<http://use.perl.org/use.perl.org/_Alias/journal/29427.html>
=item * L<http://ali.as/>
=back
=head1 COPYRIGHT
Copyright 2006 - 2013 Adam Kennedy.
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the
LICENSE file included with this module.
=cut
| 28.659704 | 88 | 0.59392 |
ed0d3e4c4f2c2155bf5ea40a95a78edd42c8e451 | 409 | pm | Perl | auto-lib/Paws/GameLift/DescribeBuildOutput.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 164 | 2015-01-08T14:58:53.000Z | 2022-02-20T19:16:24.000Z | auto-lib/Paws/GameLift/DescribeBuildOutput.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 348 | 2015-01-07T22:08:38.000Z | 2022-01-27T14:34:44.000Z | auto-lib/Paws/GameLift/DescribeBuildOutput.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 87 | 2015-04-22T06:29:47.000Z | 2021-09-29T14:45:55.000Z |
package Paws::GameLift::DescribeBuildOutput;
use Moose;
has Build => (is => 'ro', isa => 'Paws::GameLift::Build');
has _request_id => (is => 'ro', isa => 'Str');
### main pod documentation begin ###
=head1 NAME
Paws::GameLift::DescribeBuildOutput
=head1 ATTRIBUTES
=head2 Build => L<Paws::GameLift::Build>
Set of properties describing the requested build.
=head2 _request_id => Str
=cut
1; | 15.148148 | 60 | 0.672372 |
73d3e71b328f9acace54408284ae84526d5288ef | 41,769 | pm | Perl | KOST-Val/src/main/resources_notJar/resources/ExifTool-10.15/Perl/site/lib/LWP/UserAgent.pm | rebplu/KOST-VAL | 1537125425068d5faec3bc4f5263df715956ae76 | [
"BSD-3-Clause-No-Nuclear-Warranty"
]
| null | null | null | KOST-Val/src/main/resources_notJar/resources/ExifTool-10.15/Perl/site/lib/LWP/UserAgent.pm | rebplu/KOST-VAL | 1537125425068d5faec3bc4f5263df715956ae76 | [
"BSD-3-Clause-No-Nuclear-Warranty"
]
| null | null | null | KOST-Val/src/main/resources_notJar/resources/ExifTool-10.15/Perl/site/lib/LWP/UserAgent.pm | rebplu/KOST-VAL | 1537125425068d5faec3bc4f5263df715956ae76 | [
"BSD-3-Clause-No-Nuclear-Warranty"
]
| null | null | null | package LWP::UserAgent;
# $Id: UserAgent.pm,v 2.31 2004/04/10 11:26:14 gisle Exp $
use strict;
use vars qw(@ISA $VERSION);
require LWP::MemberMixin;
@ISA = qw(LWP::MemberMixin);
$VERSION = sprintf("%d.%03d", q$Revision: 2.31 $ =~ /(\d+)\.(\d+)/);
use HTTP::Request ();
use HTTP::Response ();
use HTTP::Date ();
use LWP ();
use LWP::Debug ();
use LWP::Protocol ();
use Carp ();
if ($ENV{PERL_LWP_USE_HTTP_10}) {
require LWP::Protocol::http10;
LWP::Protocol::implementor('http', 'LWP::Protocol::http10');
eval {
require LWP::Protocol::https10;
LWP::Protocol::implementor('https', 'LWP::Protocol::https10');
};
}
sub new
{
my($class, %cnf) = @_;
LWP::Debug::trace('()');
my $agent = delete $cnf{agent};
$agent = $class->_agent unless defined $agent;
my $from = delete $cnf{from};
my $timeout = delete $cnf{timeout};
$timeout = 3*60 unless defined $timeout;
my $use_eval = delete $cnf{use_eval};
$use_eval = 1 unless defined $use_eval;
my $parse_head = delete $cnf{parse_head};
$parse_head = 1 unless defined $parse_head;
my $max_size = delete $cnf{max_size};
my $max_redirect = delete $cnf{max_redirect};
$max_redirect = 7 unless defined $max_redirect;
my $env_proxy = delete $cnf{env_proxy};
my $cookie_jar = delete $cnf{cookie_jar};
my $conn_cache = delete $cnf{conn_cache};
my $keep_alive = delete $cnf{keep_alive};
Carp::croak("Can't mix conn_cache and keep_alive")
if $conn_cache && $keep_alive;
my $protocols_allowed = delete $cnf{protocols_allowed};
my $protocols_forbidden = delete $cnf{protocols_forbidden};
my $requests_redirectable = delete $cnf{requests_redirectable};
$requests_redirectable = ['GET', 'HEAD']
unless defined $requests_redirectable;
# Actually ""s are just as good as 0's, but for concision we'll just say:
Carp::croak("protocols_allowed has to be an arrayref or 0, not \"$protocols_allowed\"!")
if $protocols_allowed and ref($protocols_allowed) ne 'ARRAY';
Carp::croak("protocols_forbidden has to be an arrayref or 0, not \"$protocols_forbidden\"!")
if $protocols_forbidden and ref($protocols_forbidden) ne 'ARRAY';
Carp::croak("requests_redirectable has to be an arrayref or 0, not \"$requests_redirectable\"!")
if $requests_redirectable and ref($requests_redirectable) ne 'ARRAY';
if (%cnf && $^W) {
Carp::carp("Unrecognized LWP::UserAgent options: @{[sort keys %cnf]}");
}
my $self = bless {
from => $from,
timeout => $timeout,
use_eval => $use_eval,
parse_head => $parse_head,
max_size => $max_size,
max_redirect => $max_redirect,
proxy => undef,
no_proxy => [],
protocols_allowed => $protocols_allowed,
protocols_forbidden => $protocols_forbidden,
requests_redirectable => $requests_redirectable,
}, $class;
$self->agent($agent) if $agent;
$self->cookie_jar($cookie_jar) if $cookie_jar;
$self->env_proxy if $env_proxy;
$self->protocols_allowed( $protocols_allowed ) if $protocols_allowed;
$self->protocols_forbidden($protocols_forbidden) if $protocols_forbidden;
if ($keep_alive) {
$conn_cache ||= { total_capacity => $keep_alive };
}
$self->conn_cache($conn_cache) if $conn_cache;
return $self;
}
# private method. check sanity of given $request
sub _request_sanity_check {
my($self, $request) = @_;
# some sanity checking
if (defined $request) {
if (ref $request) {
Carp::croak("You need a request object, not a " . ref($request) . " object")
if ref($request) eq 'ARRAY' or ref($request) eq 'HASH' or
!$request->can('method') or !$request->can('uri');
}
else {
Carp::croak("You need a request object, not '$request'");
}
}
else {
Carp::croak("No request object passed in");
}
}
sub send_request
{
my($self, $request, $arg, $size) = @_;
$self->_request_sanity_check($request);
my($method, $url) = ($request->method, $request->uri);
local($SIG{__DIE__}); # protect against user defined die handlers
# Check that we have a METHOD and a URL first
return _new_response($request, &HTTP::Status::RC_BAD_REQUEST, "Method missing")
unless $method;
return _new_response($request, &HTTP::Status::RC_BAD_REQUEST, "URL missing")
unless $url;
return _new_response($request, &HTTP::Status::RC_BAD_REQUEST, "URL must be absolute")
unless $url->scheme;
LWP::Debug::trace("$method $url");
# Locate protocol to use
my $scheme = '';
my $proxy = $self->_need_proxy($url);
if (defined $proxy) {
$scheme = $proxy->scheme;
}
else {
$scheme = $url->scheme;
}
my $protocol;
{
# Honor object-specific restrictions by forcing protocol objects
# into class LWP::Protocol::nogo.
my $x;
if($x = $self->protocols_allowed) {
if(grep lc($_) eq $scheme, @$x) {
LWP::Debug::trace("$scheme URLs are among $self\'s allowed protocols (@$x)");
}
else {
LWP::Debug::trace("$scheme URLs aren't among $self\'s allowed protocols (@$x)");
require LWP::Protocol::nogo;
$protocol = LWP::Protocol::nogo->new;
}
}
elsif ($x = $self->protocols_forbidden) {
if(grep lc($_) eq $scheme, @$x) {
LWP::Debug::trace("$scheme URLs are among $self\'s forbidden protocols (@$x)");
require LWP::Protocol::nogo;
$protocol = LWP::Protocol::nogo->new;
}
else {
LWP::Debug::trace("$scheme URLs aren't among $self\'s forbidden protocols (@$x)");
}
}
# else fall thru and create the protocol object normally
}
unless($protocol) {
$protocol = eval { LWP::Protocol::create($scheme, $self) };
if ($@) {
$@ =~ s/ at .* line \d+.*//s; # remove file/line number
my $response = _new_response($request, &HTTP::Status::RC_NOT_IMPLEMENTED, $@);
if ($scheme eq "https") {
$response->message($response->message . " (Crypt::SSLeay not installed)");
$response->content_type("text/plain");
$response->content(<<EOT);
LWP will support https URLs if the Crypt::SSLeay module is installed.
More information at <http://www.linpro.no/lwp/libwww-perl/README.SSL>.
EOT
}
return $response;
}
}
# Extract fields that will be used below
my ($timeout, $cookie_jar, $use_eval, $parse_head, $max_size) =
@{$self}{qw(timeout cookie_jar use_eval parse_head max_size)};
my $response;
if ($use_eval) {
# we eval, and turn dies into responses below
eval {
$response = $protocol->request($request, $proxy,
$arg, $size, $timeout);
};
if ($@) {
$@ =~ s/ at .* line \d+.*//s; # remove file/line number
$response = _new_response($request,
&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
$@);
}
}
else {
$response = $protocol->request($request, $proxy,
$arg, $size, $timeout);
# XXX: Should we die unless $response->is_success ???
}
$response->request($request); # record request for reference
$cookie_jar->extract_cookies($response) if $cookie_jar;
$response->header("Client-Date" => HTTP::Date::time2str(time));
return $response;
}
sub prepare_request
{
my($self, $request) = @_;
$self->_request_sanity_check($request);
# Extract fields that will be used below
my ($agent, $from, $cookie_jar, $max_size) =
@{$self}{qw(agent from cookie_jar max_size)};
# Set User-Agent and From headers if they are defined
$request->init_header('User-Agent' => $agent) if $agent;
$request->init_header('From' => $from) if $from;
if (defined $max_size) {
my $last = $max_size - 1;
$last = 0 if $last < 0; # there is no way to actually request no content
$request->init_header('Range' => "bytes=0-$last");
}
$cookie_jar->add_cookie_header($request) if $cookie_jar;
return($request);
}
sub simple_request
{
my($self, $request, $arg, $size) = @_;
$self->_request_sanity_check($request);
my $new_request = $self->prepare_request($request);
return($self->send_request($new_request, $arg, $size));
}
sub request
{
my($self, $request, $arg, $size, $previous) = @_;
LWP::Debug::trace('()');
my $response = $self->simple_request($request, $arg, $size);
my $code = $response->code;
$response->previous($previous) if defined $previous;
LWP::Debug::debug('Simple response: ' .
(HTTP::Status::status_message($code) ||
"Unknown code $code"));
if ($code == &HTTP::Status::RC_MOVED_PERMANENTLY or
$code == &HTTP::Status::RC_FOUND or
$code == &HTTP::Status::RC_SEE_OTHER or
$code == &HTTP::Status::RC_TEMPORARY_REDIRECT)
{
my $referral = $request->clone;
# These headers should never be forwarded
$referral->remove_header('Host', 'Cookie');
if ($referral->header('Referer') &&
$request->url->scheme eq 'https' &&
$referral->url->scheme eq 'http')
{
# RFC 2616, section 15.1.3.
LWP::Debug::trace("https -> http redirect, suppressing Referer");
$referral->remove_header('Referer');
}
if ($code == &HTTP::Status::RC_SEE_OTHER ||
$code == &HTTP::Status::RC_FOUND)
{
my $method = uc($referral->method);
unless ($method eq "GET" || $method eq "HEAD") {
$referral->method("GET");
$referral->content("");
$referral->remove_content_headers;
}
}
# And then we update the URL based on the Location:-header.
my $referral_uri = $response->header('Location');
{
# Some servers erroneously return a relative URL for redirects,
# so make it absolute if it not already is.
local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
my $base = $response->base;
$referral_uri = "" unless defined $referral_uri;
$referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
->abs($base);
}
$referral->url($referral_uri);
# Check for loop in the redirects, we only count
my $count = 0;
my $r = $response;
while ($r) {
if (++$count > $self->{max_redirect}) {
$response->header("Client-Warning" =>
"Redirect loop detected (max_redirect = $self->{max_redirect})");
return $response;
}
$r = $r->previous;
}
return $response unless $self->redirect_ok($referral, $response);
return $self->request($referral, $arg, $size, $response);
}
elsif ($code == &HTTP::Status::RC_UNAUTHORIZED ||
$code == &HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED
)
{
my $proxy = ($code == &HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED);
my $ch_header = $proxy ? "Proxy-Authenticate" : "WWW-Authenticate";
my @challenge = $response->header($ch_header);
unless (@challenge) {
$response->header("Client-Warning" =>
"Missing Authenticate header");
return $response;
}
require HTTP::Headers::Util;
CHALLENGE: for my $challenge (@challenge) {
$challenge =~ tr/,/;/; # "," is used to separate auth-params!!
($challenge) = HTTP::Headers::Util::split_header_words($challenge);
my $scheme = lc(shift(@$challenge));
shift(@$challenge); # no value
$challenge = { @$challenge }; # make rest into a hash
for (keys %$challenge) { # make sure all keys are lower case
$challenge->{lc $_} = delete $challenge->{$_};
}
unless ($scheme =~ /^([a-z]+(?:-[a-z]+)*)$/) {
$response->header("Client-Warning" =>
"Bad authentication scheme '$scheme'");
return $response;
}
$scheme = $1; # untainted now
my $class = "LWP::Authen::\u$scheme";
$class =~ s/-/_/g;
no strict 'refs';
unless (%{"$class\::"}) {
# try to load it
eval "require $class";
if ($@) {
if ($@ =~ /^Can\'t locate/) {
$response->header("Client-Warning" =>
"Unsupported authentication scheme '$scheme'");
}
else {
$response->header("Client-Warning" => $@);
}
next CHALLENGE;
}
}
unless ($class->can("authenticate")) {
$response->header("Client-Warning" =>
"Unsupported authentication scheme '$scheme'");
next CHALLENGE;
}
return $class->authenticate($self, $proxy, $challenge, $response,
$request, $arg, $size);
}
return $response;
}
return $response;
}
#
# Now the shortcuts...
#
sub get {
require HTTP::Request::Common;
my($self, @parameters) = @_;
my @suff = $self->_process_colonic_headers(\@parameters,1);
return $self->request( HTTP::Request::Common::GET( @parameters ), @suff );
}
sub post {
require HTTP::Request::Common;
my($self, @parameters) = @_;
my @suff = $self->_process_colonic_headers(\@parameters,2);
return $self->request( HTTP::Request::Common::POST( @parameters ), @suff );
}
sub head {
require HTTP::Request::Common;
my($self, @parameters) = @_;
my @suff = $self->_process_colonic_headers(\@parameters,1);
return $self->request( HTTP::Request::Common::HEAD( @parameters ), @suff );
}
sub _process_colonic_headers {
# Process :content_cb / :content_file / :read_size_hint headers.
my($self, $args, $start_index) = @_;
my($arg, $size);
for(my $i = $start_index; $i < @$args; $i += 2) {
next unless defined $args->[$i];
#printf "Considering %s => %s\n", $args->[$i], $args->[$i + 1];
if($args->[$i] eq ':content_cb') {
# Some sanity-checking...
$arg = $args->[$i + 1];
Carp::croak("A :content_cb value can't be undef") unless defined $arg;
Carp::croak("A :content_cb value must be a coderef")
unless ref $arg and UNIVERSAL::isa($arg, 'CODE');
}
elsif ($args->[$i] eq ':content_file') {
$arg = $args->[$i + 1];
# Some sanity-checking...
Carp::croak("A :content_file value can't be undef")
unless defined $arg;
Carp::croak("A :content_file value can't be a reference")
if ref $arg;
Carp::croak("A :content_file value can't be \"\"")
unless length $arg;
}
elsif ($args->[$i] eq ':read_size_hint') {
$size = $args->[$i + 1];
# Bother checking it?
}
else {
next;
}
splice @$args, $i, 2;
$i -= 2;
}
# And return a suitable suffix-list for request(REQ,...)
return unless defined $arg;
return $arg, $size if defined $size;
return $arg;
}
#
# This whole allow/forbid thing is based on man 1 at's way of doing things.
#
sub is_protocol_supported
{
my($self, $scheme) = @_;
if (ref $scheme) {
# assume we got a reference to an URI object
$scheme = $scheme->scheme;
}
else {
Carp::croak("Illegal scheme '$scheme' passed to is_protocol_supported")
if $scheme =~ /\W/;
$scheme = lc $scheme;
}
my $x;
if(ref($self) and $x = $self->protocols_allowed) {
return 0 unless grep lc($_) eq $scheme, @$x;
}
elsif (ref($self) and $x = $self->protocols_forbidden) {
return 0 if grep lc($_) eq $scheme, @$x;
}
local($SIG{__DIE__}); # protect against user defined die handlers
$x = LWP::Protocol::implementor($scheme);
return 1 if $x and $x ne 'LWP::Protocol::nogo';
return 0;
}
sub protocols_allowed { shift->_elem('protocols_allowed' , @_) }
sub protocols_forbidden { shift->_elem('protocols_forbidden' , @_) }
sub requests_redirectable { shift->_elem('requests_redirectable', @_) }
sub redirect_ok
{
# RFC 2616, section 10.3.2 and 10.3.3 say:
# If the 30[12] status code is received in response to a request other
# than GET or HEAD, the user agent MUST NOT automatically redirect the
# request unless it can be confirmed by the user, since this might
# change the conditions under which the request was issued.
# Note that this routine used to be just:
# return 0 if $_[1]->method eq "POST"; return 1;
my($self, $new_request, $response) = @_;
my $method = $response->request->method;
return 0 unless grep $_ eq $method,
@{ $self->requests_redirectable || [] };
if ($new_request->url->scheme eq 'file') {
$response->header("Client-Warning" =>
"Can't redirect to a file:// URL!");
return 0;
}
# Otherwise it's apparently okay...
return 1;
}
sub credentials
{
my($self, $netloc, $realm, $uid, $pass) = @_;
@{ $self->{'basic_authentication'}{lc($netloc)}{$realm} } =
($uid, $pass);
}
sub get_basic_credentials
{
my($self, $realm, $uri, $proxy) = @_;
return if $proxy;
my $host_port = lc($uri->host_port);
if (exists $self->{'basic_authentication'}{$host_port}{$realm}) {
return @{ $self->{'basic_authentication'}{$host_port}{$realm} };
}
return (undef, undef);
}
sub agent {
my $self = shift;
my $old = $self->{agent};
if (@_) {
my $agent = shift;
$agent .= $self->_agent if $agent && $agent =~ /\s+$/;
$self->{agent} = $agent;
}
$old;
}
sub _agent { "libwww-perl/$LWP::VERSION" }
sub timeout { shift->_elem('timeout', @_); }
sub from { shift->_elem('from', @_); }
sub parse_head { shift->_elem('parse_head', @_); }
sub max_size { shift->_elem('max_size', @_); }
sub max_redirect { shift->_elem('max_redirect', @_); }
sub cookie_jar {
my $self = shift;
my $old = $self->{cookie_jar};
if (@_) {
my $jar = shift;
if (ref($jar) eq "HASH") {
require HTTP::Cookies;
$jar = HTTP::Cookies->new(%$jar);
}
$self->{cookie_jar} = $jar;
}
$old;
}
sub conn_cache {
my $self = shift;
my $old = $self->{conn_cache};
if (@_) {
my $cache = shift;
if (ref($cache) eq "HASH") {
require LWP::ConnCache;
$cache = LWP::ConnCache->new(%$cache);
}
$self->{conn_cache} = $cache;
}
$old;
}
# depreciated
sub use_eval { shift->_elem('use_eval', @_); }
sub use_alarm
{
Carp::carp("LWP::UserAgent->use_alarm(BOOL) is a no-op")
if @_ > 1 && $^W;
"";
}
sub clone
{
my $self = shift;
my $copy = bless { %$self }, ref $self; # copy most fields
# elements that are references must be handled in a special way
$copy->{'proxy'} = { %{$self->{'proxy'}} };
$copy->{'no_proxy'} = [ @{$self->{'no_proxy'}} ]; # copy array
# remove reference to objects for now
delete $copy->{cookie_jar};
delete $copy->{conn_cache};
$copy;
}
sub mirror
{
my($self, $url, $file) = @_;
LWP::Debug::trace('()');
my $request = HTTP::Request->new('GET', $url);
if (-e $file) {
my($mtime) = (stat($file))[9];
if($mtime) {
$request->header('If-Modified-Since' =>
HTTP::Date::time2str($mtime));
}
}
my $tmpfile = "$file-$$";
my $response = $self->request($request, $tmpfile);
if ($response->is_success) {
my $file_length = (stat($tmpfile))[7];
my($content_length) = $response->header('Content-length');
if (defined $content_length and $file_length < $content_length) {
unlink($tmpfile);
die "Transfer truncated: " .
"only $file_length out of $content_length bytes received\n";
}
elsif (defined $content_length and $file_length > $content_length) {
unlink($tmpfile);
die "Content-length mismatch: " .
"expected $content_length bytes, got $file_length\n";
}
else {
# OK
if (-e $file) {
# Some dosish systems fail to rename if the target exists
chmod 0777, $file;
unlink $file;
}
rename($tmpfile, $file) or
die "Cannot rename '$tmpfile' to '$file': $!\n";
if (my $lm = $response->last_modified) {
# make sure the file has the same last modification time
utime $lm, $lm, $file;
}
}
}
else {
unlink($tmpfile);
}
return $response;
}
sub proxy
{
my $self = shift;
my $key = shift;
LWP::Debug::trace("$key @_");
return map $self->proxy($_, @_), @$key if ref $key;
my $old = $self->{'proxy'}{$key};
$self->{'proxy'}{$key} = shift if @_;
return $old;
}
sub env_proxy {
my ($self) = @_;
my($k,$v);
while(($k, $v) = each %ENV) {
if ($ENV{REQUEST_METHOD}) {
# Need to be careful when called in the CGI environment, as
# the HTTP_PROXY variable is under control of that other guy.
next if $k =~ /^HTTP_/;
$k = "HTTP_PROXY" if $k eq "CGI_HTTP_PROXY";
}
$k = lc($k);
next unless $k =~ /^(.*)_proxy$/;
$k = $1;
if ($k eq 'no') {
$self->no_proxy(split(/\s*,\s*/, $v));
}
else {
$self->proxy($k, $v);
}
}
}
sub no_proxy {
my($self, @no) = @_;
if (@no) {
push(@{ $self->{'no_proxy'} }, @no);
}
else {
$self->{'no_proxy'} = [];
}
}
# Private method which returns the URL of the Proxy configured for this
# URL, or undefined if none is configured.
sub _need_proxy
{
my($self, $url) = @_;
$url = $HTTP::URI_CLASS->new($url) unless ref $url;
my $scheme = $url->scheme || return;
if (my $proxy = $self->{'proxy'}{$scheme}) {
if (@{ $self->{'no_proxy'} }) {
if (my $host = eval { $url->host }) {
for my $domain (@{ $self->{'no_proxy'} }) {
if ($host =~ /\Q$domain\E$/) {
LWP::Debug::trace("no_proxy configured");
return;
}
}
}
}
LWP::Debug::debug("Proxied to $proxy");
return $HTTP::URI_CLASS->new($proxy);
}
LWP::Debug::debug('Not proxied');
undef;
}
sub _new_response {
my($request, $code, $message) = @_;
my $response = HTTP::Response->new($code, $message);
$response->request($request);
$response->header("Client-Date" => HTTP::Date::time2str(time));
$response->header("Client-Warning" => "Internal response");
$response->header("Content-Type" => "text/plain");
$response->content("$code $message\n");
return $response;
}
1;
__END__
=head1 NAME
LWP::UserAgent - Web user agent class
=head1 SYNOPSIS
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
my $response = $ua->get('http://search.cpan.org/');
if ($response->is_success) {
print $response->content; # or whatever
}
else {
die $response->status_line;
}
=head1 DESCRIPTION
The C<LWP::UserAgent> is a class implementing a web user agent.
C<LWP::UserAgent> objects can be used to dispatch web requests.
In normal use the application creates an C<LWP::UserAgent> object, and
then configures it with values for timeouts, proxies, name, etc. It
then creates an instance of C<HTTP::Request> for the request that
needs to be performed. This request is then passed to one of the
request method the UserAgent, which dispatches it using the relevant
protocol, and returns a C<HTTP::Response> object. There are
convenience methods for sending the most common request types: get(),
head() and post(). When using these methods then the creation of the
request object is hidden as shown in the synopsis above.
The basic approach of the library is to use HTTP style communication
for all protocol schemes. This means that you will construct
C<HTTP::Request> objects and receive C<HTTP::Response> objects even
for non-HTTP resources like I<gopher> and I<ftp>. In order to achieve
even more similarity to HTTP style communications, gopher menus and
file directories are converted to HTML documents.
=head1 CONSTRUCTOR METHODS
The following constructor methods are available:
=over 4
=item $ua = LWP::UserAgent->new( %options )
This method constructs a new C<LWP::UserAgent> object and returns it.
Key/value pair arguments may be provided to set up the initial state.
The following options correspond to attribute methods described below:
KEY DEFAULT
----------- --------------------
agent "libwww-perl/#.##"
from undef
conn_cache undef
cookie_jar undef
max_size undef
max_redirect 7
parse_head 1
protocols_allowed undef
protocols_forbidden undef
requests_redirectable ['GET', 'HEAD']
timeout 180
The following additional options are also accepted: If the
C<env_proxy> option is passed in with a TRUE value, then proxy
settings are read from environment variables (see env_proxy() method
below). If the C<keep_alive> option is passed in, then a
C<LWP::ConnCache> is set up (see conn_cache() method below). The
C<keep_alive> value is passed on as the C<total_capacity> for the
connection cache.
=item $ua->clone
Returns a copy of the LWP::UserAgent object.
=back
=head1 ATTRIBUTES
The settings of the configuration attributes modify the behaviour of the
C<LWP::UserAgent> when it dispatches requests. Most of these can also
be initialized by options passed to the constructor method.
The following attributes methods are provided. The attribute value is
left unchanged if no argument is given. The return value from each
method is the old attribute value.
=over
=item $ua->agent
=item $ua->agent( $product_id )
Get/set the product token that is used to identify the user agent on
the network. The agent value is sent as the "User-Agent" header in
the requests. The default is the string returned by the _agent()
method (see below).
If the $product_id ends with space then the _agent() string is
appended to it.
The user agent string should be one or more simple product identifiers
with an optional version number separated by the "/" character.
Examples are:
$ua->agent('Checkbot/0.4 ' . $ua->_agent);
$ua->agent('Checkbot/0.4 '); # same as above
$ua->agent('Mozilla/5.0');
$ua->agent(""); # don't identify
=item $ua->_agent
Returns the default agent identifier. This is a string of the form
"libwww-perl/#.##", where "#.##" is substituted with the version number
of this library.
=item $ua->from
=item $ua->from( $email_address )
Get/set the e-mail address for the human user who controls
the requesting user agent. The address should be machine-usable, as
defined in RFC 822. The C<from> value is send as the "From" header in
the requests. Example:
$ua->from('gaas@cpan.org');
The default is to not send a "From" header.
=item $ua->cookie_jar
=item $ua->cookie_jar( $cookie_jar_obj )
Get/set the cookie jar object to use. The only requirement is that
the cookie jar object must implement the extract_cookies($request) and
add_cookie_header($response) methods. These methods will then be
invoked by the user agent as requests are sent and responses are
received. Normally this will be a C<HTTP::Cookies> object or some
subclass.
The default is to have no cookie_jar, i.e. never automatically add
"Cookie" headers to the requests.
Shortcut: If a reference to a plain hash is passed in as the
$cookie_jar_object, then it is replaced with an instance of
C<HTTP::Cookies> that is initialized based on the hash. This form also
automatically loads the C<HTTP::Cookies> module. It means that:
$ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });
is really just a shortcut for:
require HTTP::Cookies;
$ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));
=item $ua->conn_cache
=item $ua->conn_cache( $cache_obj )
Get/set the C<LWP::ConnCache> object to use. See L<LWP::ConnCache>
for details.
=item $ua->credentials( $netloc, $realm, $uname, $pass )
Set the user name and password to be used for a realm. It is often more
useful to specialize the get_basic_credentials() method instead.
=item $ua->max_size
=item $ua->max_size( $bytes )
Get/set the size limit for response content. The default is C<undef>,
which means that there is no limit. If the returned response content
is only partial, because the size limit was exceeded, then a
"Client-Aborted" header will be added to the response. The content
might end up longer than C<max_size> as we abort once appending a
chunk of data makes the length exceed the limit. The "Content-Length"
header, if present, will indicate the length of the full content and
will normally not be the same as C<< length($res->content) >>.
=item $ua->max_redirect
=item $ua->max_redirect( $n )
This reads or sets the object's limit of how many times it will obey
redirection responses in a given request cycle.
By default, the value is 7. This means that if you call request()
method and the response is a redirect elsewhere which is in turn a
redirect, and so on seven times, then LWP gives up after that seventh
request.
=item $ua->parse_head
=item $ua->parse_head( $boolean )
Get/set a value indicating whether we should initialize response
headers from the E<lt>head> section of HTML documents. The default is
TRUE. Do not turn this off, unless you know what you are doing.
=item $ua->protocols_allowed
=item $ua->protocols_allowed( \@protocols )
This reads (or sets) this user agent's list of protocols that the
request methods will exclusively allow. The protocol names are case
insensitive.
For example: C<$ua-E<gt>protocols_allowed( [ 'http', 'https'] );>
means that this user agent will I<allow only> those protocols,
and attempts to use this user agent to access URLs with any other
schemes (like "ftp://...") will result in a 500 error.
To delete the list, call: C<$ua-E<gt>protocols_allowed(undef)>
By default, an object has neither a C<protocols_allowed> list, nor a
C<protocols_forbidden> list.
Note that having a C<protocols_allowed> list causes any
C<protocols_forbidden> list to be ignored.
=item $ua->protocols_forbidden
=item $ua->protocols_forbidden( \@protocols )
This reads (or sets) this user agent's list of protocols that the
request method will I<not> allow. The protocol names are case
insensitive.
For example: C<$ua-E<gt>protocols_forbidden( [ 'file', 'mailto'] );>
means that this user agent will I<not> allow those protocols, and
attempts to use this user agent to access URLs with those schemes
will result in a 500 error.
To delete the list, call: C<$ua-E<gt>protocols_forbidden(undef)>
=item $ua->requests_redirectable
=item $ua->requests_redirectable( \@requests )
This reads or sets the object's list of request names that
C<$ua-E<gt>redirect_ok(...)> will allow redirection for. By
default, this is C<['GET', 'HEAD']>, as per RFC 2616. To
change to include 'POST', consider:
push @{ $ua->requests_redirectable }, 'POST';
=item $ua->timeout
=item $ua->timeout( $secs )
Get/set the timeout value in seconds. The default timeout() value is
180 seconds, i.e. 3 minutes.
The requests is aborted if no activity on the connection to the server
is observed for C<timeout> seconds. This means that the time it takes
for the complete transaction and the request() method to actually
return might be longer.
=back
=head2 Proxy attributes
The following methods set up when requests should be passed via a
proxy server.
=over
=item $ua->proxy(\@schemes, $proxy_url)
=item $ua->proxy($scheme, $proxy_url)
Set/retrieve proxy URL for a scheme:
$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
$ua->proxy('gopher', 'http://proxy.sn.no:8001/');
The first form specifies that the URL is to be used for proxying of
access methods listed in the list in the first method argument,
i.e. 'http' and 'ftp'.
The second form shows a shorthand form for specifying
proxy URL for a single access scheme.
=item $ua->no_proxy( $domain, ... )
Do not proxy requests to the given domains. Calling no_proxy without
any domains clears the list of domains. Eg:
$ua->no_proxy('localhost', 'no', ...);
=item $ua->env_proxy
Load proxy settings from *_proxy environment variables. You might
specify proxies like this (sh-syntax):
gopher_proxy=http://proxy.my.place/
wais_proxy=http://proxy.my.place/
no_proxy="localhost,my.domain"
export gopher_proxy wais_proxy no_proxy
csh or tcsh users should use the C<setenv> command to define these
environment variables.
On systems with case insensitive environment variables there exists a
name clash between the CGI environment variables and the C<HTTP_PROXY>
environment variable normally picked up by env_proxy(). Because of
this C<HTTP_PROXY> is not honored for CGI scripts. The
C<CGI_HTTP_PROXY> environment variable can be used instead.
=back
=head1 REQUEST METHODS
The methods described in this section are used to dispatch requests
via the user agent. The following request methods are provided:
=over
=item $ua->get( $url )
=item $ua->get( $url , $field_name => $value, ... )
This method will dispatch a C<GET> request on the given $url. Further
arguments can be given to initialize the headers of the request. These
are given as separate name/value pairs. The return value is a
response object. See L<HTTP::Response> for a description of the
interface it provides.
Fields names that start with ":" are special. These will not
initialize headers of the request but will determine how the response
content is treated. The following special field names are recognized:
:content_file => $filename
:content_cb => \&callback
:read_size_hint => $bytes
If a $filename is provided with the C<:content_file> option, then the
response content will be saved here instead of in the response
object. If a callback is provided with the C<:content_cb> option then
this function will be called for each chunk of the response content as
it is received from the server. If neither of these options are
given, then the response content will accumulate in the response
object itself. This might not be suitable for very large response
bodies. Only one of C<:content_file> or C<:content_cb> can be
specified. The content of unsuccessful responses will always
accumulate in the response object itself, regardless of the
C<:content_file> or C<:content_cb> options passed in.
The C<:read_size_hint> option is passed to the protocol module which
will try to read data from the server in chunks of this size. A
smaller value for the C<:read_size_hint> will result in a higher
number of callback invocations.
The callback function is called with 3 arguments: a chunk of data, a
reference to the response object, and a reference to the protocol
object. The callback can abort the request by invoking die(). The
exception message will show up as the "X-Died" header field in the
response returned by the get() function.
=item $ua->head( $url )
=item $ua->head( $url , $field_name => $value, ... )
This method will dispatch a C<HEAD> request on the given $url.
Otherwise it works like the get() method described above.
=item $ua->post( $url, \%form )
=item $ua->post( $url, \@form )
=item $ua->post( $url, \%form, $field_name => $value, ... )
This method will dispatch a C<POST> request on the given $url, with
%form or @form providing the key/value pairs for the fill-in form
content. Additional headers and content options are the same as for
the get() method.
This method will use the POST() function from C<HTTP::Request::Common>
to build the request. See L<HTTP::Request::Common> for a details on
how to pass form content and other advanced features.
=item $ua->mirror( $url, $filename )
This method will get the document identified by $url and store it in
file called $filename. If the file already exists, then the request
will contain an "If-Modified-Since" header matching the modification
time of the file. If the document on the server has not changed since
this time, then nothing happens. If the document has been updated, it
will be downloaded again. The modification time of the file will be
forced to match that of the server.
The return value is the the response object.
=item $ua->request( $request )
=item $ua->request( $request, $content_file )
=item $ua->request( $request, $content_cb )
=item $ua->request( $request, $content_cb, $read_size_hint )
This method will dispatch the given $request object. Normally this
will be an instance of the C<HTTP::Request> class, but any object with
a similar interface will do. The return value is a response object.
See L<HTTP::Request> and L<HTTP::Response> for a description of the
interface provided by these classes.
The request() method will process redirects and authentication
responses transparently. This means that it may actually send several
simple requests via the simple_request() method described below.
The request methods described above; get(), head(), post() and
mirror(), will all dispatch the request they build via this method.
They are convenience methods that simply hides the creation of the
request object for you.
The $content_file, $content_cb and $read_size_hint all correspond to
options described with the get() method above.
You are allowed to use a CODE reference as C<content> in the request
object passed in. The C<content> function should return the content
when called. The content can be returned in chunks. The content
function will be invoked repeatedly until it return an empty string to
signal that there is no more content.
=item $ua->simple_request( $request )
=item $ua->simple_request( $request, $content_file )
=item $ua->simple_request( $request, $content_cb )
=item $ua->simple_request( $request, $content_cb, $read_size_hint )
This method dispatches a single request and returns the response
received. Arguments are the same as for request() described above.
The difference from request() is that simple_request() will not try to
handle redirects or authentication responses. The request() method
will in fact invoke this method for each simple request it sends.
=item $ua->is_protocol_supported( $scheme )
You can use this method to test whether this user agent object supports the
specified C<scheme>. (The C<scheme> might be a string (like 'http' or
'ftp') or it might be an URI object reference.)
Whether a scheme is supported, is determined by the user agent's
C<protocols_allowed> or C<protocols_forbidden> lists (if any), and by
the capabilities of LWP. I.e., this will return TRUE only if LWP
supports this protocol I<and> it's permitted for this particular
object.
=back
=head2 Callback methods
The following methods will be invoked as requests are processed. These
methods are documented here because subclasses of C<LWP::UserAgent>
might want to override their behaviour.
=over
=item $ua->prepare_request( $request )
This method is invoked by simple_request(). Its task is to modify the
given $request object by setting up various headers based on the
attributes of the user agent. The return value should normally be the
$request object passed in. If a different request object is returned
it will be the one actually processed.
The headers affected by the base implementation are; "User-Agent",
"From", "Range" and "Cookie".
=item $ua->redirect_ok( $prospective_request, $response )
This method is called by request() before it tries to follow a
redirection to the request in $response. This should return a TRUE
value if this redirection is permissible. The $prospective_request
will be the request to be sent if this method returns TRUE.
The base implementation will return FALSE unless the method
is in the object's C<requests_redirectable> list,
FALSE if the proposed redirection is to a "file://..."
URL, and TRUE otherwise.
=item $ua->get_basic_credentials( $realm, $uri, $isproxy )
This is called by request() to retrieve credentials for documents
protected by Basic or Digest Authentication. The arguments passed in
is the $realm provided by the server, the $uri requested and a boolean
flag to indicate if this is authentication against a proxy server.
The method should return a username and password. It should return an
empty list to abort the authentication resolution attempt. Subclasses
can override this method to prompt the user for the information. An
example of this can be found in C<lwp-request> program distributed
with this library.
The base implementation simply checks a set of pre-stored member
variables, set up with the credentials() method.
=back
=head1 SEE ALSO
See L<LWP> for a complete overview of libwww-perl5. See L<lwpcook>
and the scripts F<lwp-request> and F<lwp-download> for examples of
usage.
See L<HTTP::Request> and L<HTTP::Response> for a description of the
message objects dispatched and received. See L<HTTP::Request::Common>
and L<HTML::Form> for other ways to build request objects.
See L<WWW::Mechanize> and L<WWW::Search> for examples of more
specialized user agents based on C<LWP::UserAgent>.
=head1 COPYRIGHT
Copyright 1995-2004 Gisle Aas.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
| 31.619228 | 101 | 0.647777 |
73fce6b1d7c0b4ebb5bcce76dfd8ee626d3b4958 | 9,375 | t | Perl | tests/proxy/markers.t | vlad-ivanov-name/josh | cbc0a825790fb0ee001ed607a41b6aae34d58bc5 | [
"MIT"
]
| 245 | 2021-08-14T04:56:35.000Z | 2022-03-18T19:59:54.000Z | tests/proxy/markers.t | vlad-ivanov-name/josh | cbc0a825790fb0ee001ed607a41b6aae34d58bc5 | [
"MIT"
]
| 59 | 2021-08-13T11:42:02.000Z | 2022-03-26T09:55:28.000Z | tests/proxy/markers.t | vlad-ivanov-name/josh | cbc0a825790fb0ee001ed607a41b6aae34d58bc5 | [
"MIT"
]
| 13 | 2021-08-18T15:41:35.000Z | 2022-03-16T16:28:24.000Z | $ . ${TESTDIR}/setup_test_env.sh
$ cd ${TESTTMP}
$ git clone -q http://localhost:8001/real_repo.git
warning: You appear to have cloned an empty repository.
$ cd real_repo
$ mkdir -p a/b
$ echo abdcontent > a/b/d
$ mkdir sub1
$ echo contents > sub1/file1
$ git add .
$ git commit -m "add file1"
[master (root-commit) 1e64dc7] add file1
2 files changed, 2 insertions(+)
create mode 100644 a/b/d
create mode 100644 sub1/file1
$ git show HEAD
commit 1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4
Author: Josh <josh@example.com>
Date: Thu Apr 7 22:13:13 2005 +0000
add file1
diff --git a/a/b/d b/a/b/d
new file mode 100644
index 0000000..321f48c
--- /dev/null
+++ b/a/b/d
@@ -0,0 +1 @@
+abdcontent
diff --git a/sub1/file1 b/sub1/file1
new file mode 100644
index 0000000..12f00e9
--- /dev/null
+++ b/sub1/file1
@@ -0,0 +1 @@
+contents
$ tree
.
|-- a
| `-- b
| `-- d
`-- sub1
`-- file1
3 directories, 2 files
$ git push
To http://localhost:8001/real_repo.git
* [new branch] master -> master
$ cd ${TESTTMP}
$ git clone -q http://localhost:8002/real_repo.git full_repo
$ cd full_repo
$ tree
.
|-- a
| `-- b
| `-- d
`-- sub1
`-- file1
3 directories, 2 files
$ cat sub1/file1
contents
$ cat > ../query <<EOF
> {"query":"mutation {
> meta(commit: \"1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4\", topic:\"tool/warn\", add: [
> { path:\"a/b/c\", data: [\"{\\\\\"location\\\\\":\\\\\"1234\\\\\",\\\\\"message\\\\\":\\\n \\\\\"m1\\\\\"}\"] }
> ])
> }"}
> EOF
$ cat ../query | curl -s -X POST -H "content-type: application/json" --data @- "http://localhost:8002/~/graphql/real_repo.git"
{
"data": {
"meta": true
}
} (no-eol)
$ git fetch ${TESTTMP}/remote/scratch refs/josh/upstream/real_repo.git/refs/josh/meta
From /*/cramtests-*/markers.t/remote/scratch (glob)
* branch refs/josh/upstream/real_repo.git/refs/josh/meta -> FETCH_HEAD
$ git log --graph --pretty=%s FETCH_HEAD
* marker
$ git diff ${EMPTY_TREE}..FETCH_HEAD
diff --git a/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
new file mode 100644
index 0000000..11474f8
--- /dev/null
+++ b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
@@ -0,0 +1 @@
+43a0f340d27ea912af7a1cfbaa491cd117564a4e:{"location":"1234","message":"m1"}
\ No newline at end of file
$ cat > ../query <<EOF
> {"query":"mutation {
> meta(commit: \"1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4\", topic:\"tool/warn\", add: [
> { path:\"a/b/c\", data: [\"{\\\\\"location\\\\\":\\\\\"1235\\\\\",\\\\\"message\\\\\":\\\\\"foobar\\\\\"}\"] }
> ])
> }"}
> EOF
$ cat ../query | curl -s -X POST -H "content-type: application/json" --data @- "http://localhost:8002/~/graphql/real_repo.git"
{
"data": {
"meta": true
}
} (no-eol)
$ git fetch ${TESTTMP}/remote/scratch refs/josh/upstream/real_repo.git/refs/josh/meta
From /*/cramtests-*/markers.t/remote/scratch (glob)
* branch refs/josh/upstream/real_repo.git/refs/josh/meta -> FETCH_HEAD
$ git log --graph --pretty=%s FETCH_HEAD
* marker
* marker
$ git diff ${EMPTY_TREE}..FETCH_HEAD
diff --git a/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
new file mode 100644
index 0000000..f81b303
--- /dev/null
+++ b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
@@ -0,0 +1,2 @@
+43a0f340d27ea912af7a1cfbaa491cd117564a4e:{"location":"1234","message":"m1"}
+c6058f73704cfe1879d4ef110910fc8b50ff04c7:{"location":"1235","message":"foobar"}
\ No newline at end of file
$ cat > ../query <<EOF
> {"query":"mutation {
> meta(commit: \"1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4\", topic:\"tool/warn\", add: [
> { path:\"a/b/d\", data: [
> \"{\\\\\"location\\\\\":\\\\\"1235\\\\\",\\\\\"message\\\\\":\\\\\"foobar\\\\\"}\",
> \"{\\\\\"location\\\\\":\\\\\"1236\\\\\",\\\\\"message\\\\\":\\\\\"foobar\\\\\"}\"
> ]}
> ])
> }"}
> EOF
$ cat ../query | curl -s -X POST -H "content-type: application/json" --data @- "http://localhost:8002/~/graphql/real_repo.git"
{
"data": {
"meta": true
}
} (no-eol)
$ git fetch ${TESTTMP}/remote/scratch refs/josh/upstream/real_repo.git/refs/josh/meta
From /*/cramtests-*/markers.t/remote/scratch (glob)
* branch refs/josh/upstream/real_repo.git/refs/josh/meta -> FETCH_HEAD
$ git log --graph --pretty=%s FETCH_HEAD
* marker
* marker
* marker
$ git diff ${EMPTY_TREE}..FETCH_HEAD
diff --git a/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
new file mode 100644
index 0000000..f81b303
--- /dev/null
+++ b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/c
@@ -0,0 +1,2 @@
+43a0f340d27ea912af7a1cfbaa491cd117564a4e:{"location":"1234","message":"m1"}
+c6058f73704cfe1879d4ef110910fc8b50ff04c7:{"location":"1235","message":"foobar"}
\ No newline at end of file
diff --git a/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/d b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/d
new file mode 100644
index 0000000..249fd13
--- /dev/null
+++ b/tool/warn/~/1e/64d/c713/1e64dc7136eae9c6b88e4ab831322f3c72a5c0e4/a/b/d
@@ -0,0 +1,2 @@
+53296c9e4dbc2b6ad15e15b2fc66870cd0548515:{"location":"1236","message":"foobar"}
+c6058f73704cfe1879d4ef110910fc8b50ff04c7:{"location":"1235","message":"foobar"}
\ No newline at end of file
$ cat > ../query <<EOF
> {"query":"{ rev(at:\"refs/heads/master\") {
> files {
> path, text, meta(topic:\"tool/warn\") {
> data {
> id
> message: string(at: \"/message\")
> location: string(at: \"/location\")
> }
> count
> }
> }
> dirs {
> path,meta(topic:\"tool/warn\") {
> count
> }
> }
> }}"}
> EOF
$ cat ../query | curl -s -X POST -H "content-type: application/json" --data @- "http://localhost:8002/~/graphql/real_repo.git"
{
"data": {
"rev": {
"files": [
{
"path": "a/b/d",
"text": "abdcontent\n",
"meta": {
"data": [
{
"id": "53296c9e4dbc2b6ad15e15b2fc66870cd0548515",
"message": "foobar",
"location": "1236"
},
{
"id": "c6058f73704cfe1879d4ef110910fc8b50ff04c7",
"message": "foobar",
"location": "1235"
}
],
"count": 2
}
},
{
"path": "sub1/file1",
"text": "contents\n",
"meta": {
"data": [],
"count": 0
}
}
],
"dirs": [
{
"path": "a",
"meta": {
"count": 4
}
},
{
"path": "a/b",
"meta": {
"count": 4
}
},
{
"path": "sub1",
"meta": {
"count": 0
}
}
]
}
}
} (no-eol)
$ cat > ../query <<EOF
> {"query":"{ rev(at:\"refs/heads/master\", filter:\":/a\") {
> files {
> path, text, meta(topic:\"tool/warn\") {
> data {
> position: string(at: \"/location\"), text: string(at: \"message\")
> }
> count
> }
> }
> dirs {
> path,meta(topic:\"tool/warn\") {
> count
> }
> }
> }}"}
> EOF
$ cat ../query | curl -s -X POST -H "content-type: application/json" --data @- "http://localhost:8002/~/graphql/real_repo.git"
{
"data": {
"rev": {
"files": [
{
"path": "b/d",
"text": "abdcontent\n",
"meta": {
"data": [
{
"position": "1236",
"text": null
},
{
"position": "1235",
"text": null
}
],
"count": 2
}
}
],
"dirs": [
{
"path": "b",
"meta": {
"count": 2
}
}
]
}
}
} (no-eol)
$ bash ${TESTDIR}/destroy_test_env.sh
"real_repo.git" = [
':/a',
':/a/b',
':/sub1',
]
refs
|-- heads
|-- josh
| |-- filtered
| | `-- real_repo.git
| | |-- %3A
| | | `-- HEAD
| | |-- %3A%2Fa
| | | `-- HEAD
| | |-- %3A%2Fa%2Fb
| | | `-- HEAD
| | `-- %3A%2Fsub1
| | `-- HEAD
| `-- upstream
| `-- real_repo.git
| |-- HEAD
| `-- refs
| |-- heads
| | `-- master
| `-- josh
| `-- meta
|-- namespaces
`-- tags
15 directories, 7 files
| 26.483051 | 158 | 0.506133 |
73f0103995ab255666d4e2513a39dc710ab7bd54 | 2,022 | pl | Perl | Hco_Acey/remove_aug_genes.pl | SchwarzEM/ems_perl | 0c20b1fe1d215689ee8db3677b23175bd968841f | [
"BSD-3-Clause"
]
| 2 | 2021-07-19T09:00:17.000Z | 2021-08-30T02:45:18.000Z | Hco_Acey/remove_aug_genes.pl | Superboy666/ems_perl | ce78eb5c2120566e6e55a786ebd15382cb38736f | [
"BSD-3-Clause"
]
| null | null | null | Hco_Acey/remove_aug_genes.pl | Superboy666/ems_perl | ce78eb5c2120566e6e55a786ebd15382cb38736f | [
"BSD-3-Clause"
]
| 1 | 2021-07-19T09:00:18.000Z | 2021-07-19T09:00:18.000Z | #!/usr/bin/env perl
# remove_aug_genes.pl -- Erich Schwarz <emsch@caltech.edu>, 10/26/2012.
# Purpose: given a list of genes to be censored and an *.aug output from AUGUSTUS 2.6.1, print an *.aug without the unwanted genes.
use strict;
use warnings;
use Getopt::Long;
my $data_ref;
my $print = 1;
my $censored = q{};
my $augustus = q{};
my $help;
GetOptions ( 'censored=s' => \$censored,
'augustus=s' => \$augustus,
'help' => \$help, );
if ( (! $censored) or (! $augustus) or $help ) {
die "Format: remove_aug_genes.pl\n",
" --censored|-c [list of genes to censor]\n",
" --augustus|-a [AUGUSTUS .aug file to censor]\n",
" --help|-h [print this message]\n",
;
}
open my $CENSOR, '<', $censored or die "Can't open file of genes to be censored: $censored\n";
while (my $input = <$CENSOR>) {
chomp $input;
if ( $input =~ /\A (\S+) \z/xms ) {
my $unwanted = $1;
$data_ref->{'unwanted'}->{$unwanted} = 1;
}
else {
die "From censored file $censored, can't parse: $input\n";
}
}
close $CENSOR or die "Can't close filehandle to file of genes to be censored: $censored\n";
# Sample input:
# end gene Acey_2012.08.05_0001.g10
###
# start gene Acey_2012.08.05_0001.g11
open my $AUG, '<', $augustus or die "Can't open AUGUSTUS file to be censored: $augustus\n";
while (my $input = <$AUG>) {
chomp $input;
if ( $input =~ /\A [#] [ ] start [ ] gene [ ] (\S+) /xms ) {
my $gene = $1;
if ( exists $data_ref->{'unwanted'}->{$gene} ) {
$print = 0;
}
}
elsif ( $input =~ /\A [#] [ ] end [ ] gene [ ] (\S+) /xms ) {
my $gene = $1;
if ( exists $data_ref->{'unwanted'}->{$gene} ) {
$print = -1;
}
}
if ( $print == 1 ) {
print "$input\n";
}
elsif ( $print == -1 ) {
$print = 1;
}
}
close $AUG or die "Can't close filehandle to AUGUSTUS file to be censored: $augustus\n";
| 28.478873 | 131 | 0.531652 |
ed1f1828306e87cba5294d535cfc4891ca127be9 | 810 | pm | Perl | x64/Release/slic3r_130/local-lib/lib/perl5/MSWin32-x64-multi-thread/Wx/PerlTest.pm | aacitelli/OASIS-Challenge-Baseline-Code-and-Models | f1847c4a5c3d33ad3d05a41a5c5caf0d383faac1 | [
"BSD-2-Clause"
]
| null | null | null | x64/Release/slic3r_130/local-lib/lib/perl5/MSWin32-x64-multi-thread/Wx/PerlTest.pm | aacitelli/OASIS-Challenge-Baseline-Code-and-Models | f1847c4a5c3d33ad3d05a41a5c5caf0d383faac1 | [
"BSD-2-Clause"
]
| null | null | null | x64/Release/slic3r_130/local-lib/lib/perl5/MSWin32-x64-multi-thread/Wx/PerlTest.pm | aacitelli/OASIS-Challenge-Baseline-Code-and-Models | f1847c4a5c3d33ad3d05a41a5c5caf0d383faac1 | [
"BSD-2-Clause"
]
| null | null | null | #############################################################################
## Name: ext/test/lib/Wx/PerlTest.pm
## Purpose: Wx::PerlTest various tests
## Author: Mark Dootson
## Modified by:
## Created: 2012-09-28
## RCS-ID: $Id: PerlTest.pm 3395 2012-09-29 02:01:49Z mdootson $
## Copyright: (c) 2012 Mark Dootson
## Licence: This program is free software; you can redistribute it and/or
## modify it under the same terms as Perl itself
#############################################################################
package Wx::PerlTest;
use Wx;
use strict;
use vars qw($VERSION);
$VERSION = '0.01';
Wx::wx_boot( 'Wx::PerlTest', $VERSION );
#
# properly setup inheritance tree
#
no strict;
use strict;
1;
# Local variables: #
# mode: cperl #
# End: #
| 21.315789 | 77 | 0.512346 |
73dea0a1565e87dbdd995cebf7dff6c97197a962 | 4,568 | pl | Perl | external/win_perl/lib/auto/share/dist/DateTime-Locale/nd-ZW.pl | phixion/l0phtcrack | 48ee2f711134e178dbedbd925640f6b3b663fbb5 | [
"Apache-2.0",
"MIT"
]
| 2 | 2021-10-20T00:25:39.000Z | 2021-11-08T12:52:42.000Z | external/win_perl/lib/auto/share/dist/DateTime-Locale/nd-ZW.pl | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| null | null | null | external/win_perl/lib/auto/share/dist/DateTime-Locale/nd-ZW.pl | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| 1 | 2022-03-14T06:41:16.000Z | 2022-03-14T06:41:16.000Z | {
am_pm_abbreviated => [
"AM",
"PM",
],
available_formats => {
Bh => "h B",
Bhm => "h:mm B",
Bhms => "h:mm:ss B",
E => "ccc",
EBhm => "E h:mm B",
EBhms => "E h:mm:ss B",
EHm => "E HH:mm",
EHms => "E HH:mm:ss",
Ed => "d, E",
Ehm => "E h:mm a",
Ehms => "E h:mm:ss a",
Gy => "G y",
GyMMM => "G y MMM",
GyMMMEd => "G y MMM d, E",
GyMMMd => "G y MMM d",
H => "HH",
Hm => "HH:mm",
Hms => "HH:mm:ss",
Hmsv => "HH:mm:ss v",
Hmv => "HH:mm v",
M => "L",
MEd => "E, M/d",
MMM => "LLL",
MMMEd => "E, MMM d",
MMMMEd => "E, MMMM d",
"MMMMW-count-other" => "'week' W 'of' MMMM",
MMMMd => "MMMM d",
MMMd => "MMM d",
Md => "M/d",
d => "d",
h => "h a",
hm => "h:mm a",
hms => "h:mm:ss a",
hmsv => "h:mm:ss a v",
hmv => "h:mm a v",
ms => "mm:ss",
y => "y",
yM => "M/y",
yMEd => "E, M/d/y",
yMMM => "MMM y",
yMMMEd => "E, MMM d, y",
yMMMM => "MMMM y",
yMMMd => "y MMM d",
yMd => "y-MM-dd",
yQQQ => "QQQ y",
yQQQQ => "QQQQ y",
"yw-count-other" => "'week' w 'of' Y",
},
code => "nd-ZW",
date_format_full => "EEEE, d MMMM y",
date_format_long => "d MMMM y",
date_format_medium => "d MMM y",
date_format_short => "dd/MM/y",
datetime_format_full => "{1} {0}",
datetime_format_long => "{1} {0}",
datetime_format_medium => "{1} {0}",
datetime_format_short => "{1} {0}",
day_format_abbreviated => [
"Mvu",
"Sib",
"Sit",
"Sin",
"Sih",
"Mgq",
"Son",
],
day_format_narrow => [
"M",
"S",
"S",
"S",
"S",
"M",
"S",
],
day_format_wide => [
"Mvulo",
"Sibili",
"Sithathu",
"Sine",
"Sihlanu",
"Mgqibelo",
"Sonto",
],
day_stand_alone_abbreviated => [
"Mvu",
"Sib",
"Sit",
"Sin",
"Sih",
"Mgq",
"Son",
],
day_stand_alone_narrow => [
"M",
"S",
"S",
"S",
"S",
"M",
"S",
],
day_stand_alone_wide => [
"Mvulo",
"Sibili",
"Sithathu",
"Sine",
"Sihlanu",
"Mgqibelo",
"Sonto",
],
era_abbreviated => [
"BC",
"AD",
],
era_narrow => [
"BC",
"AD",
],
era_wide => [
"UKristo angakabuyi",
"Ukristo ebuyile",
],
first_day_of_week => 7,
glibc_date_1_format => "%a %b %e %H:%M:%S %Z %Y",
glibc_date_format => "%m/%d/%y",
glibc_datetime_format => "%a %b %e %H:%M:%S %Y",
glibc_time_12_format => "%I:%M:%S %p",
glibc_time_format => "%H:%M:%S",
language => "North Ndebele",
month_format_abbreviated => [
"Zib",
"Nhlo",
"Mbi",
"Mab",
"Nkw",
"Nhla",
"Ntu",
"Ncw",
"Mpan",
"Mfu",
"Lwe",
"Mpal",
],
month_format_narrow => [
"Z",
"N",
"M",
"M",
"N",
"N",
"N",
"N",
"M",
"M",
"L",
"M",
],
month_format_wide => [
"Zibandlela",
"Nhlolanja",
"Mbimbitho",
"Mabasa",
"Nkwenkwezi",
"Nhlangula",
"Ntulikazi",
"Ncwabakazi",
"Mpandula",
"Mfumfu",
"Lwezi",
"Mpalakazi",
],
month_stand_alone_abbreviated => [
"Zib",
"Nhlo",
"Mbi",
"Mab",
"Nkw",
"Nhla",
"Ntu",
"Ncw",
"Mpan",
"Mfu",
"Lwe",
"Mpal",
],
month_stand_alone_narrow => [
"Z",
"N",
"M",
"M",
"N",
"N",
"N",
"N",
"M",
"M",
"L",
"M",
],
month_stand_alone_wide => [
"Zibandlela",
"Nhlolanja",
"Mbimbitho",
"Mabasa",
"Nkwenkwezi",
"Nhlangula",
"Ntulikazi",
"Ncwabakazi",
"Mpandula",
"Mfumfu",
"Lwezi",
"Mpalakazi",
],
name => "North Ndebele Zimbabwe",
native_language => "isiNdebele",
native_name => "isiNdebele Zimbabwe",
native_script => undef,
native_territory => "Zimbabwe",
native_variant => undef,
quarter_format_abbreviated => [
"K1",
"K2",
"K3",
"K4",
],
quarter_format_narrow => [
1,
2,
3,
4,
],
quarter_format_wide => [
"Kota 1",
"Kota 2",
"Kota 3",
"Kota 4",
],
quarter_stand_alone_abbreviated => [
"K1",
"K2",
"K3",
"K4",
],
quarter_stand_alone_narrow => [
1,
2,
3,
4,
],
quarter_stand_alone_wide => [
"Kota 1",
"Kota 2",
"Kota 3",
"Kota 4",
],
script => undef,
territory => "Zimbabwe",
time_format_full => "HH:mm:ss zzzz",
time_format_long => "HH:mm:ss z",
time_format_medium => "HH:mm:ss",
time_format_short => "HH:mm",
variant => undef,
version => 32,
}
| 16.794118 | 51 | 0.448774 |
ed1ba1b08229d99e54aca4d9e5be74403d1e7176 | 5,023 | pl | Perl | src/lib/sockets.pl | heydtn/scryer-prolog | 2eae6b4be745cf211657f3b35d79fed7528f1b15 | [
"BSD-3-Clause"
]
| null | null | null | src/lib/sockets.pl | heydtn/scryer-prolog | 2eae6b4be745cf211657f3b35d79fed7528f1b15 | [
"BSD-3-Clause"
]
| null | null | null | src/lib/sockets.pl | heydtn/scryer-prolog | 2eae6b4be745cf211657f3b35d79fed7528f1b15 | [
"BSD-3-Clause"
]
| null | null | null |
:- module(sockets, [socket_client_open/3,
socket_server_open/2,
socket_server_accept/4,
socket_server_close/1,
tls_server_context/2, % tls_server_context(-Context, +Options)
tls_server_negotiate/3, % tls_server_negotiate(+Context, +Stream0, -Stream)
current_hostname/1]).
:- use_module(library(error)).
:- use_module(library(lists)).
% a client can negotiate a TLS connection by specifying the option
% tls(true) in socket_client_open/3
parse_socket_options_(tls(TLS), tls-TLS) :-
must_be(boolean, TLS), !.
parse_socket_options_(Option, OptionPair) :-
builtins:parse_stream_options_(Option, OptionPair).
parse_socket_options(Options, OptionValues, Stub) :-
DefaultOptions = [alias-[], eof_action-eof_code, reposition-false, tls-false, type-text],
builtins:parse_options_list(Options, sockets:parse_socket_options_, DefaultOptions, OptionValues, Stub).
socket_client_open(Addr, Stream, Options) :-
( var(Addr) ->
throw(error(instantiation_error, socket_client_open/3))
;
true
),
must_be(var, Stream),
must_be(list, Options),
( Addr = Address:Port,
atom(Address),
( atom(Port) ; integer(Port) ) ->
true
;
throw(error(type_error(socket_address, Addr), socket_client_open/3))
),
parse_socket_options(Options,
[Alias, EOFAction, Reposition, TLS, Type],
socket_client_open/3),
'$socket_client_open'(Address, Port, Stream, Alias, EOFAction, Reposition, Type, TLS).
socket_server_open(Addr, ServerSocket) :-
must_be(var, ServerSocket),
( ( integer(Addr) ; var(Addr) ) ->
'$socket_server_open'([], Addr, ServerSocket)
;
Addr = Address:Port,
must_be(atom, Address),
can_be(integer, Port),
'$socket_server_open'(Address, Port, ServerSocket)
).
socket_server_accept(ServerSocket, Client, Stream, Options) :-
must_be(var, Client),
must_be(var, Stream),
builtins:parse_stream_options(Options,
[Alias, EOFAction, Reposition, Type],
socket_server_accept/4),
'$socket_server_accept'(ServerSocket, Client, Stream, Alias, EOFAction, Reposition, Type).
socket_server_close(ServerSocket) :-
'$socket_server_close'(ServerSocket).
current_hostname(HostName) :-
'$current_hostname'(HostName).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TLS Servers
===========
Use tls_server_context/2 to create a TLS context, for example with:
tls_server_context(Context, [pkcs12(Chars)])
where Chars is a list of characters with the contents of a
DER-formatted PKCS #12 archive. The option password(Ps) can be used
to specify the password Ps (also a string) for decrypting the key.
On some versions of OSX, and potentially also on other platforms,
empty passwords are not supported.
The archive should contain a leaf certificate and its private key,
as well any intermediate certificates that should be sent to
clients to allow them to build a chain to a trusted root. The chain
certificates should be in order from the leaf certificate towards
the root.
PKCS #12 archives typically have the file extension .p12 or .pfx,
and can be created with the OpenSSL pkcs12 tool:
$ openssl pkcs12 -export -out identity.pfx \
-inkey key.pem -in cert.pem -certfile chain_certs.pem
You can use phrase_from_file/3 from library(pio) and seq//1 from
library(dcgs) to read the contents of "identity.pfx" into a string:
phrase_from_file(seq(Chars), "identity.pfx", [type(binary)])
The obtained context should be treated as an opaque Prolog term.
Using the context and an existing stream S0 (for example, the
result of socket_server_accept/4), a TLS stream S can be negotiated
by a Prolog-based server with:
tls_server_negotiate(Context, S0, S)
S will be an encrypted and authenticated stream with the client.
The advantage of separating the creation of the server context from
negotiating a connection is that the context can be created only
once, and quickly cloned for every incoming connection. This is
currently not implemented: In the present implementation, a new context
is created for every connection, using the specified parameters.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
tls_server_context(tls_context(Cert,Password), Options) :-
( member(pcks12(Cert), Options) ->
must_be(chars, Cert)
; domain_error(contains_pcks12, Options, tls_server_context/2)
),
( member(password(Password), Options) ->
must_be(chars, Password)
; Password = ""
).
tls_server_negotiate(tls_context(Cert,Password), S0, S) :-
'$tls_accept_client'(Cert, Password, S0, S).
| 37.207407 | 108 | 0.655385 |
73d660b367a45db19a046395661ca1874e8c6402 | 4,062 | pl | Perl | scripts/production/backup_master.pl | twalsh-ebi/ensembl-compara | 9214f49ec1c2600b265715775aa05093534814ac | [
"Apache-2.0"
]
| null | null | null | scripts/production/backup_master.pl | twalsh-ebi/ensembl-compara | 9214f49ec1c2600b265715775aa05093534814ac | [
"Apache-2.0"
]
| null | null | null | scripts/production/backup_master.pl | twalsh-ebi/ensembl-compara | 9214f49ec1c2600b265715775aa05093534814ac | [
"Apache-2.0"
]
| null | null | null | #!/usr/bin/env perl
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
=head1 NAME
backup_master.pl
=head1 DESCRIPTION
This script is a wrapper around sudo and mysqldump to dump the master database,
taking its location from a production_reg_conf file.
=head1 SYNOPSIS
perl backup_master.pl --reg_conf $COMPARA_REG_PATH
perl backup_master.pl $COMPARA_REG compara_master --label "pre100"
=head1 ARGUMENTS
=head2 DATABASE SETUP
=over
=item B<[--url mysql://user[:passwd]@host[:port]/dbname]>
URL of the database to dump.
=item B<[--reg_conf registry_configuration_file]>
The Bio::EnsEMBL::Registry configuration file. Must be given to refer to
the database by registry name (alias) instead of a URL.
=item B<[--reg_type reg_type]>
The "type" or "group" under which the database is to be found in the Registry.
Defaults to "compara".
=item B<[--reg_alias|--reg_name name]>
The name or "species" under which the database is to be found in the Registry.
Defaults to "compara_master".
=back
=head2 DUMP SETUP
=over
=item B<[--dump_path /path/to_dumps]>
Where to store the dumps. Defaults to the shared warehouse directory.
=item B<[--username username]>
Name of the user used to create the dumps.
Defaults to "compara_ensembl". Set this to an empty string to create the
backup as yourself.
=item B<[--label str]>
Label to append to the dump file name.
=back
=cut
use strict;
use warnings;
use Getopt::Long;
use POSIX qw(strftime);
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Compara::Utils::Registry;
my ($url, $reg_conf, $reg_type, $reg_alias);
my ($dump_path, $username, $label);
# Arguments parsing
GetOptions(
'url=s' => \$url,
'reg_conf|regfile|reg_file=s' => \$reg_conf,
'reg_type=s' => \$reg_type,
'reg_alias|regname|reg_name=s' => \$reg_alias,
'dump_path=s' => \$dump_path,
'username=s' => \$username,
'label=s' => \$label,
) or die "Error in command line arguments\n";
if (@ARGV) {
die "ERROR: There are invalid arguments on the command-line: ". join(" ", @ARGV). "\n";
}
unless ($url or $reg_conf) {
print "\nERROR: Neither --url nor --reg_conf are defined. Some of those are needed to refer to the database being dumped\n\n";
exit 1;
}
if ($url and $reg_alias) {
print "\nERROR: Both --url and --reg_alias are defined. Don't know which one to use\n\n";
exit 1;
}
if ($reg_conf) {
Bio::EnsEMBL::Registry->load_all($reg_conf);
}
my $dba = $url
? Bio::EnsEMBL::Compara::DBSQL::DBAdaptor->new( -URL => $url )
: Bio::EnsEMBL::Registry->get_DBAdaptor( $reg_alias || 'compara_master', $reg_type || 'compara' );
my $division = $dba->get_division;
my @params = (
'--host' => $dba->dbc->host,
'--port' => $dba->dbc->port,
'--user' => 'ensro',
);
$dump_path //= $ENV{'COMPARA_WAREHOUSE'} . '/master_db_dumps';
$username //= 'compara_ensembl';
my $date = strftime '%Y%m%d', localtime;
my $dump_name = "ensembl_compara_master_${division}.${date}" . ($label ? ".$label" : ''). ".sql";
my $cmd = join(' ', 'mysqldump', @params, $dba->dbc->dbname, '>', "$dump_path/$dump_name");
if ($username) {
print "Executing as $username: $cmd\n\n";
exec('sudo', -u => $username, '/bin/bash', -c => $cmd);
} else {
print "Executing: $cmd\n\n";
exec('/bin/bash', -c => $cmd);
}
| 27.445946 | 130 | 0.665928 |
ed2629a8026c12351d6eb4532044aa2d064cbf95 | 5,144 | pm | Perl | auto-lib/Paws/MediaConvert/Xavc4kProfileSettings.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 164 | 2015-01-08T14:58:53.000Z | 2022-02-20T19:16:24.000Z | auto-lib/Paws/MediaConvert/Xavc4kProfileSettings.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 348 | 2015-01-07T22:08:38.000Z | 2022-01-27T14:34:44.000Z | auto-lib/Paws/MediaConvert/Xavc4kProfileSettings.pm | 0leksii/aws-sdk-perl | b2132fe3c79a06fd15b6137e8a0eb628de722e0f | [
"Apache-2.0"
]
| 87 | 2015-04-22T06:29:47.000Z | 2021-09-29T14:45:55.000Z | # Generated by default/object.tt
package Paws::MediaConvert::Xavc4kProfileSettings;
use Moose;
has BitrateClass => (is => 'ro', isa => 'Str', request_name => 'bitrateClass', traits => ['NameInRequest']);
has CodecProfile => (is => 'ro', isa => 'Str', request_name => 'codecProfile', traits => ['NameInRequest']);
has FlickerAdaptiveQuantization => (is => 'ro', isa => 'Str', request_name => 'flickerAdaptiveQuantization', traits => ['NameInRequest']);
has GopBReference => (is => 'ro', isa => 'Str', request_name => 'gopBReference', traits => ['NameInRequest']);
has GopClosedCadence => (is => 'ro', isa => 'Int', request_name => 'gopClosedCadence', traits => ['NameInRequest']);
has HrdBufferSize => (is => 'ro', isa => 'Int', request_name => 'hrdBufferSize', traits => ['NameInRequest']);
has QualityTuningLevel => (is => 'ro', isa => 'Str', request_name => 'qualityTuningLevel', traits => ['NameInRequest']);
has Slices => (is => 'ro', isa => 'Int', request_name => 'slices', traits => ['NameInRequest']);
1;
### main pod documentation begin ###
=head1 NAME
Paws::MediaConvert::Xavc4kProfileSettings
=head1 USAGE
This class represents one of two things:
=head3 Arguments in a call to a service
Use the attributes of this class as arguments to methods. You shouldn't make instances of this class.
Each attribute should be used as a named argument in the calls that expect this type of object.
As an example, if Att1 is expected to be a Paws::MediaConvert::Xavc4kProfileSettings object:
$service_obj->Method(Att1 => { BitrateClass => $value, ..., Slices => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::MediaConvert::Xavc4kProfileSettings object:
$result = $service_obj->Method(...);
$result->Att1->BitrateClass
=head1 DESCRIPTION
Required when you set (Profile) under
(VideoDescription)E<gt>(CodecSettings)E<gt>(XavcSettings) to the value
XAVC_4K.
=head1 ATTRIBUTES
=head2 BitrateClass => Str
Specify the XAVC 4k (Long GOP) Bitrate Class to set the bitrate of your
output. Outputs of the same class have similar image quality over the
operating points that are valid for that class.
=head2 CodecProfile => Str
Specify the codec profile for this output. Choose High, 8-bit, 4:2:0
(HIGH) or High, 10-bit, 4:2:2 (HIGH_422). These profiles are specified
in ITU-T H.264.
=head2 FlickerAdaptiveQuantization => Str
The best way to set up adaptive quantization is to keep the default
value, Auto (AUTO), for the setting Adaptive quantization
(XavcAdaptiveQuantization). When you do so, MediaConvert automatically
applies the best types of quantization for your video content. Include
this setting in your JSON job specification only when you choose to
change the default value for Adaptive quantization. Enable this setting
to have the encoder reduce I-frame pop. I-frame pop appears as a visual
flicker that can arise when the encoder saves bits by copying some
macroblocks many times from frame to frame, and then refreshes them at
the I-frame. When you enable this setting, the encoder updates these
macroblocks slightly more often to smooth out the flicker. This setting
is disabled by default. Related setting: In addition to enabling this
setting, you must also set Adaptive quantization (adaptiveQuantization)
to a value other than Off (OFF) or Auto (AUTO). Use Adaptive
quantization to adjust the degree of smoothing that Flicker adaptive
quantization provides.
=head2 GopBReference => Str
Specify whether the encoder uses B-frames as reference frames for other
pictures in the same GOP. Choose Allow (ENABLED) to allow the encoder
to use B-frames as reference frames. Choose Don't allow (DISABLED) to
prevent the encoder from using B-frames as reference frames.
=head2 GopClosedCadence => Int
Frequency of closed GOPs. In streaming applications, it is recommended
that this be set to 1 so a decoder joining mid-stream will receive an
IDR frame as quickly as possible. Setting this value to 0 will break
output segmenting.
=head2 HrdBufferSize => Int
Specify the size of the buffer that MediaConvert uses in the HRD buffer
model for this output. Specify this value in bits; for example, enter
five megabits as 5000000. When you don't set this value, or you set it
to zero, MediaConvert calculates the default by doubling the bitrate of
this output point.
=head2 QualityTuningLevel => Str
Optional. Use Quality tuning level (qualityTuningLevel) to choose how
you want to trade off encoding speed for output video quality. The
default behavior is faster, lower quality, single-pass encoding.
=head2 Slices => Int
Number of slices per picture. Must be less than or equal to the number
of macroblock rows for progressive pictures, and less than or equal to
half the number of macroblock rows for interlaced pictures.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::MediaConvert>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: L<https://github.com/pplu/aws-sdk-perl>
Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues>
=cut
| 37.823529 | 140 | 0.755638 |
73fd7c756824a048cbb099fb7dc5d10465656d63 | 176,998 | al | Perl | Apps/IN/INGST/app/GSTReturnSettlement/src/codeunit/GSTSettlement.Codeunit.al | MiguelMercadoActual/ALAppExtensions | 97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b | [
"MIT"
]
| 337 | 2019-05-07T06:04:40.000Z | 2022-03-31T10:07:42.000Z | Apps/IN/INGST/app/GSTReturnSettlement/src/codeunit/GSTSettlement.Codeunit.al | MiguelMercadoActual/ALAppExtensions | 97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b | [
"MIT"
]
| 14,850 | 2019-05-07T06:04:27.000Z | 2022-03-31T19:53:28.000Z | Apps/IN/INGST/app/GSTReturnSettlement/src/codeunit/GSTSettlement.Codeunit.al | MiguelMercadoActual/ALAppExtensions | 97ee3823053eb32fa7e38dc3d1e7a89bdcca8d7b | [
"MIT"
]
| 374 | 2019-05-09T10:08:14.000Z | 2022-03-31T17:48:32.000Z | codeunit 18318 "GST Settlement"
{
var
TempGSTPostingBuffer: array[2] of Record "GST Posting Buffer" temporary;
TempGSTPostingBuffer1: array[2] of Record "GST Posting Buffer" temporary;
DimensionManagement: Codeunit DimensionManagement;
GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
ChequeNo: Code[10];
ChequeDate: Date;
PostedDocumentNo: Code[20];
PostingDate: Date;
Window: Dialog;
NoPostErr: Label 'There is Nothing to post.';
GSTPaymentFieldSameErr: Label '%1 must be same in all the GST Payment Lines.', Comment = '%1 = Field Refrence';
CrAdjstPostedMsg: Label 'Credit Adjustment Journal posted successfully.';
AdjustmentDateErr: Label 'Document No. %1 already has been adjusted on %2. Please change the date and try again.', Comment = '%1 = Document No, %2 = Posting Date';
GSTCrAdjFilterErr: Label 'Filter Criteria is not matching with Detailed GST Ledger Entry.';
PostCrAdjQst: Label 'Do you want to post Credit Adjustment Journal?';
GSTINErr: Label 'GSTIN No. can not be blank.';
PostingDateErr: Label 'Posting Date can not be blank.';
PaymentDocErr: Label 'DocumentNo %1 has already been posted, you can not enter duplicate Document No.', Comment = '%1 = Payment Document No.';
PostGSTPaymentQst: Label 'Do you want to post GST Payment?';
PaymentBufferMsg: Label 'Generating Payment Lines : GST Component#1##############\', Comment = '%1 = GST Component Code.';
CreditSetoffErr: Label 'Credit Utilized can not exceed Total Credit Available.There is no Claim-Setoff available for GST Compoment %1.', Comment = '%1 =GST Component Code.';
CreditUtilizedErr: Label 'Credit Utilized %1 can not exceed Payment Liability %2 for GST Compoment %3.', Comment = '%1 = Credit Utilized, %2 = Payment Liability, %3 =GST Component Code.';
CreditAvailableErr: Label 'There is no sufficient Claim-Setoff available for GST Compoment %1, required Credit Utilized is %2, Total Credit Available is %3.', Comment = '%1 =GST Component Code., %2 = Credit Amount, %3 = Availabe Credit Amount';
DimCombinationErr: Label 'The combination of dimensions used for GST Component %1 is blocked. %2.', Comment = '%1 = GST Component, %2 = Dimension Value';
LiabilityExceedErr: Label 'Total of Credit Utilize, GST TDS Credit Utilized, GST TCS Credit Utilized and Payment Amount %1 must be equal to Net Payment Liability %2 in GST Component %3.', Comment = '%1 = Credit Utilized and Payment Amount, %2 = Net Payment Liability, %3 = GST Component';
InvaidDimensionErr: Label 'The dimensions used are invalid. %2.', Comment = '%1 = Dimension Value';
UpdatingLedgersMsg: Label 'Updating GST Ledger : GST Component#1##############\', Comment = '%1 =GST Component Code.';
GSTPaymentTypeTxt: Label 'Component %1 & Type: %2.', Comment = '%1 = GST Component, %2 = Tax Type';
GstTxt: Label 'Gst';
NetPaymentLibTxt: Label 'Net Payment Liability';
UnadjustedCreditTxt: Label 'Unadjusted Credit';
ReverseChargePaymentTxt: Label 'Rev. Charge Payment';
CreditUtilizedTxt: Label 'Credit';
TotalPaymentTxt: Label 'Total Payment Amount';
RemCreditAmtupdatedMsg: Label 'Remaining GST Credit Amount updated.';
NothingtoUpdateMsg: Label 'Nothing to update.';
local procedure GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntryNo: Integer; Var DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info")
begin
if DetailedGSTLedgerEntryInfo.Get(DetailedGSTLedgerEntryNo) then;
end;
procedure FillAdjustmentJournal(
GSTINNo: Code[20];
VendorNo: Code[20];
PeriodMonth: Integer;
PeriodYear: Integer;
PostingDate: Date;
DocumentNo2: Code[20];
ExternalDocNo: Code[40];
NatureOfAdj: Enum "Credit Adjustment Type";
AdjDocNo: Code[20];
ReverseCharge: Boolean;
AdjustmentPerc: Decimal)
var
DetailedGSTLedgerEntry: array[2] of Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
TotalGSTAmount: Decimal;
DocumentNo: Code[20];
DocumentLineNo: Integer;
CAJAmt: Decimal;
PermanentReversalAmt: Decimal;
Cnt: Integer;
begin
Cnt := 0;
GetCreditAdjustmentSourceCode();
DetailedGSTLedgerEntry[1].SetCurrentKey(
"Location Reg. No.",
"Transaction Type",
"Entry Type",
"GST Vendor Type",
"GST Credit",
"Posting Date",
"Source No.",
"Document Type",
"Document No.",
"Document Line No.");
DetailedGSTLedgerEntry[1].SetRange("Location Reg. No.", GSTINNo);
DetailedGSTLedgerEntry[1].SetRange("Transaction Type", DetailedGSTLedgerEntry[1]."Transaction Type"::Purchase);
ApplyReverseChargeFilter(DetailedGSTLedgerEntry, NatureOfAdj, ReverseCharge, PeriodMonth, PeriodYear); //Function Break
if VendorNo <> '' then
DetailedGSTLedgerEntry[1].SetRange("Source No.", VendorNo);
if ReverseCharge then
DetailedGSTLedgerEntry[1].SetRange("Document Type", DetailedGSTLedgerEntry[1]."Document Type"::Invoice)
else
DetailedGSTLedgerEntry[1].SetFilter("Document Type", '%1|%2',
DetailedGSTLedgerEntry[1]."Document Type"::Invoice, DetailedGSTLedgerEntry[1]."Document Type"::"Credit Memo");
if DocumentNo2 <> '' then
DetailedGSTLedgerEntry[1].SetRange("Document No.", DocumentNo2);
if ExternalDocNo <> '' then
DetailedGSTLedgerEntry[1].SetRange("External Document No.", ExternalDocNo);
if not (NatureOfAdj in [NatureOfAdj::"Credit Availment", NatureOfAdj::"Reversal of Availment"]) then
DetailedGSTLedgerEntry[1].SetRange("Credit Availed", true);
DetailedGSTLedgerEntry[1].SetRange(Distributed, false);
if ReverseCharge then begin
DetailedGSTLedgerEntry[1].SetRange("Reverse Charge", true);
DetailedGSTLedgerEntry[1].SetRange("GST Group Type", DetailedGSTLedgerEntry[1]."GST Group Type"::Service);
DetailedGSTLedgerEntry[1].SetRange("Item Charge Entry", false);
end else
DetailedGSTLedgerEntry[1].SetRange("Reverse Charge", false);
DetailedGSTLedgerEntry[1].SetRange("GST Exempted Goods", false);
DetailedGSTLedgerEntry[1].SetRange("Input Service Distribution", false);
AppyNatureofAdjFilters(DetailedGSTLedgerEntry, NatureOfAdj); //Function Break
if DetailedGSTLedgerEntry[1].FindSet() then
repeat
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry[1]."Entry No.", DetailedGSTLedgerEntryInfo);
if DetailedGSTLedgerEntryInfo."Last Credit Adjusted Date" > PostingDate then
Error(AdjustmentDateErr, DetailedGSTLedgerEntry[1]."Document No.", DetailedGSTLedgerEntryInfo."Last Credit Adjusted Date");
if GetCAJLines(DetailedGSTLedgerEntry[1], NatureOfAdj) then begin
if ReverseCharge and
((DetailedGSTLedgerEntry[1]."Document No." <> DocumentNo) or
(DetailedGSTLedgerEntry[1]."Document Line No." <> DocumentLineNo))
then
if IsComponentNonAvailment(DetailedGSTLedgerEntry[1]."Entry No.") then begin
TotalGSTAmount := 0;
CAJAmt := 0;
DocumentNo := DetailedGSTLedgerEntry[1]."Document No.";
DocumentLineNo := DetailedGSTLedgerEntry[1]."Document Line No.";
DetailedGSTLedgerEntry[2].CopyFilters(DetailedGSTLedgerEntry[1]);
DetailedGSTLedgerEntry[2].SetRange("Source No.", DetailedGSTLedgerEntry[1]."Source No.");
DetailedGSTLedgerEntry[2].SetRange("Document Type", DetailedGSTLedgerEntry[1]."Document Type");
DetailedGSTLedgerEntry[2].SetRange("Document No.", DetailedGSTLedgerEntry[1]."Document No.");
DetailedGSTLedgerEntry[2].SetRange("Document Line No.", DetailedGSTLedgerEntry[1]."Document Line No.");
if DetailedGSTLedgerEntry[2].FindSet() then begin
Cnt += 1;
DetailedGSTLedgerEntry[2].CalcSums("GST Amount");
DetailedGSTLedgerEntry[2].CalcSums("CAJ Amount");
DetailedGSTLedgerEntry[2].CalcSums("CAJ Amount Permanent Reversal");
TotalGSTAmount := Abs(DetailedGSTLedgerEntry[2]."GST Amount");
CAJAmt := Abs(DetailedGSTLedgerEntry[2]."CAJ Amount");
PermanentReversalAmt := Abs(DetailedGSTLedgerEntry[2]."CAJ Amount Permanent Reversal");
end;
InitCreditAdjustmentJournal(
DetailedGSTLedgerEntry[2], NatureOfAdj, AdjDocNo, PostingDate, ReverseCharge, TotalGSTAmount,
AdjustmentPerc, CAJAmt, PermanentReversalAmt);
end;
if not ReverseCharge and
((DetailedGSTLedgerEntry[1]."Document No." <> DocumentNo) or
(DetailedGSTLedgerEntry[1]."Document Line No." <> DocumentLineNo))
then begin
TotalGSTAmount := 0;
CAJAmt := 0;
DocumentNo := DetailedGSTLedgerEntry[1]."Document No.";
DocumentLineNo := DetailedGSTLedgerEntry[1]."Document Line No.";
DetailedGSTLedgerEntry[2].CopyFilters(DetailedGSTLedgerEntry[1]);
DetailedGSTLedgerEntry[2].SetRange("Source No.", DetailedGSTLedgerEntry[1]."Source No.");
DetailedGSTLedgerEntry[2].SetRange("Document Type", DetailedGSTLedgerEntry[1]."Document Type");
DetailedGSTLedgerEntry[2].SetRange("Document No.", DetailedGSTLedgerEntry[1]."Document No.");
DetailedGSTLedgerEntry[2].SetRange("Document Line No.", DetailedGSTLedgerEntry[1]."Document Line No.");
if DetailedGSTLedgerEntry[2].FindSet() then begin
Cnt += 1;
DetailedGSTLedgerEntry[2].CalcSums("GST Amount");
DetailedGSTLedgerEntry[2].CalcSums("CAJ Amount");
DetailedGSTLedgerEntry[2].CalcSums("CAJ Amount Permanent Reversal");
TotalGSTAmount := DetailedGSTLedgerEntry[2]."GST Amount";
CAJAmt := Abs(DetailedGSTLedgerEntry[2]."CAJ Amount");
PermanentReversalAmt := Abs(DetailedGSTLedgerEntry[2]."CAJ Amount Permanent Reversal");
end;
InitCreditAdjustmentJournal(
DetailedGSTLedgerEntry[2],
NatureOfAdj,
AdjDocNo,
PostingDate,
ReverseCharge,
TotalGSTAmount,
AdjustmentPerc,
CAJAmt,
PermanentReversalAmt);
end;
end;
until DetailedGSTLedgerEntry[1].Next() = 0
else
Error(GSTCrAdjFilterErr);
if Cnt = 0 then
Error(GSTCrAdjFilterErr);
end;
procedure PostCreditAdjustmentJnl(GSTCreditAdjustmentJournal: Record "GST Credit Adjustment Journal")
var
GenJnlLine: Record "Gen. Journal Line";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
GenLedgerSetup: Record "General Ledger Setup";
GenJournalPostLine: Codeunit "Gen. Jnl.-Post Line";
NoSeriesManagement: Codeunit NoSeriesManagement;
GSTHelpers: Codeunit "GST Helpers";
GSTBaseValidation: Codeunit "GST Base Validation";
EntryNo: Integer;
BalAccountNo: Code[20];
begin
if not Confirm(PostCrAdjQst, false) then
exit;
Clear(EntryNo);
TempGSTPostingBuffer[1].DeleteAll();
TempGSTPostingBuffer[2].DeleteAll();
GenLedgerSetup.Get();
GSTBaseValidation.CheckGSTAccountingPeriod(GSTCreditAdjustmentJournal."Adjustment Posting Date", false);
if GSTCreditAdjustmentJournal."Reverse Charge" then
EntryNo := PostReverseChargeCrAdjJournal(GSTCreditAdjustmentJournal)
else begin
Clear(GenJournalPostLine);
GSTCreditAdjustmentJournal.SetFilter("Nature of Adjustment", '<>%1', GSTCreditAdjustmentJournal."Nature of Adjustment"::" ");
if GSTCreditAdjustmentJournal.FindSet() then begin
repeat
GSTCreditAdjustmentJournal.Validate("Adjustment %");
GSTCreditAdjustmentJournal.Validate("Adjustment Amount");
TempGSTPostingBuffer[1].DeleteAll();
TempGSTPostingBuffer[2].DeleteAll();
DetailedGSTLedgerEntry.SetCurrentKey("Transaction Type", "GST Jurisdiction Type",
"Source No.", "Document Type", "Document No.", "Document Line No.", "Posting Date");
DetailedGSTLedgerEntry.SetRange("Transaction Type", DetailedGSTLedgerEntry."Transaction Type"::Purchase);
DetailedGSTLedgerEntry.SetRange("GST Jurisdiction Type", GSTCreditAdjustmentJournal."GST Jurisdiction Type");
DetailedGSTLedgerEntry.SetRange("Source No.", GSTCreditAdjustmentJournal."Vendor No.");
if GSTCreditAdjustmentJournal."Document Type" = GSTCreditAdjustmentJournal."Document Type"::Invoice then
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedGSTLedgerEntry."Document Type"::Invoice)
else
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedGSTLedgerEntry."Document Type"::"Credit Memo");
DetailedGSTLedgerEntry.SetRange("Document No.", GSTCreditAdjustmentJournal."Document No.");
DetailedGSTLedgerEntry.SetRange("Document Line No.", GSTCreditAdjustmentJournal."Document Line No.");
DetailedGSTLedgerEntry.SetRange("Posting Date", GSTCreditAdjustmentJournal."Posting Date");
DetailedGSTLedgerEntry.SetRange("GST Credit", DetailedGSTLedgerEntry."GST Credit"::Availment);
DetailedGSTLedgerEntry.SetRange(Distributed, false);
DetailedGSTLedgerEntry.SetRange("Reverse Charge", false);
DetailedGSTLedgerEntry.SetRange("GST Exempted Goods", false);
if DetailedGSTLedgerEntry.FindSet() then
repeat
TempGSTPostingBuffer[1]."Transaction Type" := TempGSTPostingBuffer[1]."Transaction Type"::Purchase;
TempGSTPostingBuffer[1]."GST Component Code" := DetailedGSTLedgerEntry."GST Component Code";
TempGSTPostingBuffer[1]."GST Amount" :=
-Abs(Round((DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GenLedgerSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."GST Base Amount" :=
-Abs(Round((DetailedGSTLedgerEntry."GST Base Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GenLedgerSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."Global Dimension 1 Code" := GSTCreditAdjustmentJournal."Shortcut Dimension 1 Code";
TempGSTPostingBuffer[1]."Global Dimension 2 Code" := GSTCreditAdjustmentJournal."Shortcut Dimension 2 Code";
TempGSTPostingBuffer[1]."Dimension Set ID" := GSTCreditAdjustmentJournal."Dimension Set ID";
case GSTCreditAdjustmentJournal."Nature of Adjustment" of
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal":
begin
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTPayableAccountNo(
GSTCreditAdjustmentJournal."Location State Code",
DetailedGSTLedgerEntry."GST Component Code");
TempGSTPostingBuffer[1]."GST Amount" := -TempGSTPostingBuffer[1]."GST Amount";
TempGSTPostingBuffer[1]."GST Base Amount" := -TempGSTPostingBuffer[1]."GST Base Amount";
end;
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment":
if GSTCreditAdjustmentJournal."Input Service Distribution" then
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTReceivableDistAccountNo(
GSTCreditAdjustmentJournal."Location State Code",
DetailedGSTLedgerEntry."GST Component Code")
else
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTReceivableAccountNo(
GSTCreditAdjustmentJournal."Location State Code", DetailedGSTLedgerEntry."GST Component Code");
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Permanent Reversal":
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTExpenseAccountNo(
GSTCreditAdjustmentJournal."Location State Code",
DetailedGSTLedgerEntry."GST Component Code")
end;
UpdateGSTPostingBuffer();
UpdateDetailedGSTLedgerEntry(
GSTCreditAdjustmentJournal."Nature of Adjustment",
DetailedGSTLedgerEntry."Entry No.",
GSTCreditAdjustmentJournal."Adjustment Posting Date",
TempGSTPostingBuffer[1]."GST Amount",
GSTCreditAdjustmentJournal."Adjustment %",
TempGSTPostingBuffer[1]."GST Base Amount");
PostToDetailedCrAdjEntry(DetailedGSTLedgerEntry, GSTCreditAdjustmentJournal);
until DetailedGSTLedgerEntry.Next() = 0;
if TempGSTPostingBuffer[1].Find('+') then
repeat
BalAccountNo :=
GSTHelpers.GetGSTMismatchAccountNo(
GSTCreditAdjustmentJournal."Location State Code", TempGSTPostingBuffer[1]."GST Component Code");
if GSTCreditAdjustmentJournal."Document Type" = GSTCreditAdjustmentJournal."Document Type"::Invoice then
PostGenJnlLine(
GenJnlLine,
TempGSTPostingBuffer[1]."Account No.",
BalAccountNo,
GSTCreditAdjustmentJournal."Adjust Document No.",
TempGSTPostingBuffer[1]."GST Amount",
GSTCreditAdjustmentJournal."Adjustment Posting Date",
GenJnlLine."Document Type"::Invoice,
GSTCreditAdjustmentJournal."GST Jurisdiction Type",
false,
false,
TempGSTPostingBuffer[1]."Dimension Set ID")
else
PostGenJnlLine(
GenJnlLine,
TempGSTPostingBuffer[1]."Account No.",
BalAccountNo,
GSTCreditAdjustmentJournal."Adjust Document No.",
TempGSTPostingBuffer[1]."GST Amount",
GSTCreditAdjustmentJournal."Adjustment Posting Date",
GenJnlLine."Document Type"::"Credit Memo",
GSTCreditAdjustmentJournal."GST Jurisdiction Type",
false,
false,
TempGSTPostingBuffer[1]."Dimension Set ID");
EntryNo := GenJournalPostLine.RunWithCheck(GenJnlLine);
until TempGSTPostingBuffer[1].Next(-1) = 0;
until GSTCreditAdjustmentJournal.Next() = 0;
NoSeriesManagement.GetNextNo(GetNoSeriesCode(false), GSTCreditAdjustmentJournal."Posting Date", true);
end;
end;
if EntryNo <> 0 then
Message(CrAdjstPostedMsg)
else
Error(NoPostErr);
end;
procedure GetNoSeriesCode(CreditLiability: Boolean): Code[20]
var
GeneLedgerSetup: Record "General Ledger Setup";
PurchasesPayablesSetup: Record "Purchases & Payables Setup";
begin
if CreditLiability then begin
PurchasesPayablesSetup.Get();
PurchasesPayablesSetup.TestField("GST Liability Adj. Jnl Nos.");
exit(PurchasesPayablesSetup."GST Liability Adj. Jnl Nos.");
end;
GeneLedgerSetup.Get();
GeneLedgerSetup.TestField("GST Credit Adj. Jnl Nos.");
exit(GeneLedgerSetup."GST Credit Adj. Jnl Nos.");
end;
procedure FillGSTLiabilityAdjustmentJournal(
GSTINNo: Code[20];
VendorNo: Code[20];
LiabilityDate: Date;
DocumentNo1: Code[20];
ExternalDocNo: Code[35];
NatureOfAdj: Enum "Cr Libty Adjustment Type";
AdjDocNo: Code[20];
AdjPostingDate: Date)
var
VendorLedgerEntry: Record "Vendor Ledger Entry";
GSTLiabilityBuffer: Record "GST Liability Buffer";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
PostedGSTLiabilityAdj: Record "Posted GST Liability Adj.";
RemainingAmount: Decimal;
DocumentNo2: Code[20];
begin
GetLiabilitySourceCode();
GSTLiabilityBuffer.DeleteAll();
if NatureOfAdj = NatureOfAdj::Generate then begin
VendorLedgerEntry.SetCurrentKey("Document No.", "Document Type", "Vendor No.");
if DocumentNo1 <> '' then
VendorLedgerEntry.SetRange("Document No.", DocumentNo1);
VendorLedgerEntry.SetRange("Document Type", "Document Type Enum"::Invoice);
if VendorNo <> '' then
VendorLedgerEntry.SetRange("Vendor No.", VendorNo);
VendorLedgerEntry.SetRange(Open, true);
VendorLedgerEntry.SetFilter("Posting Date", '..%1', LiabilityDate);
if ExternalDocNo <> '' then
VendorLedgerEntry.SetRange("External Document No.", ExternalDocNo);
VendorLedgerEntry.SetFilter(
VendorLedgerEntry."GST Vendor Type", '%1|%2|%3|%4',
"GST Vendor Type"::Registered, "GST Vendor Type"::Unregistered, "GST Vendor Type"::Import, "GST Vendor Type"::SEZ);
VendorLedgerEntry.CalcFields("Remaining Amt. (LCY)");
VendorLedgerEntry.SetFilter("Remaining Amt. (LCY)", '<>%1', 0);
VendorLedgerEntry.SetRange("Location GST Reg. No.", GSTINNo);
if VendorLedgerEntry.FindSet() then
repeat
VendorLedgerEntry.CalcFields("Remaining Amt. (LCY)");
RemainingAmount := VendorLedgerEntry."Remaining Amt. (LCY)" - VendorLedgerEntry."Total TDS Including SHE CESS";
FillAppBufferInvoice(
VendorLedgerEntry."Document No.",
VendorLedgerEntry."Location GST Reg. No.",
LiabilityDate,
NatureOfAdj);
AllocateGSTWithPayment(VendorLedgerEntry."Document No.", VendorLedgerEntry."Vendor No.", RemainingAmount);
FillGSTCreditLiability(VendorLedgerEntry, AdjDocNo, AdjPostingDate, NatureOfAdj);
until VendorLedgerEntry.Next() = 0
else
Error(GSTCrAdjFilterErr);
end;
if NatureOfAdj = NatureOfAdj::Reverse then begin
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedGSTLedgerEntry."Document Type"::Invoice);
DetailedGSTLedgerEntry.SetRange("Transaction Type", DetailedGSTLedgerEntry."Transaction Type"::Purchase);
DetailedGSTLedgerEntry.SetRange("Entry Type", DetailedGSTLedgerEntry."Entry Type"::"Initial Entry");
if DocumentNo1 <> '' then
DetailedGSTLedgerEntry.SetRange("Document No.", DocumentNo1);
if VendorNo <> '' then
DetailedGSTLedgerEntry.SetRange("Source No.", VendorNo);
DetailedGSTLedgerEntry.SetRange("Location Reg. No.", GSTINNo);
DetailedGSTLedgerEntry.SetFilter("Posting Date", '..%1', LiabilityDate);
DetailedGSTLedgerEntry.SetRange("Cr. & Liab. Adjustment Type", DetailedGSTLedgerEntry."Cr. & Liab. Adjustment Type"::Generate);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if DocumentNo2 <> DetailedGSTLedgerEntry."Document No." then begin
PostedGSTLiabilityAdj.SetRange("Document No.", DetailedGSTLedgerEntry."Document No.");
PostedGSTLiabilityAdj.SetRange("Credit Adjustment Type", DetailedGSTLedgerEntry."Cr. & Liab. Adjustment Type");
if PostedGSTLiabilityAdj.FindLast() then
if PostedGSTLiabilityAdj."Posting Date" <= AdjPostingDate then begin
FillAppBufferInvoice(
DetailedGSTLedgerEntry."Document No.",
DetailedGSTLedgerEntry."Location Reg. No.",
LiabilityDate,
NatureOfAdj);
FillGSTCreditLiabilityReverse(
DetailedGSTLedgerEntry,
AdjDocNo,
AdjPostingDate,
NatureOfAdj);
end;
DocumentNo2 := DetailedGSTLedgerEntry."Document No.";
end;
until DetailedGSTLedgerEntry.Next() = 0;
end;
end;
procedure FillAppBufferInvoice(
DocumentNo: Code[20];
LocationRegNo: Code[20];
LiabilityDate: Date;
NatureOfAdj: Enum "Cr Libty Adjustment Type")
var
GSTLiabilityBuffer: array[2] of Record "GST Liability Buffer";
DetailedGSTLedgerEntry: array[2] of Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
GSTBaseValidation: Codeunit "GST Base Validation";
CurrencyFactor: Decimal;
begin
DetailedGSTLedgerEntry[1].SetCurrentKey(
"Location Reg. No.", "Transaction Type", "Entry Type", "GST Vendor Type", "GST Credit",
"Posting Date", "Source No.", "Document Type", "Document No.");
DetailedGSTLedgerEntry[1].SetRange("Location Reg. No.", LocationRegNo);
DetailedGSTLedgerEntry[1].SetRange("Document No.", DocumentNo);
DetailedGSTLedgerEntry[1].SetRange("Transaction Type", DetailedGSTLedgerEntry[1]."Transaction Type"::Purchase);
DetailedGSTLedgerEntry[1].SetRange("GST Group Type", DetailedGSTLedgerEntry[1]."GST Group Type"::Service);
DetailedGSTLedgerEntry[1].SetRange("Reverse Charge", true);
DetailedGSTLedgerEntry[1].SetRange("Associated Enterprises", false);
DetailedGSTLedgerEntry[1].SetFilter("Posting Date", '..%1', LiabilityDate);
if NatureOfAdj = NatureOfAdj::Reverse then
DetailedGSTLedgerEntry[1].SetRange("Cr. & Liab. Adjustment Type", NatureOfAdj::Generate);
if DetailedGSTLedgerEntry[1].FindSet() then
repeat
if (NatureOfAdj = NatureOfAdj::Generate) and
(DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type" =
DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type"::Generate) and
(DetailedGSTLedgerEntry[1]."Remaining Base Amount" = 0)
then
exit;
if (DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type" =
DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type"::Generate) and
(DetailedGSTLedgerEntry[1]."Remaining Base Amount" <> 0) and
(DetailedGSTLedgerEntry[1]."Remaining Base Amount" = DetailedGSTLedgerEntry[1]."AdjustmentBase Amount")
then begin
DetailedGSTLedgerEntry[1]."Remaining Base Amount" := 0;
DetailedGSTLedgerEntry[1]."Remaining GST Amount" := 0;
DetailedGSTLedgerEntry[1].Modify();
exit;
end;
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry[1]."Entry No.", DetailedGSTLedgerEntryInfo);
Clear(GSTLiabilityBuffer[1]);
CurrencyFactor := 1;
GSTLiabilityBuffer[1]."Transaction Type" := DetailedGSTLedgerEntry[1]."Transaction Type";
GSTLiabilityBuffer[1]."Original Document Type" := GSTLiabilityBuffer[1]."Original Document Type"::Invoice;
GSTLiabilityBuffer[1]."Original Document No." := DetailedGSTLedgerEntry[1]."Document No.";
GSTLiabilityBuffer[1]."Account No." := DetailedGSTLedgerEntry[1]."Source No.";
GSTLiabilityBuffer[1]."GST Cess" := DetailedGSTLedgerEntryInfo.Cess;
GSTLiabilityBuffer[1]."GST Component Code" := DetailedGSTLedgerEntry[1]."GST Component Code";
GSTLiabilityBuffer[1]."Current Doc. Type" := DetailedGSTLedgerEntry[1]."Document Type";
GSTLiabilityBuffer[1]."Currency Code" := DetailedGSTLedgerEntry[1]."Currency Code";
GSTLiabilityBuffer[1]."Currency Factor" := DetailedGSTLedgerEntry[1]."Currency Factor";
GSTLiabilityBuffer[1]."GST Rounding Precision" := DetailedGSTLedgerEntry[1]."GST Rounding Precision";
GSTLiabilityBuffer[1]."GST Rounding Type" := DetailedGSTLedgerEntry[1]."GST Rounding Type";
GSTLiabilityBuffer[1]."GST Group Type" := DetailedGSTLedgerEntry[1]."GST Group Type";
GSTLiabilityBuffer[1]."GST Group Code" := DetailedGSTLedgerEntry[1]."GST Group Code";
GSTLiabilityBuffer[1]."GST Jurisdiction Type" := DetailedGSTLedgerEntry[1]."GST Jurisdiction Type";
GSTLiabilityBuffer[1]."Original Line No." := DetailedGSTLedgerEntry[1]."Document Line No.";
GSTLiabilityBuffer[1].Exempted := DetailedGSTLedgerEntry[1]."GST Exempted Goods";
GSTLiabilityBuffer[1]."GST %" := DetailedGSTLedgerEntry[1]."GST %";
GSTLiabilityBuffer[1]."GST Credit" := DetailedGSTLedgerEntry[1]."GST Credit";
if GSTLiabilityBuffer[1]."Currency Code" <> '' then
GSTLiabilityBuffer[1]."GST Base Amount" := Round(DetailedGSTLedgerEntry[1]."GST Base Amount" * CurrencyFactor, 0.01)
else
GSTLiabilityBuffer[1]."GST Base Amount" := DetailedGSTLedgerEntry[1]."GST Base Amount";
GSTLiabilityBuffer[1]."GST Amount" := GSTBaseValidation.RoundGSTPrecision(DetailedGSTLedgerEntry[1]."GST Amount" * CurrencyFactor);
if (DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type" =
DetailedGSTLedgerEntry[1]."Cr. & Liab. Adjustment Type"::Generate) and
(DetailedGSTLedgerEntry[1]."Remaining Base Amount" <> 0)
then begin
if GSTLiabilityBuffer[1]."Currency Code" <> '' then
GSTLiabilityBuffer[1]."GST Base Amount" := Round(DetailedGSTLedgerEntry[1]."Remaining Base Amount" * CurrencyFactor, 0.01)
else
GSTLiabilityBuffer[1]."GST Base Amount" := DetailedGSTLedgerEntry[1]."Remaining Base Amount";
GSTLiabilityBuffer[1]."GST Amount" := GSTBaseValidation.RoundGSTPrecision(DetailedGSTLedgerEntry[1]."Remaining GST Amount" * CurrencyFactor);
end;
if NatureOfAdj = NatureOfAdj::Reverse then begin
if GSTLiabilityBuffer[1]."Currency Code" <> '' then
GSTLiabilityBuffer[1]."Applied Base Amount" := Round(DetailedGSTLedgerEntry[1]."AdjustmentBase Amount" * CurrencyFactor, 0.01)
else
GSTLiabilityBuffer[1]."Applied Base Amount" := DetailedGSTLedgerEntry[1]."AdjustmentBase Amount";
GSTLiabilityBuffer[1]."Applied Amount" := GSTBaseValidation.RoundGSTPrecision(DetailedGSTLedgerEntry[1]."Adjustment Amount" * CurrencyFactor);
if DetailedGSTLedgerEntry[1]."GST Credit" = DetailedGSTLedgerEntry[1]."GST Credit"::Availment then
GSTLiabilityBuffer[1]."Credit Amount" := GSTLiabilityBuffer[1]."Applied Amount";
end;
GSTLiabilityBuffer[2] := GSTLiabilityBuffer[1];
if GSTLiabilityBuffer[2].Find() then begin
GSTLiabilityBuffer[2]."GST Base Amount" += GSTLiabilityBuffer[1]."GST Base Amount";
GSTLiabilityBuffer[2]."GST Base Amount" += 0;
GSTLiabilityBuffer[2]."GST Amount" += GSTLiabilityBuffer[1]."GST Amount";
GSTLiabilityBuffer[2]."Credit Amount" += GSTLiabilityBuffer[1]."Credit Amount";
if NatureOfAdj = NatureOfAdj::Reverse then begin
GSTLiabilityBuffer[2]."Applied Base Amount" += GSTLiabilityBuffer[1]."Applied Base Amount";
GSTLiabilityBuffer[2]."Applied Amount" += GSTLiabilityBuffer[1]."Applied Amount"
end;
GSTLiabilityBuffer[2].Modify(true);
end else
GSTLiabilityBuffer[2].Insert(true);
until DetailedGSTLedgerEntry[1].Next() = 0;
end;
procedure PostLiabilityAdjustmentJnl(GSTLiabilityAdjustment: Record "GST Liability Adjustment")
var
GSTLiabilityBuffer: Record "GST Liability Buffer";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
GenJnlLine: Record "Gen. Journal Line";
NoSeriesManagement: Codeunit NoSeriesManagement;
AppliedBase: Decimal;
AppliedAmount: Decimal;
RemainingBase: Decimal;
RemainingAmount: Decimal;
AccountNo: Code[20];
AccountNo2: Code[20];
BalanceAccountNo: Code[20];
BalanceAccountNo2: Code[20];
begin
GSTLiabilityAdjustment.SetFilter("Nature of Adjustment", '<>%1', GSTLiabilityAdjustment."Nature of Adjustment"::" ");
if GSTLiabilityAdjustment.FindSet() then begin
repeat
TempGSTPostingBuffer1[1].DeleteAll();
GSTLiabilityBuffer.SetRange("Original Document No.", GSTLiabilityAdjustment."Document No.");
GSTLiabilityBuffer.SetRange("Account No.", GSTLiabilityAdjustment."Vendor No.");
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Generate then
GSTLiabilityBuffer.SetFilter("Applied Amount", '<>%1', 0);
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Reverse then
GSTLiabilityBuffer.SetFilter("GST Amount", '<>%1', 0);
if GSTLiabilityBuffer.FindSet() then
repeat
DetailedGSTLedgerEntry.SetCurrentKey(
"Transaction Type",
"Source No.",
"Document Type",
"Document No.",
"GST Group Code");
DetailedGSTLedgerEntry.SetRange("Transaction Type", DetailedGSTLedgerEntry."Transaction Type"::Purchase);
DetailedGSTLedgerEntry.SetRange("Source No.", GSTLiabilityBuffer."Account No.");
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedGSTLedgerEntry."Document Type"::Invoice);
DetailedGSTLedgerEntry.SetRange("Document No.", GSTLiabilityBuffer."Original Document No.");
DetailedGSTLedgerEntry.SetRange("Entry Type", DetailedGSTLedgerEntry."Entry Type"::"Initial Entry");
DetailedGSTLedgerEntry.SetRange("GST Group Code", GSTLiabilityBuffer."GST Group Code");
DetailedGSTLedgerEntry.SetRange("GST Component Code", GSTLiabilityBuffer."GST Component Code");
DetailedGSTLedgerEntry.SetRange("GST Exempted Goods", GSTLiabilityBuffer.Exempted);
if DetailedGSTLedgerEntry.FindSet() then begin
RemainingBase := GSTLiabilityBuffer."Applied Base Amount";
RemainingAmount := GSTLiabilityBuffer."Applied Amount";
repeat
if RemainingBase <> 0 then begin
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Reverse then
GetAppliedAmount(
Abs(RemainingBase),
Abs(RemainingAmount),
Abs(DetailedGSTLedgerEntry."AdjustmentBase Amount"),
Abs(DetailedGSTLedgerEntry."Adjustment Amount"),
AppliedBase,
AppliedAmount)
else
GetAppliedAmount(
Abs(RemainingBase),
Abs(RemainingAmount),
Abs(DetailedGSTLedgerEntry."Remaining Base Amount"),
Abs(DetailedGSTLedgerEntry."Remaining GST Amount"),
AppliedBase,
AppliedAmount);
FillGSTPostingBufferWithApplication(
DetailedGSTLedgerEntry,
AppliedBase,
AppliedAmount,
GSTLiabilityAdjustment."Dimension Set ID");
PostCreditAdjustJnl(
GSTLiabilityBuffer,
GSTLiabilityAdjustment,
DetailedGSTLedgerEntry,
AppliedBase,
AppliedAmount);
RemainingBase := Abs(RemainingBase) - Abs(AppliedBase);
RemainingAmount := Abs(RemainingAmount) - Abs(AppliedAmount);
end;
UpdateServiceLiabilityDetailedGSTLedgerEntry(
GSTLiabilityAdjustment."Nature of Adjustment",
DetailedGSTLedgerEntry."Entry No.",
AppliedBase,
AppliedAmount);
until DetailedGSTLedgerEntry.Next() = 0;
end;
until GSTLiabilityBuffer.Next() = 0;
Clear(GenJnlPostLine);
if TempGSTPostingBuffer1[1].Find('+') then
repeat
if TempGSTPostingBuffer1[1]."GST Amount" <> 0 then begin
GetCreditAccountNormalPayment(
DetailedGSTLedgerEntry, TempGSTPostingBuffer1[1], AccountNo, AccountNo2,
BalanceAccountNo, BalanceAccountNo2);
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Generate then
PostGenJnlLine(
GenJnlLine,
AccountNo,
BalanceAccountNo,
GSTLiabilityAdjustment."Document No.",
TempGSTPostingBuffer1[1]."GST Amount",
GSTLiabilityAdjustment."Adjustment Posting Date",
GenJnlLine."Document Type"::Invoice,
GSTLiabilityAdjustment."GST Jurisdiction Type",
true,
false,
TempGSTPostingBuffer1[1]."Dimension Set ID")
else
PostGenJnlLine(
GenJnlLine,
AccountNo,
BalanceAccountNo,
GSTLiabilityAdjustment."Document No.",
-TempGSTPostingBuffer1[1]."GST Amount",
GSTLiabilityAdjustment."Adjustment Posting Date",
GenJnlLine."Document Type"::Invoice,
GSTLiabilityAdjustment."GST Jurisdiction Type",
true,
false,
TempGSTPostingBuffer1[1]."Dimension Set ID");
GenJnlPostLine.RunWithCheck(GenJnlLine);
if AccountNo2 <> '' then begin
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Generate then
PostGenJnlLine(
GenJnlLine,
AccountNo2,
BalanceAccountNo2,
GSTLiabilityAdjustment."Document No.",
TempGSTPostingBuffer1[1]."GST Amount",
GSTLiabilityAdjustment."Adjustment Posting Date",
GenJnlLine."Document Type"::Invoice,
GSTLiabilityAdjustment."GST Jurisdiction Type",
true,
false,
TempGSTPostingBuffer1[1]."Dimension Set ID")
else
PostGenJnlLine(
GenJnlLine,
AccountNo2,
BalanceAccountNo2,
GSTLiabilityAdjustment."Document No.",
-TempGSTPostingBuffer1[1]."GST Amount",
GSTLiabilityAdjustment."Adjustment Posting Date",
GenJnlLine."Document Type"::Invoice,
GSTLiabilityAdjustment."GST Jurisdiction Type",
true,
false,
TempGSTPostingBuffer1[1]."Dimension Set ID");
GenJnlPostLine.RunWithCheck(GenJnlLine);
end;
end;
until TempGSTPostingBuffer1[1].Next(-1) = 0;
until GSTLiabilityAdjustment.Next() = 0;
NoSeriesManagement.GetNextNo(GetNoSeriesCode(true), GSTLiabilityAdjustment."Adjustment Posting Date", true);
end;
end;
procedure ApplyGSTSettlement(
GSTINNo: Code[20];
PostingDate: Date;
AccountType: Enum "GST Settlement Account Type";
AccountNo: Code[20];
BankRefNo: Code[10];
BankRefDate: Date)
var
GSTPaymentBuffer: Record "GST Payment Buffer";
PayGST: Page "Pay GST";
ApplyDocumentNo: Code[20];
begin
CheckSettlementInputValidations(GSTINNo, PostingDate);
ApplyDocumentNo := GetSettlementDocumentNo(PostingDate, false);
GSTPaymentBuffer.SetRange("Document No.", ApplyDocumentNo);
GSTPaymentBuffer.DeleteAll();
IsDuplicateDocumentNo(ApplyDocumentNo);
CreateGSTPaymentBuffer(GSTINNo, ApplyDocumentNo, PostingDate, AccountType, AccountNo, BankRefNo, BankRefDate);
UpdateCreditAmount(GSTINNo, ApplyDocumentNo);
Commit();
PayGST.SetParameter(GSTINNo, ApplyDocumentNo);
PayGST.RunModal();
end;
procedure IsDuplicateDocumentNo(DocumentNo: Code[20])
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
begin
if DocumentNo = '' then
exit;
DetailedGSTLedgerEntry.SetCurrentKey("Payment Document No.");
DetailedGSTLedgerEntry.SetRange("Payment Document No.", DocumentNo);
if not DetailedGSTLedgerEntry.IsEmpty() then
Error(PaymentDocErr, DocumentNo);
end;
procedure UpdateCreditAmount(GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
UpdateGSTPaymentBufferPriorityAmount(GSTPaymentBuffer, GSTINNo, DocumentNo);
until GSTPaymentBuffer.Next() = 0;
end;
local procedure UpdateGSTPaymentBufferPriorityAmount(var GSTPaymentBuffer: Record "GST Payment Buffer"; GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTClaimSetoff: Record "GST Claim Setoff";
GSTPaymentBuffer2: Record "GST Payment Buffer";
AvailableAmount: Decimal;
PaymentAmount: Decimal;
begin
if GSTPaymentBuffer."Payment Amount" > 0 then begin
AvailableAmount := 0;
GSTClaimSetoff.Reset();
GSTClaimSetoff.SetCurrentKey(Priority);
GSTClaimSetoff.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
if GSTClaimSetoff.FindSet() then
repeat
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
if GSTPaymentBuffer2."Total Credit Available" > 0 then begin
AvailableAmount += GSTPaymentBuffer2."Total Credit Available" - GSTPaymentBuffer2."Surplus Cr. Utilized";
PaymentAmount := GSTPaymentBuffer."Payment Amount";
if AvailableAmount > 0 then begin
if AvailableAmount >= PaymentAmount then begin
if GSTPaymentBuffer."GST Component Code" = GSTPaymentBuffer2."GST Component Code" then begin
UpdateGSTPaymentSameComponentAmount(GSTPaymentBuffer, PaymentAmount);
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
end else
UpdateGSTPaymentDiffComponentAmount(GSTPaymentBuffer2, PaymentAmount);
GSTPaymentBuffer.Validate("Payment Amount", 0);
GSTPaymentBuffer."Credit Utilized" := GSTPaymentBuffer."Credit Utilized" + PaymentAmount;
GSTPaymentBuffer.Modify();
end else begin
if GSTPaymentBuffer."GST Component Code" = GSTPaymentBuffer2."GST Component Code" then begin
UpdateGSTPaymentSameComponentAmount(GSTPaymentBuffer, AvailableAmount);
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
end else
UpdateGSTPaymentDiffComponentAmount(GSTPaymentBuffer2, AvailableAmount);
GSTPaymentBuffer.Validate("Payment Amount", GSTPaymentBuffer."Payment Amount" - AvailableAmount);
GSTPaymentBuffer."Credit Utilized" := GSTPaymentBuffer."Credit Utilized" + AvailableAmount;
GSTPaymentBuffer.Modify();
AvailableAmount := 0;
end;
GSTPaymentBuffer2."Carry Forward" := GSTPaymentBuffer2."Surplus Credit";
GSTPaymentBuffer2.Modify(true);
GSTPaymentBuffer.Modify(true);
end;
end;
until (GSTClaimSetoff.Next() = 0) or (GSTPaymentBuffer."Payment Amount" = 0);
end;
end;
local procedure UpdateGSTPaymentSameComponentAmount(var GSTPaymentBuffer: Record "GST Payment Buffer"; SurplusCredit: Decimal)
begin
GSTPaymentBuffer."Surplus Cr. Utilized" += SurplusCredit;
GSTPaymentBuffer."Surplus Credit" -= SurplusCredit;
GSTPaymentBuffer."Carry Forward" := GSTPaymentBuffer."Surplus Credit";
GSTPaymentBuffer.Modify(true);
end;
local procedure UpdateGSTPaymentDiffComponentAmount(var GSTPaymentBuffer2: Record "GST Payment Buffer"; SurplusCredit: Decimal)
begin
GSTPaymentBuffer2."Surplus Cr. Utilized" += SurplusCredit;
GSTPaymentBuffer2."Surplus Credit" -= SurplusCredit;
end;
procedure GetPeriodendDate(PostingDate: Date): Date
begin
exit(CalcDate('<-CM-1D>', PostingDate));
end;
procedure PostGSTPayment(GSTINNo: Code[20]; DocumentNo: Code[20]; var NoMsg: Boolean): Boolean
var
GSTPaymentBuffer: Record "GST Payment Buffer";
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.IsEmpty() then
exit(false);
CopyDocDimToTempDocDim(GSTINNo, DocumentNo);
ValidateCreditUtilizedAmt(GSTINNo, DocumentNo);
CheckSettlementValidations(GSTINNo, DocumentNo);
if not Confirm(PostGSTPaymentQst, false) then begin
NoMsg := true;
exit(false);
end;
if IsAllComponentsHaveZeroValue(GSTINNo, DocumentNo) then
exit(false);
PostGSTBuffer(GSTINNo, DocumentNo);
exit(true);
end;
procedure IsGSTPaymentApplicable(var GSTPaymentBuffer: Record "GST Payment Buffer"): Boolean
begin
if (GSTPaymentBuffer."Net Payment Liability" > 0) and
((GSTPaymentBuffer."Credit Utilized" > 0) or
(GSTPaymentBuffer."Payment Amount" > 0) or
(GSTPaymentBuffer."Total Credit Available" > 0)) or
(GSTPaymentBuffer.Penalty > 0) or
(GSTPaymentBuffer.Interest > 0) or
(GSTPaymentBuffer.Fees > 0) or
(GSTPaymentBuffer.Others > 0) or
(GSTPaymentBuffer."Payment Liability - Rev. Chrg." > 0) or
(GSTPaymentBuffer."Surplus Cr. Utilized" > 0) or
(GSTPaymentBuffer."Carry Forward" > 0) or
(GSTPaymentBuffer."UnAdjutsed Credit" < 0) or
(GSTPaymentBuffer."GST TDS Credit Utilized" > 0) or
(GSTPaymentBuffer."GST TCS Credit Utilized" > 0) or
(GSTPaymentBuffer."GST TCS Liability" > 0)
then
exit(true);
exit(false);
end;
procedure UpdateAdjRemAmt()
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
DetailedCrAdjstmntEntry: Record "Detailed Cr. Adjstmnt. Entry";
DetailedCrAdjstmntEntry2: Record "Detailed Cr. Adjstmnt. Entry";
SourceType: Text;
SourceTypeEnum: Enum "Source Type";
begin
DetailedCrAdjstmntEntry.SetRange("Rem. Amt. Updated in DGLE", false);
if DetailedCrAdjstmntEntry.FindSet() then begin
repeat
SourceType := Format(DetailedCrAdjstmntEntry."Source Type");
Evaluate(SourceTypeEnum, SourceType);
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedCrAdjstmntEntry."Adjusted Doc. Type");
DetailedGSTLedgerEntry.SetRange("Document No.", DetailedCrAdjstmntEntry."Adjusted Doc. No.");
DetailedGSTLedgerEntry.SetRange("Document Line No.", DetailedCrAdjstmntEntry."Adjusted Doc. Line No.");
DetailedGSTLedgerEntry.SetRange("Source Type", SourceTypeEnum);
DetailedGSTLedgerEntry.SetRange("Source No.", DetailedCrAdjstmntEntry."Source No.");
DetailedGSTLedgerEntry.SetRange(Type, DetailedCrAdjstmntEntry.Type);
DetailedGSTLedgerEntry.SetRange("GST Component Code", DetailedCrAdjstmntEntry."GST Component Code");
if DetailedGSTLedgerEntry.FindFirst() then begin
DetailedGSTLedgerEntry."CAJ Base Amount" := Abs(DetailedGSTLedgerEntry."CAJ Amount" * 100) /
DetailedGSTLedgerEntry."GST %";
DetailedGSTLedgerEntry."Remaining CAJ Adj. Base Amt" :=
Abs(Abs(DetailedGSTLedgerEntry."GST Base Amount") - Abs(DetailedGSTLedgerEntry."CAJ Base Amount"));
DetailedGSTLedgerEntry."Remaining CAJ Adj. Amt" :=
Abs(Abs(DetailedGSTLedgerEntry."GST Amount") - Abs(DetailedGSTLedgerEntry."CAJ Amount"));
DetailedGSTLedgerEntry.Modify();
DetailedCrAdjstmntEntry2.Get(DetailedCrAdjstmntEntry."Entry No.");
DetailedCrAdjstmntEntry2."Rem. Amt. Updated in DGLE" := true;
DetailedCrAdjstmntEntry2.Modify();
end;
until DetailedCrAdjstmntEntry.Next() = 0;
Message(RemCreditAmtupdatedMsg);
end else
Message(NothingtoUpdateMsg);
end;
local procedure ApplyReverseChargeFilter(
var DetailedGSTLedgerEntry: array[2] of Record "Detailed GST Ledger Entry";
NatureOfAdj: Enum "Credit Adjustment Type";
ReverseCharge: Boolean;
PeriodMonth: Integer;
PeriodYear: Integer)
begin
if ReverseCharge then begin
DetailedGSTLedgerEntry[1].SetRange("Entry Type", DetailedGSTLedgerEntry[1]."Entry Type"::Application);
if NatureOfAdj in [NatureOfAdj::"Credit Reversal", NatureOfAdj::"Credit Re-Availment"] then
DetailedGSTLedgerEntry[1].SetRange("GST Credit", DetailedGSTLedgerEntry[1]."GST Credit"::Availment)
else
if NatureOfAdj in [NatureOfAdj::"Credit Availment", NatureOfAdj::"Reversal of Availment"] then
DetailedGSTLedgerEntry[1].SetRange("GST Credit", DetailedGSTLedgerEntry[1]."GST Credit"::"Non-Availment");
end else begin
DetailedGSTLedgerEntry[1].SetRange("Entry Type", DetailedGSTLedgerEntry[1]."Entry Type"::"Initial Entry");
DetailedGSTLedgerEntry[1].SetRange("GST Vendor Type", DetailedGSTLedgerEntry[1]."GST Vendor Type"::Registered);
DetailedGSTLedgerEntry[1].SetRange("GST Credit", DetailedGSTLedgerEntry[1]."GST Credit"::Availment);
end;
DetailedGSTLedgerEntry[1].SetFilter("Posting Date", '<=%1', CalcDate('<CM>', DMY2Date(1, PeriodMonth, PeriodYear)));
end;
local procedure AppyNatureofAdjFilters(
var DetailedGSTLedgerEntry: array[2] of Record "Detailed GST Ledger Entry";
NatureOfAdj: Enum "Credit Adjustment Type")
begin
if NatureOfAdj in [NatureOfAdj::"Credit Reversal"] then
DetailedGSTLedgerEntry[1].SetFilter(
"Credit Adjustment Type", '%1|%2|%3|%4',
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::" ",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Re-Availment",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Reversal",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Permanent Reversal");
if NatureOfAdj in [NatureOfAdj::"Credit Re-Availment", NatureOfAdj::"Permanent Reversal"] then
DetailedGSTLedgerEntry[1].SetFilter(
"Credit Adjustment Type", '%1|%2|%3',
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Re-Availment",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Reversal",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Permanent Reversal");
if NatureOfAdj in [NatureOfAdj::"Credit Availment"] then
DetailedGSTLedgerEntry[1].SetFilter(
"Credit Adjustment Type", '%1|%2|%3', DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::" ",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Availment",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Reversal of Availment");
if NatureOfAdj in [NatureOfAdj::"Reversal of Availment"] then
DetailedGSTLedgerEntry[1].SetFilter(
"Credit Adjustment Type", '%1|%2', DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Credit Availment",
DetailedGSTLedgerEntry[1]."Credit Adjustment Type"::"Reversal of Availment");
end;
local procedure GetCreditAdjustmentSourceCode(): Code[10]
var
SourceSetup: Record "Source Code Setup";
begin
SourceSetup.Get();
SourceSetup.TestField("GST Credit Adjustment Journal");
exit(SourceSetup."GST Credit Adjustment Journal");
end;
local procedure GetCAJLines(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
NatureOfAdj: Enum "Credit Adjustment Type"): Boolean
begin
case NatureOfAdj of
NatureOfAdj::"Credit Reversal":
if (DetailedGSTLedgerEntry."GST Amount" - DetailedGSTLedgerEntry."CAJ Amount") <> 0 then
exit(true);
NatureOfAdj::"Credit Re-Availment":
if (DetailedGSTLedgerEntry."CAJ Amount" - DetailedGSTLedgerEntry."CAJ Amount Permanent Reversal") <> 0 then
exit(true);
NatureOfAdj::"Permanent Reversal":
if (DetailedGSTLedgerEntry."CAJ Amount" - DetailedGSTLedgerEntry."CAJ Amount Permanent Reversal") <> 0 then
exit(true);
NatureOfAdj::"Credit Availment":
if (DetailedGSTLedgerEntry."GST Amount" - DetailedGSTLedgerEntry."CAJ Amount") <> 0 then
exit(true);
NatureOfAdj::"Reversal of Availment":
if (DetailedGSTLedgerEntry."CAJ Amount" - DetailedGSTLedgerEntry."CAJ Amount Permanent Reversal") <> 0 then
exit(true);
end;
end;
local procedure IsComponentNonAvailment(EntryNo: Integer): Boolean
var
PurchInvLine: Record "Purch. Inv. Line";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
begin
DetailedGSTLedgerEntry.Get(EntryNo);
if DetailedGSTLedgerEntry."GST Credit" = "GST Credit"::Availment then
exit(true);
if DetailedGSTLedgerEntry."GST Credit" = "GST Credit"::"Non-Availment" then
if DetailedGSTLedgerEntry."Document Type" = "Document Type Enum"::Invoice then begin
if PurchInvLine.Get(DetailedGSTLedgerEntry."Document No.", DetailedGSTLedgerEntry."Document Line No.") then;
if PurchInvLine."GST Credit" = PurchInvLine."GST Credit"::"Non-Availment" then
exit(true);
exit(false);
end;
end;
local procedure InitCreditAdjustmentJournal(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
NatureOfAdj: Enum "Credit Adjustment Type";
AdjDocNo: Code[20];
PostingDate: Date;
ReverseCharge: Boolean;
TotalGSTAmount: Decimal;
AdjustmentPerc: Decimal;
CAJAmt: Decimal;
CAJPermanentReversalAmt: Decimal)
var
GSTCreditAdjustmentJournal: Record "GST Credit Adjustment Journal";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
begin
if TotalGSTAmount = 0 then
exit;
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
GSTCreditAdjustmentJournal.Init();
GSTCreditAdjustmentJournal."GST Registration No." := DetailedGSTLedgerEntry."Location Reg. No.";
GSTCreditAdjustmentJournal."Vendor No." := DetailedGSTLedgerEntry."Source No.";
GSTCreditAdjustmentJournal."Posting Date" := DetailedGSTLedgerEntry."Posting Date";
if DetailedGSTLedgerEntry."Document Type" = DetailedGSTLedgerEntry."Document Type"::Invoice then
GSTCreditAdjustmentJournal."Document Type" := GSTCreditAdjustmentJournal."Document Type"::Invoice
else
GSTCreditAdjustmentJournal."Document Type" := GSTCreditAdjustmentJournal."Document Type"::"Credit Memo";
GSTCreditAdjustmentJournal."Document No." := DetailedGSTLedgerEntry."Document No.";
GSTCreditAdjustmentJournal."Document Line No." := DetailedGSTLedgerEntry."Document Line No.";
GSTCreditAdjustmentJournal.Type := DetailedGSTLedgerEntry.Type;
GSTCreditAdjustmentJournal.Validate("No.", DetailedGSTLedgerEntry."No.");
GSTCreditAdjustmentJournal."Gen. Bus. Posting Group" := DetailedGSTLedgerEntryInfo."Gen. Bus. Posting Group";
GSTCreditAdjustmentJournal."Gen. Prod. Posting Group" := DetailedGSTLedgerEntryInfo."Gen. Prod. Posting Group";
GSTCreditAdjustmentJournal."Reverse Charge" := ReverseCharge;
GSTCreditAdjustmentJournal."External Document No." := DetailedGSTLedgerEntry."External Document No.";
GSTCreditAdjustmentJournal."GST Jurisdiction Type" := DetailedGSTLedgerEntry."GST Jurisdiction Type";
GSTCreditAdjustmentJournal."Location State Code" := DetailedGSTLedgerEntryInfo."Location State Code";
GSTCreditAdjustmentJournal."Total GST Credit Amount" := TotalGSTAmount;
GSTCreditAdjustmentJournal."Nature of Adjustment" := NatureOfAdj;
GSTCreditAdjustmentJournal."Selected Nature of Adjustment" := NatureOfAdj;
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal", GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment"] then begin
GSTCreditAdjustmentJournal."Available Adjustment Amount" := Abs(TotalGSTAmount - Abs(CAJAmt));
GSTCreditAdjustmentJournal."Available Adjustment %" := Abs((GSTCreditAdjustmentJournal."Available Adjustment Amount" * 100) / TotalGSTAmount);
end;
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Permanent Reversal"]
then begin
GSTCreditAdjustmentJournal."Available Adjustment Amount" := Abs(CAJAmt) - Abs(CAJPermanentReversalAmt);
GSTCreditAdjustmentJournal."Available Adjustment %" := Abs((GSTCreditAdjustmentJournal."Available Adjustment Amount" * 100) / TotalGSTAmount);
end;
GSTCreditAdjustmentJournal."Adjustment %" := AdjustmentPerc;
if GSTCreditAdjustmentJournal."Document Type" = GSTCreditAdjustmentJournal."Document Type"::"Credit Memo" then begin
GSTCreditAdjustmentJournal."Adjustment Amount" := Abs((TotalGSTAmount * GSTCreditAdjustmentJournal."Adjustment %") / 100);
GSTCreditAdjustmentJournal."Total GST Amount" := (TotalGSTAmount * GSTCreditAdjustmentJournal."Adjustment %") / 100;
end;
if GSTCreditAdjustmentJournal."Document Type" = GSTCreditAdjustmentJournal."Document Type"::Invoice then begin
GSTCreditAdjustmentJournal."Adjustment Amount" := (TotalGSTAmount * GSTCreditAdjustmentJournal."Adjustment %") / 100;
GSTCreditAdjustmentJournal."Total GST Amount" := GSTCreditAdjustmentJournal."Adjustment Amount";
end;
GSTCreditAdjustmentJournal."Input Service Distribution" := DetailedGSTLedgerEntry."Input Service Distribution";
GSTCreditAdjustmentJournal."Adjustment Posting Date" := PostingDate;
GSTCreditAdjustmentJournal."Adjust Document No." := AdjDocNo;
if GSTCreditAdjustmentJournal."Available Adjustment %" = 0 then
exit;
GSTCreditAdjustmentJournal.Insert(true);
end;
local procedure PostReverseChargeCrAdjJournal(GSTCreditAdjustmentJournal: Record "GST Credit Adjustment Journal") EntryNo: Integer
var
GLSetup: Record "General Ledger Setup";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
GeneralPostingSetup: Record "General Posting Setup";
GenJournalLine: Record "Gen. Journal Line";
NoSeriesManagement: Codeunit NoSeriesManagement;
GSTHelpers: Codeunit "GST Helpers";
TotalGSTAmt: Decimal;
TotalGSTAmt1: Decimal;
begin
Clear(GenJournalLine);
GLSetup.Get();
GSTCreditAdjustmentJournal.SetRange("Reverse Charge", true);
GSTCreditAdjustmentJournal.SetFilter("Nature of Adjustment", '<>%1', GSTCreditAdjustmentJournal."Nature of Adjustment"::" ");
if GSTCreditAdjustmentJournal.FindSet() then begin
repeat
GSTCreditAdjustmentJournal.Validate("Adjustment %");
GSTCreditAdjustmentJournal.Validate("Adjustment Amount");
Clear(TempGSTPostingBuffer[1]);
Clear(TempGSTPostingBuffer[2]);
TotalGSTAmt := 0;
TotalGSTAmt1 := 0;
DetailedGSTLedgerEntry.SetCurrentKey(
"Transaction Type",
"GST Jurisdiction Type",
"Source No.",
"Document Type",
"Document No.",
"Document Line No.",
"Posting Date");
DetailedGSTLedgerEntry.SetRange("Transaction Type", DetailedGSTLedgerEntry."Transaction Type"::Purchase);
DetailedGSTLedgerEntry.SetRange("Entry Type", DetailedGSTLedgerEntry."Entry Type"::Application);
DetailedGSTLedgerEntry.SetRange("GST Jurisdiction Type", GSTCreditAdjustmentJournal."GST Jurisdiction Type");
DetailedGSTLedgerEntry.SetRange("Source No.", GSTCreditAdjustmentJournal."Vendor No.");
DetailedGSTLedgerEntry.SetRange("Document Type", DetailedGSTLedgerEntry."Document Type"::Invoice);
DetailedGSTLedgerEntry.SetRange("Document No.", GSTCreditAdjustmentJournal."Document No.");
DetailedGSTLedgerEntry.SetRange("Document Line No.", GSTCreditAdjustmentJournal."Document Line No.");
DetailedGSTLedgerEntry.SetRange("Posting Date", GSTCreditAdjustmentJournal."Posting Date");
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment"]
then
DetailedGSTLedgerEntry.SetRange("GST Credit", DetailedGSTLedgerEntry."GST Credit"::Availment)
else
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment"]
then
DetailedGSTLedgerEntry.SetRange("GST Credit", DetailedGSTLedgerEntry."GST Credit"::"Non-Availment");
DetailedGSTLedgerEntry.SetRange(Distributed, false);
DetailedGSTLedgerEntry.SetRange("Reverse Charge", true);
DetailedGSTLedgerEntry.SetRange("GST Exempted Goods", false);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if IsComponentNonAvailment(DetailedGSTLedgerEntry."Entry No.") then begin
TempGSTPostingBuffer[1]."Transaction Type" := TempGSTPostingBuffer[1]."Transaction Type"::Purchase;
TempGSTPostingBuffer[1].Type := TempGSTPostingBuffer[1].Type::"G/L Account";
TempGSTPostingBuffer[1]."GST Component Code" := DetailedGSTLedgerEntry."GST Component Code";
TempGSTPostingBuffer[1]."GST Amount" := Abs(DetailedGSTLedgerEntry."GST Amount");
TempGSTPostingBuffer[1]."GST Base Amount" := Abs(DetailedGSTLedgerEntry."GST Base Amount");
TempGSTPostingBuffer[1]."Dimension Set ID" := GSTCreditAdjustmentJournal."Dimension Set ID";
case GSTCreditAdjustmentJournal."Nature of Adjustment" of
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment":
begin
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTPayableAccountNo(GSTCreditAdjustmentJournal."Location State Code", DetailedGSTLedgerEntry."GST Component Code");
TempGSTPostingBuffer[1]."GST Amount" :=
Abs(Round((DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."GST Base Amount" :=
Abs(Round((DetailedGSTLedgerEntry."GST Base Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TotalGSTAmt += Abs(TempGSTPostingBuffer[1]."GST Amount");
end;
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment":
begin
TempGSTPostingBuffer[1]."Account No." :=
GSTHelpers.GetGSTReceivableAccountNo(
GSTCreditAdjustmentJournal."Location State Code", DetailedGSTLedgerEntry."GST Component Code");
TempGSTPostingBuffer[1]."GST Amount" :=
-Abs(Round((DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."GST Base Amount" :=
-Abs(Round((DetailedGSTLedgerEntry."GST Base Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TotalGSTAmt += Abs(TempGSTPostingBuffer[1]."GST Amount");
end;
end;
UpdateGSTPostingBuffer();
UpdateDetailedGSTLedgerEntry(
GSTCreditAdjustmentJournal."Nature of Adjustment",
DetailedGSTLedgerEntry."Entry No.",
GSTCreditAdjustmentJournal."Adjustment Posting Date",
TempGSTPostingBuffer[1]."GST Amount",
GSTCreditAdjustmentJournal."Adjustment %",
TempGSTPostingBuffer[1]."GST Base Amount");
PostToDetailedCrAdjEntry(DetailedGSTLedgerEntry, GSTCreditAdjustmentJournal);
end;
until DetailedGSTLedgerEntry.Next() = 0;
TempGSTPostingBuffer[1]."Transaction Type" := TempGSTPostingBuffer[1]."Transaction Type"::Purchase;
TempGSTPostingBuffer[1].Type := GSTCreditAdjustmentJournal.Type;
TempGSTPostingBuffer[1]."Dimension Set ID" := GSTCreditAdjustmentJournal."Dimension Set ID";
if GSTCreditAdjustmentJournal.Type in [Type::"G/L Account", Type::"Fixed Asset"] then
TempGSTPostingBuffer[1]."Account No." := GSTCreditAdjustmentJournal."No."
else
if GSTCreditAdjustmentJournal.Type = Type::Item then begin
GeneralPostingSetup.Get(
GSTCreditAdjustmentJournal."Gen. Bus. Posting Group",
GSTCreditAdjustmentJournal."Gen. Prod. Posting Group");
GeneralPostingSetup.TestField("Purch. Account");
TempGSTPostingBuffer[1]."Account No." := GeneralPostingSetup."Purch. Account";
end;
TempGSTPostingBuffer[1]."GST Reverse Charge" := GSTCreditAdjustmentJournal."Reverse Charge";
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment"]
then begin
TotalGSTAmt1 :=
-Abs(Round((GSTCreditAdjustmentJournal."Total GST Credit Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."GST Amount" := TotalGSTAmt1 - GETPartialRoundingAmt(TotalGSTAmt, TotalGSTAmt1);
end else
if GSTCreditAdjustmentJournal."Nature of Adjustment" in [
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment"]
then begin
TotalGSTAmt1 :=
Abs(Round(
(GSTCreditAdjustmentJournal."Total GST Credit Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100,
GLSetup."Amount Rounding Precision"));
TempGSTPostingBuffer[1]."GST Amount" := TotalGSTAmt1 + GETPartialRoundingAmt(TotalGSTAmt, TotalGSTAmt1);
end;
UpdateGSTPostingBuffer();
if GSTCreditAdjustmentJournal.Type = Type::Item then
PostRevaluationEntry(GSTCreditAdjustmentJournal)
until GSTCreditAdjustmentJournal.Next() = 0;
NoSeriesManagement.GetNextNo(GetNoSeriesCode(false), GSTCreditAdjustmentJournal."Posting Date", true);
end;
Clear(GenJnlPostLine);
if TempGSTPostingBuffer[1].Find('+') then
repeat
if TempGSTPostingBuffer[1].Type = TempGSTPostingBuffer[1].Type::"Fixed Asset" then
PostGenJnlLine(
GenJournalLine, TempGSTPostingBuffer[1]."Account No.", '',
GSTCreditAdjustmentJournal."Adjust Document No.", TempGSTPostingBuffer[1]."GST Amount", GSTCreditAdjustmentJournal."Adjustment Posting Date",
GenJournalLine."Document Type"::Invoice, GSTCreditAdjustmentJournal."GST Jurisdiction Type", false, true,
TempGSTPostingBuffer[1]."Dimension Set ID")
else
PostGenJnlLine(
GenJournalLine, TempGSTPostingBuffer[1]."Account No.", '',
GSTCreditAdjustmentJournal."Adjust Document No.", TempGSTPostingBuffer[1]."GST Amount", GSTCreditAdjustmentJournal."Adjustment Posting Date",
GenJournalLine."Document Type"::Invoice, GSTCreditAdjustmentJournal."GST Jurisdiction Type", false, false,
TempGSTPostingBuffer[1]."Dimension Set ID");
EntryNo := GenJnlPostLine.RunWithCheck(GenJournalLine);
until TempGSTPostingBuffer[1].Next(-1) = 0;
end;
local procedure UpdateGSTPostingBuffer()
begin
DimensionManagement.UpdateGlobalDimFromDimSetID(
TempGSTPostingBuffer[1]."Dimension Set ID",
TempGSTPostingBuffer[1]."Global Dimension 1 Code",
TempGSTPostingBuffer[1]."Global Dimension 2 Code");
TempGSTPostingBuffer[2] := TempGSTPostingBuffer[1];
if TempGSTPostingBuffer[2].Find() then begin
TempGSTPostingBuffer[2]."GST Base Amount" += TempGSTPostingBuffer[1]."GST Base Amount";
TempGSTPostingBuffer[2]."GST Amount" += TempGSTPostingBuffer[1]."GST Amount";
TempGSTPostingBuffer[2].Modify();
end else
TempGSTPostingBuffer[1].Insert();
end;
local procedure UpdateDetailedGSTLedgerEntry(
TypeOfAdjustment: Enum "Credit Adjustment Type";
EntryNo: Integer;
PostingDate: Date;
CAJAmt: Decimal;
CAJPerc: Decimal;
CAJBaseAmt: Decimal)
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
begin
DetailedGSTLedgerEntry.Get(EntryNo);
DetailedGSTLedgerEntry."Credit Adjustment Type" := TypeOfAdjustment;
UpdateDetGSTLedgPartialAmt(DetailedGSTLedgerEntry, TypeOfAdjustment, CAJAmt, CAJPerc, CAJBaseAmt);
DetailedGSTLedgerEntry.Modify();
if DetailedGSTLedgerEntryInfo.Get(DetailedGSTLedgerEntry."Entry No.") then begin
DetailedGSTLedgerEntryInfo."Last Credit Adjusted Date" := PostingDate;
DetailedGSTLedgerEntryInfo.Modify();
end;
end;
local procedure UpdateDetGSTLedgPartialAmt(
var DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
TypeOfAdjustment: Enum "Credit Adjustment Type";
CAJAmt: Decimal;
CAJPerc: Decimal;
CAJBaseAmt: Decimal)
begin
if TypeOfAdjustment in [TypeOfAdjustment::"Credit Reversal", TypeOfAdjustment::"Credit Availment"] then begin
DetailedGSTLedgerEntry."CAJ Base Amount" := DetailedGSTLedgerEntry."CAJ Base Amount" + Abs(CAJBaseAmt);
DetailedGSTLedgerEntry."CAJ Amount" := DetailedGSTLedgerEntry."CAJ Amount" + Abs(CAJAmt);
DetailedGSTLedgerEntry."CAJ %" := DetailedGSTLedgerEntry."CAJ %" + CAJPerc;
end;
if TypeOfAdjustment in [TypeOfAdjustment::"Credit Re-Availment", TypeOfAdjustment::"Reversal of Availment"] then begin
DetailedGSTLedgerEntry."CAJ Base Amount" := DetailedGSTLedgerEntry."CAJ Base Amount" - Abs(CAJBaseAmt);
DetailedGSTLedgerEntry."CAJ Amount" := DetailedGSTLedgerEntry."CAJ Amount" - Abs(CAJAmt);
DetailedGSTLedgerEntry."CAJ %" := DetailedGSTLedgerEntry."CAJ %" - CAJPerc;
end;
if TypeOfAdjustment in [TypeOfAdjustment::"Permanent Reversal"] then begin
DetailedGSTLedgerEntry."CAJ Amount Permanent Reversal" := DetailedGSTLedgerEntry."CAJ Amount Permanent Reversal" + Abs(CAJAmt);
DetailedGSTLedgerEntry."CAJ % Permanent Reversal" := DetailedGSTLedgerEntry."CAJ % Permanent Reversal" + CAJPerc;
end;
DetailedGSTLedgerEntry."Remaining CAJ Adj. Base Amt" :=
Abs(Abs(DetailedGSTLedgerEntry."GST Base Amount") - Abs(DetailedGSTLedgerEntry."CAJ Base Amount"));
DetailedGSTLedgerEntry."Remaining CAJ Adj. Amt" :=
Abs(Abs(DetailedGSTLedgerEntry."GST Amount") - Abs(DetailedGSTLedgerEntry."CAJ Amount"));
end;
local procedure PostGenJnlLine(
var GenJournalLine: Record "Gen. Journal Line";
RecAccountNo: Code[20];
IntAccountNo: Code[20];
DocumentNo: Code[20];
GSTAmt: Decimal;
PostingDate: Date;
DocumentType: Enum "Gen. Journal Document Type";
GSTJurisdictionType: Enum "GST Jurisdiction Type";
Liability: Boolean;
FixedAsset: Boolean;
DimensionSetID: Integer)
begin
GenJournalLine.Init();
GenJournalLine."Line No." += 10000;
GenJournalLine."Document Type" := DocumentType;
GenJournalLine."Document No." := DocumentNo;
if FixedAsset then begin
GenJournalLine."Account Type" := GenJournalLine."Account Type"::"Fixed Asset";
GenJournalLine.Validate("Account No.", RecAccountNo);
end else
GenJournalLine."Account Type" := GenJournalLine."Account Type"::"G/L Account";
GenJournalLine."Bal. Account Type" := GenJournalLine."Bal. Account Type"::"G/L Account";
GenJournalLine."Posting Date" := PostingDate;
if not FixedAsset then
GenJournalLine."Account No." := RecAccountNo;
if FixedAsset then
GenJournalLine.Validate("FA Posting Type", GenJournalLine."FA Posting Type"::"Acquisition Cost");
GenJournalLine."Bal. Account No." := IntAccountNo;
if Liability then
GenJournalLine."Source Code" := GetLiabilitySourceCode()
else
GenJournalLine."Source Code" := GetCreditAdjustmentSourceCode();
GenJournalLine."GST Jurisdiction Type" := GSTJurisdictionType;
GenJournalLine."System-Created Entry" := true;
if GenJournalLine."Document Type" = GenJournalLine."Document Type"::Invoice then
GenJournalLine.Amount := -GSTAmt
else
GenJournalLine.Amount := GSTAmt;
GenJournalLine."Dimension Set ID" := DimensionSetID;
DimensionManagement.UpdateGlobalDimFromDimSetID(
GenJournalLine."Dimension Set ID",
GenJournalLine."Shortcut Dimension 1 Code",
GenJournalLine."Shortcut Dimension 2 Code");
end;
local procedure GetLiabilitySourceCode(): Code[10]
var
SourceSetup: Record "Source Code Setup";
begin
SourceSetup.Get();
SourceSetup.TestField("GST Liability Adjustment");
exit(SourceSetup."GST Liability Adjustment");
end;
local procedure PostToDetailedCrAdjEntry(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
GSTCreditAdjustmentJournal: Record "GST Credit Adjustment Journal")
var
DetailedCrAdjstmntEntry: Record "Detailed Cr. Adjstmnt. Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
GSTHelpers: Codeunit "GST Helpers";
begin
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
DetailedCrAdjstmntEntry.Init();
DetailedCrAdjstmntEntry."Posting Date" := GSTCreditAdjustmentJournal."Adjustment Posting Date";
DetailedCrAdjstmntEntry."Credit Adjustment Type" := GSTCreditAdjustmentJournal."Nature of Adjustment";
DetailedCrAdjstmntEntry."Document No." := GSTCreditAdjustmentJournal."Adjust Document No.";
DetailedCrAdjstmntEntry."Adjusted Doc. Entry No." := DetailedGSTLedgerEntry."Entry No.";
DetailedCrAdjstmntEntry."Adjusted Doc. Entry Type" := DetailedGSTLedgerEntry."Entry Type";
DetailedCrAdjstmntEntry."Adjusted Doc. Transaction Type" := DetailedGSTLedgerEntry."Transaction Type";
DetailedCrAdjstmntEntry."Adjusted Doc. Type" := DetailedGSTLedgerEntry."Document Type";
DetailedCrAdjstmntEntry."Adjusted Doc. No." := DetailedGSTLedgerEntry."Document No.";
DetailedCrAdjstmntEntry."Adjusted Doc. Line No." := DetailedGSTLedgerEntry."Document Line No.";
DetailedCrAdjstmntEntry."Adjusted Doc. Posting Date" := DetailedGSTLedgerEntry."Posting Date";
DetailedCrAdjstmntEntry.Type := DetailedGSTLedgerEntry.Type;
DetailedCrAdjstmntEntry."No." := DetailedGSTLedgerEntry."No.";
DetailedCrAdjstmntEntry."Product Type" := DetailedGSTLedgerEntry."Product Type";
DetailedCrAdjstmntEntry."Source Type" := DetailedGSTLedgerEntry."Source Type";
DetailedCrAdjstmntEntry."Source No." := DetailedGSTLedgerEntry."Source No.";
DetailedCrAdjstmntEntry."HSN/SAC Code" := DetailedGSTLedgerEntry."HSN/SAC Code";
DetailedCrAdjstmntEntry."GST Component Code" := DetailedGSTLedgerEntry."GST Component Code";
DetailedCrAdjstmntEntry."GST Group Code" := DetailedGSTLedgerEntry."GST Group Code";
DetailedCrAdjstmntEntry."GST Jurisdiction Type" := DetailedGSTLedgerEntry."GST Jurisdiction Type";
if GSTCreditAdjustmentJournal."Reverse Charge" then begin
DetailedCrAdjstmntEntry."GST Base Amount" :=
Abs((DetailedGSTLedgerEntry."GST Base Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100);
DetailedCrAdjstmntEntry."GST Amount" :=
Abs((DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100);
DetailedCrAdjstmntEntry."Adjustment Amount" :=
Abs((DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100);
end else begin
DetailedCrAdjstmntEntry."GST Base Amount" :=
(DetailedGSTLedgerEntry."GST Base Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100;
DetailedCrAdjstmntEntry."GST Amount" :=
(DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100;
DetailedCrAdjstmntEntry."Adjustment Amount" :=
(DetailedGSTLedgerEntry."GST Amount" * GSTCreditAdjustmentJournal."Adjustment %") / 100;
end;
DetailedCrAdjstmntEntry."GST %" := DetailedGSTLedgerEntry."GST %";
if DetailedGSTLedgerEntry."GST Amount" <> 0 then
DetailedCrAdjstmntEntry."Adjustment %" := GSTCreditAdjustmentJournal."Adjustment %";
DetailedCrAdjstmntEntry."External Document No." := DetailedGSTLedgerEntry."External Document No.";
DetailedCrAdjstmntEntry."Location State Code" := DetailedGSTLedgerEntryInfo."Location State Code";
case GSTCreditAdjustmentJournal."Nature of Adjustment" of
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment":
begin
if GSTCreditAdjustmentJournal."Reverse Charge" then begin
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTPayableAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code");
DetailedCrAdjstmntEntry."GST Credit" := DetailedCrAdjstmntEntry."GST Credit"::"Non-Availment";
end else
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTMismatchAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code");
DetailedCrAdjstmntEntry."Liable to Pay" := true
end;
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment":
begin
if GSTCreditAdjustmentJournal."Reverse Charge" then begin
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTReceivableAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code");
DetailedCrAdjstmntEntry.Positive := true;
DetailedCrAdjstmntEntry."GST Credit" := DetailedCrAdjstmntEntry."GST Credit"::Availment;
end else
if DetailedGSTLedgerEntry."Input Service Distribution" then
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTReceivableDistAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code")
else
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTReceivableAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code");
DetailedCrAdjstmntEntry."Credit Availed" := true;
end;
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Permanent Reversal":
DetailedCrAdjstmntEntry."G/L Account No." :=
GSTHelpers.GetGSTExpenseAccountNo(
DetailedCrAdjstmntEntry."Location State Code",
DetailedGSTLedgerEntry."GST Component Code")
end;
DetailedCrAdjstmntEntry."User ID" := CopyStr(UserId(), 1, StrLen(UserId()));
if not DetailedGSTLedgerEntry."Reverse Charge" then begin
DetailedCrAdjstmntEntry.Positive := DetailedGSTLedgerEntryInfo.Positive;
DetailedCrAdjstmntEntry."GST Credit" := DetailedGSTLedgerEntry."GST Credit";
end;
DetailedCrAdjstmntEntry."Buyer/Seller State Code" := DetailedGSTLedgerEntryInfo."Buyer/Seller State Code";
DetailedCrAdjstmntEntry."Location Reg. No." := DetailedGSTLedgerEntry."Location Reg. No.";
DetailedCrAdjstmntEntry."Buyer/Seller Reg. No." := DetailedGSTLedgerEntry."Buyer/Seller Reg. No.";
DetailedCrAdjstmntEntry."GST Group Type" := DetailedGSTLedgerEntry."GST Group Type";
DetailedCrAdjstmntEntry."Currency Code" := DetailedGSTLedgerEntry."Currency Code";
DetailedCrAdjstmntEntry."Currency Factor" := DetailedGSTLedgerEntry."Currency Factor";
DetailedCrAdjstmntEntry."GST Rounding Precision" := DetailedGSTLedgerEntry."GST Rounding Precision";
DetailedCrAdjstmntEntry."GST Rounding Type" := DetailedGSTLedgerEntry."GST Rounding Type";
DetailedCrAdjstmntEntry."Location Code" := DetailedGSTLedgerEntry."Location Code";
DetailedCrAdjstmntEntry."GST Vendor Type" := DetailedGSTLedgerEntry."GST Vendor Type";
DetailedCrAdjstmntEntry.Cess := DetailedGSTLedgerEntryInfo.Cess;
DetailedCrAdjstmntEntry."Input Service Distribution" := DetailedGSTLedgerEntry."Input Service Distribution";
DetailedCrAdjstmntEntry."Reverse Charge" := DetailedGSTLedgerEntry."Reverse Charge";
DetailedCrAdjstmntEntry."Rem. Amt. Updated in DGLE" := true;
DetailedCrAdjstmntEntry.Insert();
end;
local procedure GETPartialRoundingAmt(TotalGSTAmt: Decimal; TotalGSTAmt1: Decimal): Decimal
var
RoundOffAmt: Decimal;
begin
RoundOffAmt := Abs(TotalGSTAmt) - Abs(TotalGSTAmt1);
exit(RoundOffAmt);
end;
local procedure PostRevaluationEntry(GSTCreditAdjustmentJournal: Record "GST Credit Adjustment Journal")
var
SourceSetup: Record "Source Code Setup";
ItemJournalLine: Record "Item Journal Line";
ItemJournalLine2: Record "Item Journal Line";
ItemLedgerEntry: Record "Item Ledger Entry";
ValueEntry: Record "Value Entry";
ItemJnlPostLine: Codeunit "Item Jnl.-Post Line";
Ctr: Integer;
begin
ValueEntry.Reset();
ValueEntry.SetRange("Document No.", GSTCreditAdjustmentJournal."Document No.");
ValueEntry.SetRange("Document Line No.", GSTCreditAdjustmentJournal."Document Line No.");
ValueEntry.SetRange("Item No.", GSTCreditAdjustmentJournal."No.");
if ValueEntry.FindFirst() then begin
ItemLedgerEntry.Get(ValueEntry."Item Ledger Entry No.");
if GSTCreditAdjustmentJournal."Total GST Amount" <> 0 then begin
SourceSetup.Get();
ItemJournalLine.Init();
ItemJournalLine.Validate("Posting Date", GSTCreditAdjustmentJournal."Adjustment Posting Date");
ItemJournalLine."Document Date" := GSTCreditAdjustmentJournal."Adjustment Posting Date";
ItemJournalLine.Validate("Document No.", GSTCreditAdjustmentJournal."Adjust Document No.");
ItemJournalLine."Document Line No." := GSTCreditAdjustmentJournal."Document Line No.";
ItemJournalLine."External Document No." := CopyStr(GSTCreditAdjustmentJournal."External Document No.", 1, MaxStrLen(ItemJournalLine."External Document No."));
ItemJournalLine.Validate("Entry Type", ItemJournalLine."Entry Type"::Purchase);
ItemJournalLine."Value Entry Type" := ItemJournalLine."Value Entry Type"::Revaluation;
ItemJournalLine.Validate("Item No.", GSTCreditAdjustmentJournal."No.");
ItemJournalLine."Source Type" := ItemJournalLine."Source Type"::Vendor;
ItemJournalLine."Source No." := GSTCreditAdjustmentJournal."Vendor No.";
ItemJournalLine."Gen. Bus. Posting Group" := GSTCreditAdjustmentJournal."Gen. Bus. Posting Group";
ItemJournalLine."Gen. Prod. Posting Group" := GSTCreditAdjustmentJournal."Gen. Prod. Posting Group";
ItemJournalLine."Source Code" := SourceSetup."Revaluation Journal";
ItemJournalLine.Validate("Applies-to Entry", ItemLedgerEntry."Entry No.");
ItemJournalLine."Dimension Set ID" := GSTCreditAdjustmentJournal."Dimension Set ID";
if GSTCreditAdjustmentJournal."Nature of Adjustment" in
[GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Reversal",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Reversal of Availment"]
then
ItemJournalLine.Validate(
"Unit Cost (Revalued)",
(ItemJournalLine."Unit Cost (Revalued)" + GSTCreditAdjustmentJournal."Total GST Amount"))
else
if GSTCreditAdjustmentJournal."Nature of Adjustment" in
[GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Re-Availment",
GSTCreditAdjustmentJournal."Nature of Adjustment"::"Credit Availment"]
then
ItemJournalLine.Validate(
"Unit Cost (Revalued)",
(ItemJournalLine."Unit Cost (Revalued)" - GSTCreditAdjustmentJournal."Total GST Amount"));
Ctr := ItemJournalLine2."Line No." + 1;
ItemJournalLine2.Init();
ItemJournalLine2.TransferFields(ItemJournalLine);
ItemJournalLine2."Line No." := Ctr;
ItemJnlPostLine.Run(ItemJournalLine2);
end;
end;
end;
local procedure AllocateGSTWithPayment(DocumentNo: Code[20]; VendNo: Code[20]; RemainingAmount: Decimal)
var
GSTLiabilityBuffer: Record "GST Liability Buffer";
InvoiceBaseAmount: Decimal;
GSTGroupCode: Code[20];
AppliedAmount: Decimal;
TotalInvoiceAmount: Decimal;
Sign: Integer;
GSTExempted: Boolean;
begin
GSTLiabilityBuffer.SetRange("Transaction Type", GSTLiabilityBuffer."Transaction Type"::Purchase);
GSTLiabilityBuffer.SetRange("Account No.", VendNo);
GSTLiabilityBuffer.SetRange("Original Document Type", GSTLiabilityBuffer."Original Document Type"::Invoice);
GSTLiabilityBuffer.SetRange("Original Document No.", DocumentNo);
if GSTLiabilityBuffer.FindSet() then begin
Sign := RemainingAmount / Abs(RemainingAmount);
repeat
if (GSTGroupCode <> GSTLiabilityBuffer."GST Group Code") or (GSTExempted <> GSTLiabilityBuffer.Exempted) then begin
Clear(InvoiceBaseAmount);
Clear(TotalInvoiceAmount);
GetInvoiceBaseAmount(GSTLiabilityBuffer, InvoiceBaseAmount);
TotalInvoiceAmount := InvoiceBaseAmount;
RemainingAmount := (Abs(RemainingAmount) - Abs(AppliedAmount)) * Sign;
end;
if Abs(TotalInvoiceAmount) > Abs(RemainingAmount) then begin
GSTLiabilityBuffer."Applied Base Amount" := Round(GSTLiabilityBuffer."GST Base Amount" * Abs(RemainingAmount) / TotalInvoiceAmount, 0.01);
GSTLiabilityBuffer."Applied Amount" := GSTLiabilityBuffer."GST Amount" * Abs(RemainingAmount) / TotalInvoiceAmount;
if GSTLiabilityBuffer."GST Credit" = "GST Credit"::Availment then
GSTLiabilityBuffer."Credit Amount" := GSTLiabilityBuffer."Applied Amount"
end else begin
GSTLiabilityBuffer."Applied Base Amount" :=
Round(GetInvoiceGSTComponentWise(GSTLiabilityBuffer, GSTLiabilityBuffer."Original Document Type"::Invoice, DocumentNo, true), 0.01);
GSTLiabilityBuffer."Applied Amount" := GSTLiabilityBuffer."GST Amount";
if GSTLiabilityBuffer."GST Credit" = "GST Credit"::Availment then
GSTLiabilityBuffer."Credit Amount" := GSTLiabilityBuffer."Applied Amount";
end;
GSTLiabilityBuffer.Modify(true);
GSTGroupCode := GSTLiabilityBuffer."GST Group Code";
GSTExempted := GSTLiabilityBuffer.Exempted;
Clear(AppliedAmount);
AppliedAmount := GSTLiabilityBuffer."Applied Base Amount";
until GSTLiabilityBuffer.Next() = 0;
end;
end;
local procedure FillGSTCreditLiability(
VendorLedgerEntry: Record "Vendor Ledger Entry";
AdjDocNo: Code[20];
AdjPostingDate: Date;
NatureOfAdj: Enum "Cr Libty Adjustment Type")
var
GSTLiabilityBuffer: array[2] of Record "GST Liability Buffer";
GSTLiabilityAdjustment: Record "GST Liability Adjustment";
DocumentNo: Code[20];
TotalGSTAmount: Decimal;
TotalCreditAmount: Decimal;
begin
GSTLiabilityBuffer[1].SetRange("Original Document No.", VendorLedgerEntry."Document No.");
GSTLiabilityBuffer[1].SetFilter("Applied Amount", '>%1', 0);
if GSTLiabilityBuffer[1].FindSet() then
repeat
if DocumentNo <> GSTLiabilityBuffer[1]."Original Document No." then begin
TotalGSTAmount := 0;
TotalCreditAmount := 0;
DocumentNo := GSTLiabilityBuffer[1]."Original Document No.";
GSTLiabilityBuffer[2].CopyFilters(GSTLiabilityBuffer[1]);
GSTLiabilityBuffer[2].SetRange("Original Document No.", GSTLiabilityBuffer[1]."Original Document No.");
if GSTLiabilityBuffer[2].FindSet() then
repeat
if GSTLiabilityBuffer[2]."GST Credit" = GSTLiabilityBuffer[2]."GST Credit"::Availment then
TotalCreditAmount += GSTLiabilityBuffer[2]."Credit Amount";
TotalGSTAmount += GSTLiabilityBuffer[2]."Applied Amount";
until GSTLiabilityBuffer[2].Next() = 0;
GSTLiabilityAdjustment.Init();
GSTLiabilityAdjustment."Journal Doc. No." := AdjDocNo;
GSTLiabilityAdjustment."GST Registration No." := VendorLedgerEntry."Location GST Reg. No.";
GSTLiabilityAdjustment."Vendor No." := VendorLedgerEntry."Vendor No.";
GSTLiabilityAdjustment."Document Type" := GSTLiabilityAdjustment."Document Type"::Invoice;
GSTLiabilityAdjustment."Document No." := VendorLedgerEntry."Document No.";
GSTLiabilityAdjustment."Document Posting Date" := VendorLedgerEntry."Posting Date";
GSTLiabilityAdjustment."External Document No." := VendorLedgerEntry."External Document No.";
GSTLiabilityAdjustment."Location State Code" := VendorLedgerEntry."Location State Code";
GSTLiabilityAdjustment."GST Jurisdiction Type" := GSTLiabilityBuffer[2]."GST Jurisdiction Type";
GSTLiabilityAdjustment."Adjustment Posting Date" := AdjPostingDate;
GSTLiabilityAdjustment."Adjustment Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Total GST Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Total GST Credit Amount" := TotalCreditAmount;
GSTLiabilityAdjustment."Total GST Liability Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Nature of Adjustment" := NatureOfAdj;
GSTLiabilityAdjustment."Select Nature of Adjustment" := NatureOfAdj;
GSTLiabilityAdjustment."GST Group Code" := GSTLiabilityBuffer[2]."GST Group Code";
GSTLiabilityAdjustment.Insert(true);
end;
until GSTLiabilityBuffer[1].Next() = 0;
end;
local procedure FillGSTCreditLiabilityReverse(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
AdjDocNo: Code[20];
AdjPostingDate: Date;
NatureOfAdj: Enum "Cr Libty Adjustment Type")
var
GSTLiabilityBuffer: array[2] of Record "GST Liability Buffer";
GSTLiabilityAdjustment: Record "GST Liability Adjustment";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
DocumentNo: Code[20];
TotalGSTAmount: Decimal;
TotalCreditAmount: Decimal;
begin
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
GSTLiabilityBuffer[1].SetRange("Original Document No.", DetailedGSTLedgerEntry."Document No.");
if GSTLiabilityBuffer[1].FindSet() then
repeat
if DocumentNo <> GSTLiabilityBuffer[1]."Original Document No." then begin
TotalGSTAmount := 0;
TotalCreditAmount := 0;
DocumentNo := GSTLiabilityBuffer[1]."Original Document No.";
GSTLiabilityBuffer[2].CopyFilters(GSTLiabilityBuffer[1]);
GSTLiabilityBuffer[2].SetRange("Original Document No.", GSTLiabilityBuffer[1]."Original Document No.");
if GSTLiabilityBuffer[2].FindSet() then
repeat
if GSTLiabilityBuffer[2]."GST Credit" = GSTLiabilityBuffer[2]."GST Credit"::Availment then
TotalCreditAmount += GSTLiabilityBuffer[2]."Credit Amount";
TotalGSTAmount += GSTLiabilityBuffer[2]."Applied Amount";
until GSTLiabilityBuffer[2].Next() = 0;
if TotalGSTAmount = 0 then
exit;
GSTLiabilityAdjustment.Init();
GSTLiabilityAdjustment."Journal Doc. No." := AdjDocNo;
GSTLiabilityAdjustment."GST Registration No." := DetailedGSTLedgerEntry."Location Reg. No.";
GSTLiabilityAdjustment."Vendor No." := DetailedGSTLedgerEntry."Source No.";
GSTLiabilityAdjustment."Document Type" := GSTLiabilityAdjustment."Document Type"::Invoice;
GSTLiabilityAdjustment."Document No." := DetailedGSTLedgerEntry."Document No.";
GSTLiabilityAdjustment."Document Posting Date" := DetailedGSTLedgerEntry."Posting Date";
GSTLiabilityAdjustment."External Document No." := DetailedGSTLedgerEntry."External Document No.";
GSTLiabilityAdjustment."Location State Code" := DetailedGSTLedgerEntryInfo."Location State Code";
GSTLiabilityAdjustment."GST Jurisdiction Type" := GSTLiabilityBuffer[2]."GST Jurisdiction Type";
GSTLiabilityAdjustment."Adjustment Posting Date" := AdjPostingDate;
GSTLiabilityAdjustment."Adjustment Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Total GST Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Total GST Credit Amount" := TotalCreditAmount;
GSTLiabilityAdjustment."Total GST Liability Amount" := TotalGSTAmount;
GSTLiabilityAdjustment."Nature of Adjustment" := NatureOfAdj;
GSTLiabilityAdjustment."Select Nature of Adjustment" := NatureOfAdj;
GSTLiabilityAdjustment."GST Group Code" := GSTLiabilityBuffer[2]."GST Group Code";
GSTLiabilityAdjustment.Insert(true);
end;
until GSTLiabilityBuffer[1].Next() = 0;
end;
local procedure GetInvoiceBaseAmount(
var GSTLiabilityBuffer: Record "GST Liability Buffer";
var GSTBaseAmount: Decimal)
var
GSTLiabilityBuffer2: Record "GST Liability Buffer";
begin
GSTLiabilityBuffer2.SetRange("Transaction Type", GSTLiabilityBuffer."Transaction Type");
GSTLiabilityBuffer2.SetRange("Account No.", GSTLiabilityBuffer."Account No.");
GSTLiabilityBuffer2.SetRange("Original Document Type", GSTLiabilityBuffer."Original Document Type");
GSTLiabilityBuffer2.SetRange("Original Document No.", GSTLiabilityBuffer."Original Document No.");
GSTLiabilityBuffer2.SetRange("GST Group Code", GSTLiabilityBuffer."GST Group Code");
GSTLiabilityBuffer2.SetRange(Exempted, GSTLiabilityBuffer.Exempted);
GSTLiabilityBuffer2.SetFilter("GST Base Amount", '<>%1', 0);
if GSTLiabilityBuffer2.FindFirst() then
GSTBaseAmount := GSTLiabilityBuffer2."GST Base Amount";
end;
local procedure GetInvoiceGSTComponentWise(
var GSTLiabilityBuffer: Record "GST Liability Buffer";
DocumentType: Enum "Current Doc. Type";
DocumentNo: Code[20];
Base: Boolean): Decimal
var
GSTLiabilityBuffer2: Record "GST Liability Buffer";
begin
GSTLiabilityBuffer2.SetRange("Transaction Type", GSTLiabilityBuffer."Transaction Type");
GSTLiabilityBuffer2.SetRange("Account No.", GSTLiabilityBuffer."Account No.");
GSTLiabilityBuffer2.SetRange("Original Document Type", DocumentType);
GSTLiabilityBuffer2.SetRange("Original Document No.", DocumentNo);
GSTLiabilityBuffer2.SetRange("GST Component Code", GSTLiabilityBuffer."GST Component Code");
GSTLiabilityBuffer2.SetRange("GST Group Code", GSTLiabilityBuffer."GST Group Code");
GSTLiabilityBuffer2.SetRange(Exempted, GSTLiabilityBuffer.Exempted);
if GSTLiabilityBuffer2.FindFirst() then begin
if Base then
exit(GSTLiabilityBuffer2."GST Base Amount");
exit(GSTLiabilityBuffer2."GST Amount");
end;
end;
local procedure GetAppliedAmount(
RemainingBase: Decimal;
RemainingAmount: Decimal;
DGSTBase: Decimal;
DGSTAmount: Decimal;
var AppliedBase: Decimal;
var AppliedAmount: Decimal)
begin
if RemainingBase >= DGSTBase then begin
AppliedBase := DGSTBase;
AppliedAmount := DGSTAmount;
end else begin
AppliedBase := RemainingBase;
AppliedAmount := RemainingAmount;
end;
end;
local procedure FillGSTPostingBufferWithApplication(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
AppliedBaseAmount: Decimal;
AppliedAmount: Decimal;
DimensionSetID: Integer)
var
GSTBaseValidation: Codeunit "GST Base Validation";
begin
TempGSTPostingBuffer1[1]."Transaction Type" := TempGSTPostingBuffer1[1]."Transaction Type"::Purchase;
TempGSTPostingBuffer1[1].Type := DetailedGSTLedgerEntry.Type;
TempGSTPostingBuffer1[1]."Gen. Bus. Posting Group" := '';
TempGSTPostingBuffer1[1]."Gen. Prod. Posting Group" := '';
TempGSTPostingBuffer1[1]."GST Component Code" := DetailedGSTLedgerEntry."GST Component Code";
TempGSTPostingBuffer1[1]."GST Reverse Charge" := DetailedGSTLedgerEntry."Reverse Charge";
TempGSTPostingBuffer1[1]."GST Group Code" := '';
TempGSTPostingBuffer1[1].Availment := DetailedGSTLedgerEntry."GST Credit" = DetailedGSTLedgerEntry."GST Credit"::Availment;
TempGSTPostingBuffer1[1]."GST Group Type" := TempGSTPostingBuffer1[1]."GST Group Type"::Service;
TempGSTPostingBuffer1[1]."GST Base Amount" := GSTBaseValidation.RoundGSTPrecision(AppliedBaseAmount);
TempGSTPostingBuffer1[1]."GST Amount" := GSTBaseValidation.RoundGSTPrecision(AppliedAmount);
TempGSTPostingBuffer1[1]."GST %" := DetailedGSTLedgerEntry."GST %";
TempGSTPostingBuffer1[1]."Normal Payment" := DetailedGSTLedgerEntry."Payment Type" = "Payment Type"::Normal;
TempGSTPostingBuffer1[1]."Dimension Set ID" := DimensionSetID;
UpdateGSTPostingBufferWithApplication();
end;
local procedure PostCreditAdjustJnl(
GSTLiabilityBuffer: Record "GST Liability Buffer";
GSTLiabilityAdjustment: Record "GST Liability Adjustment";
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
AppliedBaseAmount: Decimal;
AppliedAmount: Decimal): Boolean
var
PostedGSTLiabilityAdj: Record "Posted GST Liability Adj.";
PostedGSTLiabilityAdj1: Record "Posted GST Liability Adj.";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
EntryNo: Integer;
begin
if PostedGSTLiabilityAdj1.FindLast() then
EntryNo := PostedGSTLiabilityAdj1."Entry No." + 1
else
EntryNo := 1;
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
if AppliedBaseAmount <> 0 then begin
PostedGSTLiabilityAdj.Init();
PostedGSTLiabilityAdj."Entry No." := EntryNo;
PostedGSTLiabilityAdj."Posting Date" := GSTLiabilityAdjustment."Adjustment Posting Date";
PostedGSTLiabilityAdj."USER ID" := CopyStr(UserId(), 1, MaxStrLen(DetailedGSTLedgerEntryInfo."USER ID"));
PostedGSTLiabilityAdj."Adjusted Doc. Entry No." := DetailedGSTLedgerEntry."Entry No.";
PostedGSTLiabilityAdj."Adjusted Doc. Entry Type" := DetailedGSTLedgerEntry."Entry Type";
PostedGSTLiabilityAdj."Transaction Type" := DetailedGSTLedgerEntry."Transaction Type";
PostedGSTLiabilityAdj."Document Type" := DetailedGSTLedgerEntry."Document Type";
PostedGSTLiabilityAdj."Document No." := DetailedGSTLedgerEntry."Document No.";
PostedGSTLiabilityAdj."Adjusted Doc. Posting Date" := GSTLiabilityAdjustment."Document Posting Date";
PostedGSTLiabilityAdj.Type := DetailedGSTLedgerEntry.Type;
PostedGSTLiabilityAdj."No." := DetailedGSTLedgerEntry."No.";
PostedGSTLiabilityAdj."Product Type" := DetailedGSTLedgerEntry."Product Type";
PostedGSTLiabilityAdj."Source Type" := DetailedGSTLedgerEntry."Source Type";
PostedGSTLiabilityAdj."Source No." := DetailedGSTLedgerEntry."Source No.";
PostedGSTLiabilityAdj."HSN/SAC Code" := DetailedGSTLedgerEntry."HSN/SAC Code";
PostedGSTLiabilityAdj."GST Component Code" := DetailedGSTLedgerEntry."GST Component Code";
PostedGSTLiabilityAdj."GST Group Code" := DetailedGSTLedgerEntry."GST Group Code";
PostedGSTLiabilityAdj."GST Jurisdiction Type" := DetailedGSTLedgerEntry."GST Jurisdiction Type";
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Generate then begin
PostedGSTLiabilityAdj."GST Base Amount" := AppliedBaseAmount;
PostedGSTLiabilityAdj."GST Amount" := AppliedAmount;
PostedGSTLiabilityAdj."Adjustment Amount" := AppliedAmount;
PostedGSTLiabilityAdj.Positive := DetailedGSTLedgerEntryInfo.Positive;
end else begin
PostedGSTLiabilityAdj."GST Base Amount" := -AppliedBaseAmount;
PostedGSTLiabilityAdj."GST Amount" := -AppliedAmount;
PostedGSTLiabilityAdj."Adjustment Amount" := AppliedAmount;
PostedGSTLiabilityAdj.Positive := false;
end;
PostedGSTLiabilityAdj."GST %" := GSTLiabilityBuffer."GST %";
PostedGSTLiabilityAdj."G/L Account" := DetailedGSTLedgerEntry."G/L Account No.";
PostedGSTLiabilityAdj."External Document No." := DetailedGSTLedgerEntry."External Document No.";
PostedGSTLiabilityAdj."Location Reg. No." := DetailedGSTLedgerEntry."Location Reg. No.";
PostedGSTLiabilityAdj."Buyer/Seller Reg. No." := DetailedGSTLedgerEntry."Buyer/Seller Reg. No.";
PostedGSTLiabilityAdj."GST Group Type" := DetailedGSTLedgerEntry."GST Group Type";
PostedGSTLiabilityAdj."GST Credit" := DetailedGSTLedgerEntry."GST Credit";
PostedGSTLiabilityAdj."GST Rounding Precision" := DetailedGSTLedgerEntry."GST Rounding Precision";
PostedGSTLiabilityAdj."GST Rounding Type" := DetailedGSTLedgerEntry."GST Rounding Type";
PostedGSTLiabilityAdj."GST Vendor Type" := DetailedGSTLedgerEntry."GST Vendor Type";
PostedGSTLiabilityAdj.Cess := DetailedGSTLedgerEntryInfo.Cess;
PostedGSTLiabilityAdj."Input Service Distribution" := DetailedGSTLedgerEntry."Input Service Distribution";
if DetailedGSTLedgerEntry."GST Credit" = DetailedGSTLedgerEntry."GST Credit"::Availment then
PostedGSTLiabilityAdj."Credit Availed" := true;
PostedGSTLiabilityAdj."Liable to Pay" := true;
if GSTLiabilityAdjustment."Nature of Adjustment" = GSTLiabilityAdjustment."Nature of Adjustment"::Reverse then
PostedGSTLiabilityAdj.Paid := false;
PostedGSTLiabilityAdj."Credit Adjustment Type" := GSTLiabilityAdjustment."Nature of Adjustment";
GSTLiabilityAdjustment.TestField("Journal Doc. No.");
PostedGSTLiabilityAdj."Adjustment Document No." := GSTLiabilityAdjustment."Journal Doc. No.";
PostedGSTLiabilityAdj.Insert();
end;
exit(true);
end;
local procedure UpdateServiceLiabilityDetailedGSTLedgerEntry(
TypeOfAdjustment: Enum "Cr Libty Adjustment Type";
EntryNo: Integer;
AppliedBaseAmount: Decimal;
AppliedAmount: Decimal)
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
begin
DetailedGSTLedgerEntry.Get(EntryNo);
DetailedGSTLedgerEntry."Cr. & Liab. Adjustment Type" := TypeOfAdjustment;
if TypeOfAdjustment = TypeOfAdjustment::Reverse then begin
DetailedGSTLedgerEntry."AdjustmentBase Amount" := 0;
DetailedGSTLedgerEntry."Adjustment Amount" := 0;
DetailedGSTLedgerEntry."Remaining Base Amount" += AppliedBaseAmount;
DetailedGSTLedgerEntry."Remaining GST Amount" += AppliedAmount;
end else begin
DetailedGSTLedgerEntry."AdjustmentBase Amount" += AppliedBaseAmount;
if not DetailedGSTLedgerEntry."GST Exempted Goods" then
DetailedGSTLedgerEntry."Adjustment Amount" += AppliedAmount;
DetailedGSTLedgerEntry."Remaining Base Amount" -= AppliedBaseAmount;
DetailedGSTLedgerEntry."Remaining GST Amount" -= AppliedAmount;
end;
DetailedGSTLedgerEntry.Modify();
end;
local procedure GetCreditAccountNormalPayment(
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
GSTPostingBuffer: Record "GST Posting Buffer";
var AccountNo: Code[20];
var AccountNo2: Code[20];
var BalanceAccountNo: Code[20];
var BalanceAccountNo2: Code[20])
var
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
GSTHelpers: Codeunit "GST Helpers";
begin
Clear(AccountNo);
Clear(AccountNo2);
Clear(BalanceAccountNo);
Clear(BalanceAccountNo2);
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
if GSTPostingBuffer.Availment then begin
AccountNo := GSTHelpers.GetGSTPayableAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
AccountNo2 := GSTHelpers.GetGSTRcvblInterimAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
BalanceAccountNo := GSTHelpers.GetGSTPayableInterimAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
BalanceAccountNo2 := GSTHelpers.GetGSTReceivableAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
end else begin
AccountNo := GSTHelpers.GetGSTPayableAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
BalanceAccountNo := GSTHelpers.GetGSTPayableInterimAccountNo(DetailedGSTLedgerEntryInfo."Location State Code", GSTPostingBuffer."GST Component Code");
end;
end;
local procedure UpdateGSTPostingBufferWithApplication()
begin
TempGSTPostingBuffer1[2] := TempGSTPostingBuffer1[1];
if TempGSTPostingBuffer1[2].Find() then begin
TempGSTPostingBuffer1[2]."GST Base Amount" += TempGSTPostingBuffer1[1]."GST Base Amount";
TempGSTPostingBuffer1[2]."GST Amount" += TempGSTPostingBuffer1[1]."GST Amount";
TempGSTPostingBuffer1[2].Modify();
end else
TempGSTPostingBuffer1[1].Insert();
end;
local procedure CheckSettlementInputValidations(GSTINNo: Code[20]; PostingDate: Date)
begin
if GSTINNo = '' then
Error(GSTINErr);
if PostingDate = 0D then
Error(PostingDateErr);
end;
local procedure GetSettlementDocumentNo(PostingDate: Date; modifyTrue: Boolean): Code[20]
var
GenLedgerSetup: Record "General Ledger Setup";
NoSeriesMgmt: Codeunit NoSeriesManagement;
begin
GenLedgerSetup.Get();
GenLedgerSetup.TestField("GST Settlement Nos.");
exit(NoSeriesMgmt.GetNextNo(GenLedgerSetup."GST Settlement Nos.", PostingDate, modifyTrue));
end;
local procedure CreateGSTPaymentBuffer(
GSTINNo: Code[20];
DocumentNo: Code[20];
PostingDate: Date;
AccountType: Enum "GST Settlement Account Type";
AccountNo: Code[20];
BankRefNo: Code[10];
BankRefDate: Date)
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
ReturnRecoComponent: Record "Retrun & Reco. Components";
GSTPaymentBuffer: Record "GST Payment Buffer";
Liability: Decimal;
RevChargeLiability: Decimal;
CreditAvailable: Decimal;
PostedLiability: Decimal;
PostedRevChargeLiability: Decimal;
PostedCreditAvailable: Decimal;
PostedCrAdjutLiability: Decimal;
PostedCrAdjutCredit: Decimal;
DetGSTDistCredit: Decimal;
PostedCrServiceLiability: Decimal;
PostedCrServiceCredit: Decimal;
PostedAdjustmentAmount: Decimal;
GSTTDSAmount: Decimal;
GSTTCSAmount: Decimal;
GSTTCSLiabilityAmount: Decimal;
PostedGSTTDSCredit: Decimal;
PostedGSTTCSCredit: Decimal;
EntryType: Option " ",TDS,TCS;
begin
Window.Open(PaymentBufferMsg);
DetailedGSTLedgerEntry.LockTable();
if ReturnRecoComponent.FindSet() then
repeat
Window.Update(1, ReturnRecoComponent."Component Name");
InsertGSTPaymentBuffer(
GSTPaymentBuffer,
ReturnRecoComponent."Component Name",
GSTINNo,
DocumentNo,
AccountType,
AccountNo,
PostingDate,
BankRefNo,
BankRefDate);
GetLiabilityAndCredit(GSTPaymentBuffer, Liability, RevChargeLiability, CreditAvailable);
GetpostedAmount(
GSTPaymentBuffer,
PostedLiability,
PostedCreditAvailable,
PostedRevChargeLiability,
PostedGSTTDSCredit,
PostedGSTTCSCredit);
GetPostedCreditAdjustmentAmount(GSTPaymentBuffer, PostedCrAdjutLiability, PostedCrAdjutCredit);
GetPostedCreditandLiabilityAmount(GSTPaymentBuffer, PostedCrServiceLiability, PostedCrServiceCredit);
GetGSTAdjustmentAmount(GSTPaymentBuffer, PostedAdjustmentAmount);
GetDetGSTDistEntryAmount(GSTPaymentBuffer, DetGSTDistCredit);
GetGSTTDSTCSCreditAmount(GSTPaymentBuffer, GSTTDSAmount, EntryType::TDS);
GetGSTTDSTCSCreditAmount(GSTPaymentBuffer, GSTTCSAmount, EntryType::TCS);
GetGSTTCSLiabilityAmount(GSTPaymentBuffer, GSTTCSLiabilityAmount);
GSTPaymentBuffer.Validate("Distributed Credit", DetGSTDistCredit);
GSTPaymentBuffer.Validate("GST TDS Credit Available", GSTTDSAmount + PostedGSTTDSCredit);
GSTPaymentBuffer.Validate("GST TCS Credit Available", GSTTCSAmount + PostedGSTTCSCredit);
GSTPaymentBuffer.Validate("GST TCS Liability", GSTTCSLiabilityAmount);
Liability += Round(PostedCrAdjutLiability + PostedLiability + PostedAdjustmentAmount);
CreditAvailable += PostedCreditAvailable + PostedCrAdjutCredit + DetGSTDistCredit + PostedCrServiceCredit;
if PostedRevChargeLiability < 0 then
RevChargeLiability += PostedRevChargeLiability;
RevChargeLiability += PostedCrServiceLiability;
GSTPaymentBuffer.Validate("Payment Liability - Rev. Chrg.", RevChargeLiability);
if RevChargeLiability > 0 then
GSTPaymentBuffer.Validate("Payment Amount - Rev. Chrg.", GSTPaymentBuffer."Payment Liability - Rev. Chrg.");
if CreditAvailable >= 0 then begin
GSTPaymentBuffer.Validate("Credit Availed", CreditAvailable);
GSTPaymentBuffer.Validate("Payment Liability", Liability);
end else begin
GSTPaymentBuffer.Validate("UnAdjutsed Credit", CreditAvailable);
GSTPaymentBuffer.Validate("Payment Liability", Liability + Abs(CreditAvailable));
end;
if GSTPaymentBuffer."Payment Liability" < 0 then begin
GSTPaymentBuffer.Validate("UnAdjutsed Liability", GSTPaymentBuffer."Payment Liability");
GSTPaymentBuffer.Validate("Payment Liability", 0);
end;
if GSTPaymentBuffer."Net Payment Liability" >= 0 then
GSTPaymentBuffer.Validate("Payment Amount", GSTPaymentBuffer."Net Payment Liability")
else begin
GSTPaymentBuffer.Validate("Credit Utilized", 0);
GSTPaymentBuffer.Validate("Payment Amount", 0);
GSTPaymentBuffer.Validate(
"UnAdjutsed Liability",
GSTPaymentBuffer."Net Payment Liability" + GSTPaymentBuffer."UnAdjutsed Liability");
GSTPaymentBuffer.Validate("Net Payment Liability", 0);
end;
GSTPaymentBuffer.Modify(true);
until ReturnRecoComponent.Next() = 0;
Window.Close();
end;
local procedure InsertGSTPaymentBuffer(
var GSTPaymentBuffer: Record "GST Payment Buffer";
GSTComponent: Code[30];
GSTINNo: Code[20];
DocumentNo: Code[20];
AccountType: Enum "GST Settlement Account Type";
AccountNo: Code[20];
PostingDate: Date;
BankRefNo: Code[10];
BankRefDate: Date)
var
GSTRegistrationNos: Record "GST Registration Nos.";
begin
GSTRegistrationNos.Get(GSTINNo);
GSTPaymentBuffer.Init();
GSTPaymentBuffer."GST Registration No." := GSTINNo;
GSTPaymentBuffer."GST Input Service Distribution" := GSTRegistrationNos."Input Service Distributor";
GSTPaymentBuffer."GST Component Code" := GSTComponent;
GSTPaymentBuffer.Description := GSTComponent;
GSTPaymentBuffer."Document No." := DocumentNo;
GSTPaymentBuffer."Location State Code" := GetGSTNState(GSTINNo);
GSTPaymentBuffer."Account Type" := GSTSettlementAccTypeEnum2GenJnlAccType(AccountType);
GSTPaymentBuffer."Account No." := AccountNo;
GSTPaymentBuffer."Posting Date" := PostingDate;
GSTPaymentBuffer."Period end Date" := GetPeriodendDate(PostingDate);
GSTPaymentBuffer."Bank Reference No." := BankRefNo;
GSTPaymentBuffer."Bank Reference Date" := BankRefDate;
GSTPaymentBuffer.Insert(true);
end;
local procedure GetLiabilityAndCredit(
GSTPaymentBuffer: Record "GST Payment Buffer";
var Liability: Decimal;
var RevChargeLiability: Decimal;
var CreditAvailable: Decimal)
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
begin
Clear(Liability);
Clear(RevChargeLiability);
Clear(CreditAvailable);
FilterDetailedGSTLedgerEntry(GSTPaymentBuffer, DetailedGSTLedgerEntry);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if not ((DetailedGSTLedgerEntry."ARN No." <> '') and (DetailedGSTLedgerEntry."Buyer/Seller Reg. No." = '')) then
case DetailedGSTLedgerEntry."Reverse Charge" of
false:
begin
if DetailedGSTLedgerEntry."Liable to Pay" then
Liability += DetailedGSTLedgerEntry."GST Amount" * -1;
if DetailedGSTLedgerEntry."Credit Availed" then
CreditAvailable += DetailedGSTLedgerEntry."GST Amount";
end;
true:
if DetailedGSTLedgerEntry."Payment Type" = "Payment Type"::Normal then begin
if DetailedGSTLedgerEntry."Liable to Pay" then
RevChargeLiability += DetailedGSTLedgerEntry."GST Amount" * -1;
if DetailedGSTLedgerEntry."Credit Availed" then
CreditAvailable += DetailedGSTLedgerEntry."GST Amount" * -1;
end else begin
if DetailedGSTLedgerEntry."Liable to Pay" then
RevChargeLiability += DetailedGSTLedgerEntry."GST Amount";
if DetailedGSTLedgerEntry."Credit Availed" then
if (DetailedGSTLedgerEntry."Payment Type" = "Payment Type"::Advance) and
(DetailedGSTLedgerEntry."Entry Type" = "Entry Type"::Application) and
not DetailedGSTLedgerEntry."Associated Enterprises" and
(DetailedGSTLedgerEntry."GST Group Type" = "GST Group Type"::Service)
then
CreditAvailable += DetailedGSTLedgerEntry."GST Amount" * -1
else
CreditAvailable += DetailedGSTLedgerEntry."GST Amount";
end;
end;
until DetailedGSTLedgerEntry.Next() = 0;
end;
local procedure FilterDetailedGSTLedgerEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
var DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry")
begin
DetailedGSTLedgerEntry.SetCurrentKey("Location Reg. No.", "GST Component Code", Paid, "Posting Date");
DetailedGSTLedgerEntry.SetRange("Location Reg. No.", GSTPaymentBuffer."GST Registration No.");
DetailedGSTLedgerEntry.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
DetailedGSTLedgerEntry.SetRange(Paid, false);
DetailedGSTLedgerEntry.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Period end Date");
DetailedGSTLedgerEntry.SetRange("Input Service Distribution", false);
DetailedGSTLedgerEntry.SetFilter("Entry Type", '<>%1', DetailedGSTLedgerEntry."Entry Type"::"Adjustment Entry");
end;
local procedure GetGSTNState(GSTINNo: Code[20]): Code[10]
var
GSTRegistrationNos: Record "GST Registration Nos.";
begin
GSTRegistrationNos.Get(GSTINNo);
exit(GSTRegistrationNos."State Code");
end;
local procedure GetPostedCreditAdjustmentAmount(
GSTPaymentBuffer: Record "GST Payment Buffer";
var LiableAmount: Decimal;
var CreditAmount: Decimal)
var
DetailedCrAdjstmntEntry: Record "Detailed Cr. Adjstmnt. Entry";
begin
Clear(LiableAmount);
Clear(CreditAmount);
FilterPostedCreditAdjustmentEntry(GSTPaymentBuffer, DetailedCrAdjstmntEntry);
if DetailedCrAdjstmntEntry.FindSet() then
repeat
if DetailedCrAdjstmntEntry."Liable to Pay" then
LiableAmount += DetailedCrAdjstmntEntry."GST Amount";
if DetailedCrAdjstmntEntry."Credit Availed" then
CreditAmount += DetailedCrAdjstmntEntry."GST Amount";
until DetailedCrAdjstmntEntry.Next() = 0;
end;
local procedure FilterPostedCreditAdjustmentEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
var DetailedCrAdjstmntEntry: Record "Detailed Cr. Adjstmnt. Entry")
begin
DetailedCrAdjstmntEntry.SetCurrentKey("Location Reg. No.", "GST Component Code", Paid, "Posting Date");
DetailedCrAdjstmntEntry.SetRange("Location Reg. No.", GSTPaymentBuffer."GST Registration No.");
DetailedCrAdjstmntEntry.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
DetailedCrAdjstmntEntry.SetRange(Paid, false);
DetailedCrAdjstmntEntry.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Posting Date");
end;
local procedure GetPostedCreditandLiabilityAmount(
GSTPaymentBuffer: Record "GST Payment Buffer";
var LiableAmount: Decimal;
var CreditAmount: Decimal)
var
PostedGSTLiabilityAdj: Record "Posted GST Liability Adj.";
begin
Clear(LiableAmount);
Clear(CreditAmount);
FilterPostedCreditandLiabilityEntry(GSTPaymentBuffer, PostedGSTLiabilityAdj);
if PostedGSTLiabilityAdj.FindSet() then
repeat
if PostedGSTLiabilityAdj."Liable to Pay" then
LiableAmount += PostedGSTLiabilityAdj."GST Amount";
if PostedGSTLiabilityAdj."Credit Availed" then
CreditAmount += PostedGSTLiabilityAdj."GST Amount";
until PostedGSTLiabilityAdj.Next() = 0;
end;
local procedure GetGSTAdjustmentAmount(GSTPaymentBuffer: Record "GST Payment Buffer"; var Liability: Decimal)
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
begin
Clear(Liability);
FilterDetailedGSTLedgerEntryforAdjustment(GSTPaymentBuffer, DetailedGSTLedgerEntry);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if not ((DetailedGSTLedgerEntry."ARN No." <> '') and (DetailedGSTLedgerEntry."Buyer/Seller Reg. No." = '')) then
Liability += Abs(DetailedGSTLedgerEntry."GST Amount");
until DetailedGSTLedgerEntry.Next() = 0;
end;
local procedure GetDetGSTDistEntryAmount(GSTPaymentBuffer: Record "GST Payment Buffer"; var CreditAmount: Decimal)
var
DetailedGSTDistEntry: Record "Detailed GST Dist. Entry";
begin
Clear(CreditAmount);
FilterDetGSTDistEntry(GSTPaymentBuffer, DetailedGSTDistEntry, true);
if DetailedGSTDistEntry.FindSet() then
repeat
if DetailedGSTDistEntry."Credit Availed" then
CreditAmount += DetailedGSTDistEntry."Distribution Amount";
until DetailedGSTDistEntry.Next() = 0;
end;
local procedure FilterDetailedGSTLedgerEntryforAdjustment(
GSTPaymentBuffer: Record "GST Payment Buffer";
var DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry")
begin
DetailedGSTLedgerEntry.SetCurrentKey("Location Reg. No.", "GST Component Code", Paid, "Posting Date");
DetailedGSTLedgerEntry.SetRange("Location Reg. No.", GSTPaymentBuffer."GST Registration No.");
DetailedGSTLedgerEntry.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
DetailedGSTLedgerEntry.SetRange("Entry Type", DetailedGSTLedgerEntry."Entry Type"::"Adjustment Entry");
DetailedGSTLedgerEntry.SetRange(Paid, false);
DetailedGSTLedgerEntry.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Period end Date");
DetailedGSTLedgerEntry.SetRange("Input Service Distribution", false);
end;
local procedure GetGSTTDSTCSCreditAmount(
GSTPaymentBuffer: Record "GST Payment Buffer";
var CreditAmount: Decimal;
EntryType: Option " ",TDS,TCS)
var
GSTTdsTcsEntry: Record "GST TDS/TCS Entry";
begin
Clear(CreditAmount);
if EntryType = EntryType::TDS then
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TDS, false)
else
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TCS, false);
if GSTTdsTcsEntry.FindSet() then
repeat
CreditAmount += GSTTdsTcsEntry."GST TDS/TCS Amount (LCY)";
until GSTTdsTcsEntry.Next() = 0;
end;
local procedure GetGSTTCSLiabilityAmount(GSTPaymentBuffer: Record "GST Payment Buffer"; var LiabilityAmount: Decimal)
var
GSTTdsTcsEntry: Record "GST TDS/TCS Entry";
EntryType: Option " ",TDS,TCS;
begin
Clear(LiabilityAmount);
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TCS, true);
if GSTTdsTcsEntry.FindSet() then
repeat
LiabilityAmount += Abs(GSTTdsTcsEntry."GST TDS/TCS Amount (LCY)");
until GSTTdsTcsEntry.Next() = 0;
end;
local procedure FilterPostedCreditandLiabilityEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
var PostedGSTLiabilityAdj: Record "Posted GST Liability Adj.")
begin
PostedGSTLiabilityAdj.SetCurrentKey("Location Reg. No.", "GST Component Code", Paid, "Posting Date");
PostedGSTLiabilityAdj.SetRange("Location Reg. No.", GSTPaymentBuffer."GST Registration No.");
PostedGSTLiabilityAdj.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
PostedGSTLiabilityAdj.SetRange(Paid, false);
PostedGSTLiabilityAdj.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Posting Date");
end;
local procedure FilterGSTTDSTCSEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
var GSTTdsTcsEntry: Record "GST TDS/TCS Entry";
EntryType: Option " ",TDS,TCS;
VendorGSTTCS: Boolean)
begin
GSTTdsTcsEntry.SetCurrentKey("Location GST Reg. No.", "GST Component Code", Paid, "Posting Date");
GSTTdsTcsEntry.SetRange("Location GST Reg. No.", GSTPaymentBuffer."GST Registration No.");
GSTTdsTcsEntry.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
GSTTdsTcsEntry.SetRange(Paid, false);
GSTTdsTcsEntry.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Posting Date");
if EntryType = EntryType::TDS then begin
GSTTdsTcsEntry.SetRange(Type, GSTTdsTcsEntry.Type::TDS);
GSTTdsTcsEntry.SetRange("Certificate Received", true);
GSTTdsTcsEntry.SetRange("Credit Availed", true);
end else begin
GSTTdsTcsEntry.SetRange(Type, GSTTdsTcsEntry.Type::TCS);
if VendorGSTTCS then
GSTTdsTcsEntry.SetRange("Liable to Pay", true)
else
GSTTdsTcsEntry.SetRange("Credit Availed", true);
end;
GSTTdsTcsEntry.SetRange(Reversed, false);
end;
local procedure GetPostedAmount(
GSTPaymentBuffer: Record "GST Payment Buffer";
var PaymentLiability: Decimal;
var CreditAvailed: Decimal;
var PaymentLiabilityRev: Decimal;
var GSTTDSCreditAvailed: Decimal;
var GSTTCSCreditAvailed: Decimal)
var
PostedSettlementEntries: Record "Posted Settlement Entries";
begin
Clear(PaymentLiability);
Clear(CreditAvailed);
Clear(PaymentLiabilityRev);
PostedSettlementEntries.SetRange("GST Registration No.", GSTPaymentBuffer."GST Registration No.");
PostedSettlementEntries.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
if PostedSettlementEntries.FindLast() then begin
PaymentLiability := PostedSettlementEntries."UnAdjutsed Liability";
CreditAvailed := PostedSettlementEntries."Carry Forward";
PaymentLiabilityRev := PostedSettlementEntries."Payment Liability - Rev. Chrg.";
GSTTDSCreditAvailed := PostedSettlementEntries."GST TDS Credit Unutilized";
GSTTCSCreditAvailed := PostedSettlementEntries."GST TCS Credit Unutilized";
end;
end;
local procedure FilterDetGSTDistEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
var DetailedGSTDistEntry: Record "Detailed GST Dist. Entry";
FilterAvailment: Boolean)
begin
DetailedGSTDistEntry.SetRange("Rcpt. GST Reg. No.", GSTPaymentBuffer."GST Registration No.");
DetailedGSTDistEntry.SetRange("Rcpt. Component Code", GSTPaymentBuffer."GST Component Code");
if FilterAvailment then
DetailedGSTDistEntry.SetRange("Rcpt. GST Credit", DetailedGSTDistEntry."Rcpt. GST Credit"::Availment);
DetailedGSTDistEntry.SetRange(Paid, false);
DetailedGSTDistEntry.SetFilter("Posting Date", '..%1', GSTPaymentBuffer."Period end Date");
DetailedGSTDistEntry.SetFilter("ISD Posting Date", '<=%1', GSTPaymentBuffer."Posting Date");
end;
local procedure CheckSettlementValidations(GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
GSTClaimSetoff: Record "GST Claim Setoff";
GSTBaseValidation: Codeunit "GST Base Validation";
begin
IsDifferentAccountTypeAndNo(GSTINNo, DocumentNo);
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
GSTBaseValidation.CheckGSTAccountingPeriod(GSTPaymentBuffer."Posting Date", true);
GSTBaseValidation.CheckGSTAccountingPeriod(GSTPaymentBuffer."Period end Date", true);
if GSTPaymentBuffer."Credit Utilized" > GSTPaymentBuffer."Net Payment Liability" then
Error(
CreditUtilizedErr,
GSTPaymentBuffer."Credit Utilized",
GSTPaymentBuffer."Net Payment Liability",
GSTPaymentBuffer."GST Component Code");
if GSTPaymentBuffer."Credit Utilized" >= 0 then
if GSTPaymentBuffer."Net Payment Liability" >
(GSTPaymentBuffer."Credit Utilized" +
GSTPaymentBuffer."GST TDS Credit Utilized" +
GSTPaymentBuffer."GST TCS Credit Utilized" +
GSTPaymentBuffer."Payment Amount")
then
Error(
LiabilityExceedErr,
GSTPaymentBuffer."Credit Utilized" +
GSTPaymentBuffer."GST TDS Credit Utilized" +
GSTPaymentBuffer."GST TCS Credit Utilized" +
GSTPaymentBuffer."Payment Amount",
GSTPaymentBuffer."Net Payment Liability",
GSTPaymentBuffer."GST Component Code");
if GSTPaymentBuffer."Surplus Credit" > 0 then
GSTPaymentBuffer."Carry Forward" := GSTPaymentBuffer."Surplus Credit";
if (GSTPaymentBuffer."Credit Utilized" > 0) then begin
GSTClaimSetoff.Reset();
GSTClaimSetoff.SetCurrentKey(Priority);
GSTClaimSetoff.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
if not GSTClaimSetoff.IsEmpty() then begin
if GSTPaymentBuffer."Surplus Credit" < 0 then
Error(
CreditAvailableErr,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer."Credit Utilized",
GSTPaymentBuffer."Credit Utilized" + GSTPaymentBuffer."Surplus Credit");
end else
if (GSTPaymentBuffer."Credit Utilized" > 0) then
Error(CreditSetoffErr, GSTPaymentBuffer."GST Component Code");
end;
GSTPaymentBuffer.Modify(true);
if GSTPaymentBuffer."Payment Liability - Rev. Chrg." >= 0 then
GSTPaymentBuffer.TestField("Payment Amount - Rev. Chrg.", GSTPaymentBuffer."Payment Liability - Rev. Chrg.")
else
GSTPaymentBuffer.TestField("Payment Amount - Rev. Chrg.", 0);
if (GSTPaymentBuffer."Payment Amount" <> 0) or
(GSTPaymentBuffer.Interest <> 0) or
(GSTPaymentBuffer.Penalty <> 0) or
(GSTPaymentBuffer.Fees <> 0) or
(GSTPaymentBuffer.Others <> 0)
then
GSTPaymentBuffer.TestField("Account No.");
if GSTPaymentBuffer.Interest <> 0 then
GSTPaymentBuffer.TestField("Interest Account No.");
if GSTPaymentBuffer.Penalty <> 0 then
GSTPaymentBuffer.TestField("Penalty Account No.");
if GSTPaymentBuffer.Fees <> 0 then
GSTPaymentBuffer.TestField("Fees Account No.");
if GSTPaymentBuffer.Others <> 0 then
GSTPaymentBuffer.TestField("Others Account No.");
until GSTPaymentBuffer.Next() = 0;
end;
local procedure IsDifferentAccountTypeAndNo(GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
GSTPaymentBuffer2: Record "GST Payment Buffer";
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindFirst() then begin
GSTPaymentBuffer2.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer2.SetRange("Document No.", DocumentNo);
GSTPaymentBuffer2.SetFilter("Account Type", '<>%1', GSTPaymentBuffer."Account Type");
if not GSTPaymentBuffer2.IsEmpty() then
Error(GSTPaymentFieldSameErr, Format(GSTPaymentBuffer.FieldCaption("Account Type")));
GSTPaymentBuffer2.SetRange("Account Type");
GSTPaymentBuffer2.SetFilter("Account No.", '<>%1', GSTPaymentBuffer."Account No.");
if not GSTPaymentBuffer2.IsEmpty() then
Error(GSTPaymentFieldSameErr, GSTPaymentBuffer.FieldCaption("Account No."));
GSTPaymentBuffer2.SetRange("Account No.");
GSTPaymentBuffer2.SetFilter("Bank Reference No.", '<>%1', GSTPaymentBuffer."Bank Reference No.");
if not GSTPaymentBuffer2.IsEmpty() then
Error(GSTPaymentFieldSameErr, GSTPaymentBuffer.FieldCaption("Bank Reference No."));
GSTPaymentBuffer2.SetRange("Bank Reference No.");
GSTPaymentBuffer2.SetFilter("Bank Reference Date", '<>%1', GSTPaymentBuffer."Bank Reference Date");
if not GSTPaymentBuffer2.IsEmpty() then
Error(GSTPaymentFieldSameErr, GSTPaymentBuffer.FieldCaption("Bank Reference Date"));
end;
end;
local procedure CopyDocDimToTempDocDim(GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
IsError: Boolean;
ErrText: Text[250];
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
CheckDimComb(GSTPaymentBuffer."Dimension Set ID", IsError, ErrText);
if IsError then
Error(DimCombinationErr, GSTPaymentBuffer."GST Component Code", ErrText);
CheckDimValuePosting(GSTPaymentBuffer."Document No.", GSTPaymentBuffer."Dimension Set ID");
until GSTPaymentBuffer.Next() = 0;
end;
local procedure CheckDimComb(DimSetID: Integer; var IsError: Boolean; var ErrText: Text[250])
begin
if not DimensionManagement.CheckDimIDComb(DimSetID) then begin
IsError := true;
ErrText := DimensionManagement.GetDimCombErr();
end else
IsError := false;
end;
local procedure IsAllComponentsHaveZeroValue(GSTINNo: Code[20]; DocumentNo: Code[20]): Boolean
var
GSTPaymentBuffer: Record "GST Payment Buffer";
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
if not ((GSTPaymentBuffer."UnAdjutsed Credit" = 0) and
(GSTPaymentBuffer."Total Payment Amount" = 0) and
(GSTPaymentBuffer."Credit Utilized" = 0) and
(GSTPaymentBuffer."GST TDS Credit Utilized" = 0) and
(GSTPaymentBuffer."GST TCS Credit Utilized" = 0) and
(GSTPaymentBuffer."GST TCS Liability" = 0))
then
exit(false);
until GSTPaymentBuffer.Next() = 0;
exit(true);
end;
local procedure CheckDimValuePosting(DocumentNo: Code[20]; DimSetID: Integer)
var
NumberArr: array[10] of Code[20];
DummyTableIDArr: array[10] of Integer;
begin
NumberArr[1] := DocumentNo;
if not DimensionManagement.CheckDimValuePosting(DummyTableIDArr, NumberArr, DimSetID) then
Error(InvaidDimensionErr, DimensionManagement.GetDimValuePostingErr());
end;
local procedure PostGSTBuffer(GSTINNo: Code[20]; PaymentDocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
GSTPostingSetup: Record "GST Posting Setup";
SourceCodeSetup: Record "Source Code Setup";
EntryType: Option ,TDS,TCS;
AccountType: Enum "Gen. Journal Account Type";
AccountNo: Code[20];
TotalPaymentAmount: Decimal;
ReceivableAmount: Decimal;
Sign: Decimal;
begin
SourceCodeSetup.Get();
SourceCodeSetup.TestField("GST Settlement");
Window.Open(UpdatingLedgersMsg);
GSTPaymentBuffer.LockTable();
Sign := -1;
Clear(GenJnlPostLine);
Clear(DimensionManagement);
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", PaymentDocumentNo);
if GSTPaymentBuffer.FindSet() then begin
GSTPaymentBuffer."Document No." := GetSettlementDocumentNo(GSTPaymentBuffer."Posting Date", true);
repeat
if GSTPaymentBuffer."Surplus Credit" < 0 then
GSTPaymentBuffer.TestField("Surplus Credit", 0);
AccountType := GSTPaymentBuffer."Account Type";
AccountNo := GSTPaymentBuffer."Account No.";
ChequeNo := GSTPaymentBuffer."Bank Reference No.";
ChequeDate := GSTPaymentBuffer."Bank Reference Date";
PostingDate := GSTPaymentBuffer."Posting Date";
PostedDocumentNo := GSTPaymentBuffer."Document No.";
if IsGSTPaymentApplicable(GSTPaymentBuffer) then begin
Window.Update(1, GSTPaymentBuffer."GST Component Code");
GSTPostingSetup.Get(GSTPaymentBuffer."Location State Code", GetComponentId(GSTPaymentBuffer."GST Component Code"));
TotalPaymentAmount +=
GSTPaymentBuffer."Payment Amount" +
GSTPaymentBuffer."GST TCS Liability" +
GSTPaymentBuffer.Interest +
GSTPaymentBuffer.Penalty +
GSTPaymentBuffer.Fees +
GSTPaymentBuffer.Others;
if GSTPaymentBuffer."Payment Liability - Rev. Chrg." > 0 then begin
TotalPaymentAmount += GSTPaymentBuffer."Payment Amount - Rev. Chrg.";
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetPayableAccount(GSTPostingSetup),
GSTPaymentBuffer."Payment Amount - Rev. Chrg.",
StrSubstNo(GSTPaymentTypeTxt, GSTPaymentBuffer."GST Component Code", ReverseChargePaymentTxt));
end;
if GSTPaymentBuffer."Net Payment Liability" > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetPayableAccount(GSTPostingSetup),
GSTPaymentBuffer."Net Payment Liability",
StrSubstNo(GSTPaymentTypeTxt, GSTPaymentBuffer."GST Component Code", NetPaymentLibTxt));
if GSTPaymentBuffer."GST TDS Credit Utilized" > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetGSTTDSReceivableAccount(GSTPostingSetup),
GSTPaymentBuffer."GST TDS Credit Utilized" * Sign,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption("GST TDS Credit Utilized")));
if GSTPaymentBuffer."GST TCS Credit Utilized" > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetGSTTCSReceivableAccount(GSTPostingSetup),
GSTPaymentBuffer."GST TCS Credit Utilized" * Sign,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption("GST TCS Credit Utilized")));
if GSTPaymentBuffer."GST TCS Liability" > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetGSTTCSPayableAccount(GSTPostingSetup),
GSTPaymentBuffer."GST TCS Liability",
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption("GST TCS Liability")));
if GSTPaymentBuffer.Interest > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GSTPaymentBuffer."Interest Account No.",
GSTPaymentBuffer.Interest,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption(Interest)));
if GSTPaymentBuffer.Penalty > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GSTPaymentBuffer."Penalty Account No.",
GSTPaymentBuffer.Penalty,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption(Penalty)));
if GSTPaymentBuffer.Fees > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GSTPaymentBuffer."Fees Account No.",
GSTPaymentBuffer.Fees,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption(Fees)));
if GSTPaymentBuffer.Others > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GSTPaymentBuffer."Others Account No.",
GSTPaymentBuffer.Others,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
GSTPaymentBuffer.FieldCaption(Others)));
if (GSTPaymentBuffer."Surplus Cr. Utilized" <> 0) then begin
ReceivableAmount := GSTPaymentBuffer."Surplus Cr. Utilized";
if ReceivableAmount > 0 then
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetRecAccount(GSTPostingSetup),
ReceivableAmount * Sign,
StrSubstNo(GSTPaymentTypeTxt, GSTPaymentBuffer."GST Component Code", CreditUtilizedTxt));
end;
if GSTPaymentBuffer."UnAdjutsed Credit" < 0 then begin
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetPayableAccount(GSTPostingSetup),
GSTPaymentBuffer."UnAdjutsed Credit",
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
UnadjustedCreditTxt));
CreateAndPostGenJournalLine(
GSTPaymentBuffer."Account Type"::"G/L Account",
GetRecAccount(GSTPostingSetup),
GSTPaymentBuffer."UnAdjutsed Credit" * Sign,
StrSubstNo(
GSTPaymentTypeTxt,
GSTPaymentBuffer."GST Component Code",
UnadjustedCreditTxt));
end;
end;
CloseDetailedGSTLedger(GSTPaymentBuffer);
ClosePostedCreditAdjustmentEntry(GSTPaymentBuffer);
ClosePostedCreditandLiabilitytEntry(GSTPaymentBuffer);
CloseDetGSTDistEntry(GSTPaymentBuffer);
CloseGSTTDSTCSEntry(GSTPaymentBuffer, EntryType::TDS, false);
CloseGSTTDSTCSEntry(GSTPaymentBuffer, EntryType::TCS, false);
CloseGSTTDSTCSEntry(GSTPaymentBuffer, EntryType::TCS, true);
CloseDetailedGSTLedgerEntryForAdjustment(GSTPaymentBuffer);
until GSTPaymentBuffer.Next() = 0;
if TotalPaymentAmount > 0 then
CreateAndPostGenJournalLine(
AccountType,
AccountNo,
TotalPaymentAmount * Sign,
StrSubstNo(GSTPaymentTypeTxt, GstTxt, TotalPaymentTxt));
end;
Window.Close();
end;
local procedure CreateAndPostGenJournalLine(
AccountType: Enum "Gen. Journal Account Type";
AccountNo: Code[20];
PaymentAmount: Decimal;
AmountType: Text[100])
var
GenJournalLine2: Record "Gen. Journal Line";
AmountType2: Text[50];
begin
AmountType2 := CopyStr(AmountType, 1, 50);
GenJournalLine2.Init();
GenJournalLine2."Account Type" := AccountType;
GenJournalLine2."Account No." := AccountNo;
if AccountType = AccountType::"Bank Account" then begin
GenJournalLine2."Bank Payment Type" := "Bank Payment Type"::"Manual Check";
GenJournalLine2."Check Printed" := true;
end;
GenJournalLine2.Amount := PaymentAmount;
GenJournalLine2."System-Created Entry" := true;
GenJournalLine2."Document No." := PostedDocumentNo;
GenJournalLine2."Posting Date" := PostingDate;
GenJournalLine2."Dimension Set ID" := TempGSTPostingBuffer[1]."Dimension Set ID";
GenJournalLine2.Description := AmountType2;
DimensionManagement.UpdateGlobalDimFromDimSetID(
GenJournalLine2."Dimension Set ID",
GenJournalLine2."Shortcut Dimension 1 Code",
GenJournalLine2."Shortcut Dimension 2 Code");
GenJnlPostLine.RunWithCheck(GenJournalLine2);
end;
local procedure GetComponentId(GSTGroupCode: Code[30]): Integer
var
GSTSetup: Record "GST Setup";
TaxComponent: Record "Tax Component";
begin
if not GSTSetup.Get() then
exit;
GSTSetup.TestField("GST Tax Type");
TaxComponent.SetRange("Tax Type", GSTSetup."GST Tax Type");
TaxComponent.SetRange(Name, GSTGroupCode);
if TaxComponent.FindFirst() then
exit(TaxComponent.Id);
end;
local procedure GetPayableAccount(GSTPostingSetup: Record "GST Posting Setup"): Code[20]
begin
GSTPostingSetup.TestField("Payable Account");
exit(GSTPostingSetup."Payable Account");
end;
local procedure GetGSTTDSReceivableAccount(GSTPostingSetup: Record "GST Posting Setup"): Code[20]
begin
GSTPostingSetup.TestField("GST TDS Receivable Account");
exit(GSTPostingSetup."GST TDS Receivable Account");
end;
local procedure GetGSTTCSReceivableAccount(GSTPostingSetup: Record "GST Posting Setup"): Code[20]
begin
GSTPostingSetup.TestField("GST TCS Receivable Account");
exit(GSTPostingSetup."GST TCS Receivable Account");
end;
local procedure GetGSTTCSPayableAccount(GSTPostingSetup: Record "GST Posting Setup"): Code[20]
begin
GSTPostingSetup.TestField("GST TCS Payable Account");
exit(GSTPostingSetup."GST TCS Payable Account");
end;
local procedure GetRecAccount(GSTPostingSetup: Record "GST Posting Setup"): Code[20]
begin
GSTPostingSetup.TestField("Receivable Account");
exit(GSTPostingSetup."Receivable Account");
end;
local procedure CloseDetailedGSTLedger(var GSTPaymentBuffer: Record "GST Payment Buffer")
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntry2: Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
begin
FilterDetailedGSTLedgerEntry(GSTPaymentBuffer, DetailedGSTLedgerEntry);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if not ((DetailedGSTLedgerEntry."ARN No." <> '') and (DetailedGSTLedgerEntry."Buyer/Seller Reg. No." = '')) then begin
DetailedGSTLedgerEntry2.Get(DetailedGSTLedgerEntry."Entry No.");
DetailedGSTLedgerEntry2."Payment Document No." := GSTPaymentBuffer."Document No.";
DetailedGSTLedgerEntry2.Paid := true;
DetailedGSTLedgerEntry2.Modify();
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
DetailedGSTLedgerEntryInfo."Payment Document Date" := GSTPaymentBuffer."Posting Date";
DetailedGSTLedgerEntryInfo.Modify();
end;
until DetailedGSTLedgerEntry.Next() = 0;
InsertPostedSettlementEntries(GSTPaymentBuffer);
end;
local procedure InsertPostedSettlementEntries(GSTPaymentBuffer: Record "GST Payment Buffer")
var
PostedSettlementEntries: Record "Posted Settlement Entries";
begin
PostedSettlementEntries.Init();
PostedSettlementEntries.TransferFields(GSTPaymentBuffer);
PostedSettlementEntries.Insert(true);
end;
local procedure ClosePostedCreditAdjustmentEntry(GSTPaymentBuffer: Record "GST Payment Buffer")
var
DetailedCrAdjstmntEntry: Record "Detailed Cr. Adjstmnt. Entry";
DetailedCrAdjstmntEntry2: Record "Detailed Cr. Adjstmnt. Entry";
begin
FilterPostedCreditAdjustmentEntry(GSTPaymentBuffer, DetailedCrAdjstmntEntry);
if DetailedCrAdjstmntEntry.FindSet() then
repeat
DetailedCrAdjstmntEntry2.Get(DetailedCrAdjstmntEntry."Entry No.");
DetailedCrAdjstmntEntry2.Paid := true;
DetailedCrAdjstmntEntry2."Payment Document No." := GSTPaymentBuffer."Document No.";
DetailedCrAdjstmntEntry2."Payment Document Date" := GSTPaymentBuffer."Posting Date";
DetailedCrAdjstmntEntry2.Modify();
until DetailedCrAdjstmntEntry.Next() = 0;
end;
local procedure ClosePostedCreditandLiabilitytEntry(GSTPaymentBuffer: Record "GST Payment Buffer")
var
PostedGSTLiabilityAdj: Record "Posted GST Liability Adj.";
PostedGSTLiabilityAdj2: Record "Posted GST Liability Adj.";
begin
FilterPostedCreditandLiabilityEntry(GSTPaymentBuffer, PostedGSTLiabilityAdj);
if PostedGSTLiabilityAdj.FindSet() then
repeat
PostedGSTLiabilityAdj2.Get(PostedGSTLiabilityAdj."Entry No.");
PostedGSTLiabilityAdj2.Paid := true;
PostedGSTLiabilityAdj2."Payment Document No." := GSTPaymentBuffer."Document No.";
PostedGSTLiabilityAdj2."Payment Document Date" := GSTPaymentBuffer."Posting Date";
PostedGSTLiabilityAdj2.Modify();
until PostedGSTLiabilityAdj.Next() = 0;
end;
local procedure CloseDetGSTDistEntry(GSTPaymentBuffer: Record "GST Payment Buffer")
var
DetailedGSTDistEntry: Record "Detailed GST Dist. Entry";
DetailedGSTDistEntry2: Record "Detailed GST Dist. Entry";
begin
FilterDetGSTDistEntry(GSTPaymentBuffer, DetailedGSTDistEntry, false);
if DetailedGSTDistEntry.FindSet() then
repeat
DetailedGSTDistEntry2.Get(DetailedGSTDistEntry."Entry No.");
DetailedGSTDistEntry2.Paid := true;
DetailedGSTDistEntry2."Payment Document No." := GSTPaymentBuffer."Document No.";
DetailedGSTDistEntry2."Payment Document Date" := GSTPaymentBuffer."Posting Date";
DetailedGSTDistEntry2.Modify();
until DetailedGSTDistEntry.Next() = 0;
end;
local procedure CloseGSTTDSTCSEntry(
GSTPaymentBuffer: Record "GST Payment Buffer";
EntryType: Option " ",TDS,TCS;
VendorGSTTCS: Boolean)
var
GSTTdsTcsEntry: Record "GST TDS/TCS Entry";
GSTTdsTcsEntry2: Record "GST TDS/TCS Entry";
begin
if EntryType = EntryType::TDS then
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TDS, false)
else
if VendorGSTTCS then
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TCS, true)
else
FilterGSTTDSTCSEntry(GSTPaymentBuffer, GSTTdsTcsEntry, EntryType::TCS, false);
if GSTTdsTcsEntry.FindSet() then
repeat
GSTTdsTcsEntry2.Get(GSTTdsTcsEntry."Entry No.");
GSTTdsTcsEntry2.Paid := true;
GSTTdsTcsEntry2."Payment Document No." := GSTPaymentBuffer."Document No.";
GSTTdsTcsEntry2."Payment Document Date" := GSTPaymentBuffer."Posting Date";
GSTTdsTcsEntry2.Modify();
until GSTTdsTcsEntry.Next() = 0;
end;
local procedure CloseDetailedGSTLedgerEntryForAdjustment(var GSTPaymentBuffer: Record "GST Payment Buffer")
var
DetailedGSTLedgerEntry: Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntry2: Record "Detailed GST Ledger Entry";
DetailedGSTLedgerEntryInfo: Record "Detailed GST Ledger Entry Info";
begin
FilterDetailedGSTLedgerEntryforAdjustment(GSTPaymentBuffer, DetailedGSTLedgerEntry);
if DetailedGSTLedgerEntry.FindSet() then
repeat
if not ((DetailedGSTLedgerEntry."ARN No." <> '') and (DetailedGSTLedgerEntry."Buyer/Seller Reg. No." = '')) then begin
DetailedGSTLedgerEntry2.Get(DetailedGSTLedgerEntry."Entry No.");
DetailedGSTLedgerEntry2."Payment Document No." := GSTPaymentBuffer."Document No.";
DetailedGSTLedgerEntry2.Paid := true;
DetailedGSTLedgerEntry2.Modify();
GetDetailedGSTLedgerEnfo(DetailedGSTLedgerEntry."Entry No.", DetailedGSTLedgerEntryInfo);
DetailedGSTLedgerEntryInfo."Payment Document Date" := GSTPaymentBuffer."Posting Date";
DetailedGSTLedgerEntryInfo.Modify();
end;
until DetailedGSTLedgerEntry.Next() = 0;
end;
local procedure GSTSettlementAccTypeEnum2GenJnlAccType(GSTSettAccType: Enum "GST Settlement Account Type"): Enum "Gen. Journal Account Type"
var
ConversionErr: Label 'Account Type %1 is not a valid option.', Comment = '%1 = GST Settlement Account Type';
begin
case GSTSettAccType of
GSTSettAccType::"G/L Account":
exit("Gen. Journal Account Type"::"G/L Account");
GSTSettAccType::"Bank Account":
exit("Gen. Journal Account Type"::"Bank Account");
else
Error(ConversionErr, GSTSettAccType);
end;
end;
procedure ValidateCreditUtilizedAmt(GSTINNo: Code[20]; DocumentNo: Code[20])
var
GSTPaymentBuffer: Record "GST Payment Buffer";
GSTPaymentBuffer2: Record "GST Payment Buffer";
GSTClaimSetoff: Record "GST Claim Setoff";
GSTPaymentBufferDetails: Record "GST Payment Buffer Details";
AvailableAmount: Decimal;
CreditUtilizedAmount: Decimal;
LineNo: Integer;
begin
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
GSTPaymentBuffer."Surplus Cr. Utilized" := 0;
GSTPaymentBuffer."Carry Forward" := 0;
GSTPaymentBuffer."Surplus Credit" := GSTPaymentBuffer."Total Credit Available";
GSTPaymentBuffer.Modify(true);
Until GSTPaymentBuffer.Next() = 0;
GSTPaymentBufferDetails.Reset();
if GSTPaymentBufferDetails.FindFirst() then
GSTPaymentBufferDetails.DeleteAll();
GSTPaymentBuffer.Reset();
GSTPaymentBuffer.SetRange("GST Registration No.", GSTINNo);
GSTPaymentBuffer.SetRange("Document No.", DocumentNo);
if GSTPaymentBuffer.FindSet() then
repeat
if GSTPaymentBuffer."Credit Utilized" > 0 then begin
AvailableAmount := 0;
CreditUtilizedAmount := GSTPaymentBuffer."Credit Utilized";
GSTClaimSetoff.Reset();
GSTClaimSetoff.SETCURRENTKEY(Priority);
GSTClaimSetoff.SetRange("GST Component Code", GSTPaymentBuffer."GST Component Code");
if GSTClaimSetoff.FindSet() then
repeat
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
GSTPaymentBufferDetails.Init();
GSTPaymentBufferDetails."GST Registration No." := GSTPaymentBuffer."GST Registration No.";
GSTPaymentBufferDetails."Document No." := GSTPaymentBuffer."Document No.";
GSTPaymentBufferDetails."GST Component Code" := GSTPaymentBuffer."GST Component Code";
GSTPaymentBufferDetails."Net Payment Liability" := GSTPaymentBuffer."Net Payment Liability";
GSTPaymentBufferDetails."Payment Liability" := GSTPaymentBuffer."Payment Liability";
GSTPaymentBufferDetails."SetOff Component Code" := GSTPaymentBuffer2."GST Component Code";
if GSTPaymentBuffer2."Total Credit Available" > 0 then begin
AvailableAmount += GSTPaymentBuffer2."Total Credit Available" - GSTPaymentBuffer2."Surplus Cr. Utilized";
if AvailableAmount > 0 then begin
GSTPaymentBufferDetails."Total Credit Available" := AvailableAmount;
if AvailableAmount >= CreditUtilizedAmount then begin
if GSTPaymentBuffer."GST Component Code" = GSTPaymentBuffer2."GST Component Code" then begin
GSTPaymentBuffer."Surplus Cr. Utilized" += CreditUtilizedAmount;
GSTPaymentBuffer."Surplus Credit" -= CreditUtilizedAmount;
GSTPaymentBuffer."Carry Forward" := GSTPaymentBuffer."Surplus Credit";
GSTPaymentBuffer.Modify(true);
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
end else begin
GSTPaymentBuffer2."Surplus Cr. Utilized" += CreditUtilizedAmount;
GSTPaymentBuffer2."Surplus Credit" -= CreditUtilizedAmount;
end;
GSTPaymentBufferDetails."Credit Utilized" := CreditUtilizedAmount;
GSTPaymentBufferDetails."Surplus Credit" := GSTPaymentBuffer2."Surplus Credit";
CreditUtilizedAmount := 0;
end else begin
if GSTPaymentBuffer."GST Component Code" = GSTPaymentBuffer2."GST Component Code" then begin
GSTPaymentBuffer."Surplus Cr. Utilized" += AvailableAmount;
GSTPaymentBuffer."Surplus Credit" -= AvailableAmount;
GSTPaymentBuffer."Carry Forward" := GSTPaymentBuffer."Surplus Credit";
GSTPaymentBuffer.Modify(true);
GSTPaymentBuffer2.Get(GSTINNo, DocumentNo, GSTClaimSetoff."Set Off Component Code");
end else begin
GSTPaymentBuffer2."Surplus Cr. Utilized" += AvailableAmount;
GSTPaymentBuffer2."Surplus Credit" -= AvailableAmount;
end;
GSTPaymentBufferDetails."Credit Utilized" := AvailableAmount;
GSTPaymentBufferDetails."Surplus Credit" := GSTPaymentBuffer2."Surplus Credit";
CreditUtilizedAmount -= AvailableAmount;
AvailableAmount := 0;
end;
GSTPaymentBuffer2."Carry Forward" := GSTPaymentBuffer2."Surplus Credit";
GSTPaymentBuffer2.Modify(true);
GSTPaymentBuffer.Modify(true);
end;
end;
LineNo += 10000;
GSTPaymentBufferDetails."Line No." := LineNo;
GSTPaymentBufferDetails.Insert();
Until (GSTClaimSetoff.Next() = 0) OR (CreditUtilizedAmount = 0);
end;
Until GSTPaymentBuffer.Next() = 0;
end;
} | 57.635298 | 297 | 0.607368 |
ed1783fd81da8393b59335668bd792c4227275db | 706 | pl | Perl | script/genlist.pl | FriarRich/kernpp | 00f2d5e92cbce076373e0acbfc21a8b6f23b8923 | [
"MIT"
]
| null | null | null | script/genlist.pl | FriarRich/kernpp | 00f2d5e92cbce076373e0acbfc21a8b6f23b8923 | [
"MIT"
]
| null | null | null | script/genlist.pl | FriarRich/kernpp | 00f2d5e92cbce076373e0acbfc21a8b6f23b8923 | [
"MIT"
]
| null | null | null | #/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
$|++;
our(%calls);
use FindBin;
use lib "$FindBin::Bin";
require "syscall.pl" or die "$@";
sub code_sort {
return $calls{$a}{code} <=> $calls{$b}{code};
};
$\="\n";
$,=" ";
print q(#file script/genheaders.pl);
print q(#line 1);
print q(extern "C" {);
for my $name (sort {code_sort} keys %calls) {
our(%call);
local *call=$calls{$name};
next unless $call{impl};
my @args = @{$call{args}};
for(@args) {
$_=join(" ",@$_);
};
@args=join(", ", @args);
my $rtype=$call{ret};
print "// __NR__", $call{name}, "=", $call{code}, "\n";
print "inline $rtype $name(@args)";
print " __attribute__((__always_inline__));";
};
print q(});
| 19.611111 | 63 | 0.57932 |
73e6ed843bcfcaf6eafbc90419e3b71ee0c30895 | 5,117 | pl | Perl | webapp/perl/local/lib/perl5/auto/share/dist/DateTime-Locale/fr-CA.pl | AK-10/AK-10-isucon8-preliminary-revenge | f390710721b2f2e3d9f60120394ec37c9c96b975 | [
"MIT"
]
| 2 | 2019-04-15T04:28:23.000Z | 2019-04-16T12:45:51.000Z | webapp/perl/local/lib/perl5/auto/share/dist/DateTime-Locale/fr-CA.pl | AK-10/AK-10-isucon8-preliminary-revenge | f390710721b2f2e3d9f60120394ec37c9c96b975 | [
"MIT"
]
| 16 | 2019-08-28T23:45:01.000Z | 2019-12-20T02:12:13.000Z | webapp/perl/local/lib/perl5/auto/share/dist/DateTime-Locale/fr-CA.pl | AK-10/AK-10-isucon8-preliminary-revenge | f390710721b2f2e3d9f60120394ec37c9c96b975 | [
"MIT"
]
| 1 | 2019-04-14T01:11:20.000Z | 2019-04-14T01:11:20.000Z | {
am_pm_abbreviated => [
"a.m.",
"p.m.",
],
available_formats => {
Bh => "h 'h' B",
Bhm => "h 'h' mm B",
Bhms => "h 'h' mm 'min' ss 's' B",
E => "E",
EBhm => "E h 'h' mm B",
EBhms => "E h 'h' mm 'min' ss 's' B",
EHm => "E HH 'h' mm",
EHms => "E HH 'h' mm 'min' ss 's'",
Ed => "E d",
Ehm => "E h 'h' mm a",
Ehms => "E h 'h' mm 'min' ss 's' a",
Gy => "y G",
GyMMM => "MMM y G",
GyMMMEd => "E d MMM y G",
GyMMMd => "d MMM y G",
H => "HH 'h'",
Hm => "HH 'h' mm",
Hms => "HH 'h' mm 'min' ss 's'",
Hmsv => "HH 'h' mm 'min' ss 's' v",
Hmv => "HH 'h' mm v",
M => "L",
MEd => "E M-d",
MMM => "LLL",
MMMEd => "E d MMM",
"MMMMW-count-one" => "'semaine' W (MMMM)",
"MMMMW-count-other" => "'semaine' W (MMMM)",
MMMMd => "d MMMM",
MMMd => "d MMM",
MMd => "MM-d",
MMdd => "MM-dd",
Md => "M-d",
d => "d",
h => "h 'h' a",
hm => "h 'h' mm a",
hms => "h 'h' mm 'min' ss 's' a",
hmsv => "h 'h' mm 'min' ss 's' a v",
hmv => "h 'h' mm a v",
ms => "mm 'min' ss 's'",
y => "y",
yM => "y-MM",
yMEd => "E y-MM-dd",
yMM => "y-MM",
yMMM => "MMM y",
yMMMEd => "E d MMM y",
yMMMM => "MMMM y",
yMMMd => "d MMM y",
yMd => "y-MM-dd",
yQQQ => "QQQ y",
yQQQQ => "QQQQ y",
"yw-count-one" => "'semaine' w 'de' Y",
"yw-count-other" => "'semaine' w 'de' Y",
},
code => "fr-CA",
date_format_full => "EEEE d MMMM y",
date_format_long => "d MMMM y",
date_format_medium => "d MMM y",
date_format_short => "yy-MM-dd",
datetime_format_full => "{1} '\N{U+00e0}' {0}",
datetime_format_long => "{1} '\N{U+00e0}' {0}",
datetime_format_medium => "{1} {0}",
datetime_format_short => "{1} {0}",
day_format_abbreviated => [
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam.",
"dim.",
],
day_format_narrow => [
"L",
"M",
"M",
"J",
"V",
"S",
"D",
],
day_format_wide => [
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi",
"dimanche",
],
day_stand_alone_abbreviated => [
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam.",
"dim.",
],
day_stand_alone_narrow => [
"L",
"M",
"M",
"J",
"V",
"S",
"D",
],
day_stand_alone_wide => [
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi",
"dimanche",
],
era_abbreviated => [
"av. J.-C.",
"ap. J.-C.",
],
era_narrow => [
"av. J.-C.",
"ap. J.-C.",
],
era_wide => [
"avant J\N{U+00e9}sus-Christ",
"apr\N{U+00e8}s J\N{U+00e9}sus-Christ",
],
first_day_of_week => 7,
glibc_date_1_format => "%a %b %e %H:%M:%S %Z %Y",
glibc_date_format => "%Y-%m-%d",
glibc_datetime_format => "%a %d %b %Y %T %Z",
glibc_time_12_format => "%I:%M:%S %p",
glibc_time_format => "%T",
language => "French",
month_format_abbreviated => [
"janv.",
"f\N{U+00e9}vr.",
"mars",
"avr.",
"mai",
"juin",
"juill.",
"ao\N{U+00fb}t",
"sept.",
"oct.",
"nov.",
"d\N{U+00e9}c.",
],
month_format_narrow => [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
],
month_format_wide => [
"janvier",
"f\N{U+00e9}vrier",
"mars",
"avril",
"mai",
"juin",
"juillet",
"ao\N{U+00fb}t",
"septembre",
"octobre",
"novembre",
"d\N{U+00e9}cembre",
],
month_stand_alone_abbreviated => [
"janv.",
"f\N{U+00e9}vr.",
"mars",
"avr.",
"mai",
"juin",
"juill.",
"ao\N{U+00fb}t",
"sept.",
"oct.",
"nov.",
"d\N{U+00e9}c.",
],
month_stand_alone_narrow => [
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
],
month_stand_alone_wide => [
"janvier",
"f\N{U+00e9}vrier",
"mars",
"avril",
"mai",
"juin",
"juillet",
"ao\N{U+00fb}t",
"septembre",
"octobre",
"novembre",
"d\N{U+00e9}cembre",
],
name => "French Canada",
native_language => "fran\N{U+00e7}ais",
native_name => "fran\N{U+00e7}ais Canada",
native_script => undef,
native_territory => "Canada",
native_variant => undef,
quarter_format_abbreviated => [
"T1",
"T2",
"T3",
"T4",
],
quarter_format_narrow => [
1,
2,
3,
4,
],
quarter_format_wide => [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre",
],
quarter_stand_alone_abbreviated => [
"T1",
"T2",
"T3",
"T4",
],
quarter_stand_alone_narrow => [
1,
2,
3,
4,
],
quarter_stand_alone_wide => [
"1er trimestre",
"2e trimestre",
"3e trimestre",
"4e trimestre",
],
script => undef,
territory => "Canada",
time_format_full => "HH 'h' mm 'min' ss 's' zzzz",
time_format_long => "HH 'h' mm 'min' ss 's' z",
time_format_medium => "HH 'h' mm 'min' ss 's'",
time_format_short => "HH 'h' mm",
variant => undef,
version => 33,
}
| 18.539855 | 52 | 0.443228 |
ed17d6d03466236bae09c7a97a547c2adc4b3215 | 24,736 | pm | Perl | lib/App/Sqitch/Engine/oracle.pm | clad/sqitch | 8726d5acc89b3d9eb25319983fdeb0990488a16a | [
"MIT"
]
| null | null | null | lib/App/Sqitch/Engine/oracle.pm | clad/sqitch | 8726d5acc89b3d9eb25319983fdeb0990488a16a | [
"MIT"
]
| null | null | null | lib/App/Sqitch/Engine/oracle.pm | clad/sqitch | 8726d5acc89b3d9eb25319983fdeb0990488a16a | [
"MIT"
]
| null | null | null | package App::Sqitch::Engine::oracle;
use 5.010;
use Moo;
use utf8;
use Path::Class;
use DBI;
use Try::Tiny;
use App::Sqitch::X qw(hurl);
use Locale::TextDomain qw(App-Sqitch);
use App::Sqitch::Plan::Change;
use List::Util qw(first);
use App::Sqitch::Types qw(DBH Dir ArrayRef);
use namespace::autoclean;
extends 'App::Sqitch::Engine';
# VERSION
BEGIN {
# We tell the Oracle connector which encoding to use. The last part of the
# environment variable NLS_LANG is relevant concerning data encoding.
$ENV{NLS_LANG} = 'AMERICAN_AMERICA.AL32UTF8';
# Disable SQLPATH so that no start scripts run.
$ENV{SQLPATH} = '';
}
sub destination {
my $self = shift;
# Just use the target name if it doesn't look like a URI or if the URI
# includes the database name.
return $self->target->name if $self->target->name !~ /:/
|| $self->target->uri->dbname;
# Use the URI sans password, and with the database name added.
my $uri = $self->target->uri->clone;
$uri->password(undef) if $uri->password;
$uri->dbname(
$ENV{TWO_TASK}
|| ( App::Sqitch::ISWIN ? $ENV{LOCAL} : undef )
|| $ENV{ORACLE_SID}
|| $self->username
);
return $uri->as_string;
}
# No username or password defaults.
sub _def_user { }
sub _def_pass { }
has _sqlplus => (
is => 'ro',
isa => ArrayRef,
lazy => 1,
default => sub {
my $self = shift;
[ $self->client, qw(-S -L /nolog) ];
},
);
sub sqlplus { @{ shift->_sqlplus } }
has tmpdir => (
is => 'ro',
isa => Dir,
lazy => 1,
default => sub {
require File::Temp;
dir File::Temp::tempdir( CLEANUP => 1 );
},
);
sub key { 'oracle' }
sub name { 'Oracle' }
sub driver { 'DBD::Oracle 1.23' }
sub default_registry { '' }
sub default_client {
file( ($ENV{ORACLE_HOME} || ()), 'sqlplus' )->stringify
}
has dbh => (
is => 'rw',
isa => DBH,
lazy => 1,
default => sub {
my $self = shift;
$self->use_driver;
my $uri = $self->uri;
DBI->connect($uri->dbi_dsn, $self->username, $self->password, {
PrintError => 0,
RaiseError => 0,
AutoCommit => 1,
FetchHashKeyName => 'NAME_lc',
HandleError => sub {
my ($err, $dbh) = @_;
$@ = $err;
@_ = ($dbh->state || 'DEV' => $dbh->errstr);
goto &hurl;
},
Callbacks => {
connected => sub {
my $dbh = shift;
$dbh->do("ALTER SESSION SET $_='YYYY-MM-DD HH24:MI:SS TZR'") for qw(
nls_date_format
nls_timestamp_format
nls_timestamp_tz_format
);
if (my $schema = $self->registry) {
try {
$dbh->do("ALTER SESSION SET CURRENT_SCHEMA = $schema");
# https://www.nntp.perl.org/group/perl.dbi.dev/2013/11/msg7622.html
$dbh->set_err(undef, undef) if $dbh->err;
};
}
return;
},
},
});
}
);
# Need to wait until dbh is defined.
with 'App::Sqitch::Role::DBIEngine';
sub _log_tags_param {
[ map { $_->format_name } $_[1]->tags ];
}
sub _log_requires_param {
[ map { $_->as_string } $_[1]->requires ];
}
sub _log_conflicts_param {
[ map { $_->as_string } $_[1]->conflicts ];
}
sub _ts2char_format {
# q{CAST(to_char(%1$s AT TIME ZONE 'UTC', '"year":YYYY:"month":MM:"day":DD') AS VARCHAR2(100 byte)) || CAST(to_char(%1$s AT TIME ZONE 'UTC', ':"hour":HH24:"minute":MI:"second":SS:"time_zone":"UTC"') AS VARCHAR2(168 byte))}
# Good grief, Oracle, WTF? https://github.com/sqitchers/sqitch/issues/316
join ' || ', (
q{to_char(%1$s AT TIME ZONE 'UTC', '"year":YYYY')},
q{to_char(%1$s AT TIME ZONE 'UTC', ':"month":MM')},
q{to_char(%1$s AT TIME ZONE 'UTC', ':"day":DD')},
q{to_char(%1$s AT TIME ZONE 'UTC', ':"hour":HH24')},
q{to_char(%1$s AT TIME ZONE 'UTC', ':"minute":MI')},
q{to_char(%1$s AT TIME ZONE 'UTC', ':"second":SS')},
q{':time_zone:UTC'},
);
}
sub _ts_default { 'current_timestamp' }
sub _can_limit { 0 }
sub _char2ts {
my $dt = $_[1];
join ' ', $dt->ymd('-'), $dt->hms(':'), $dt->time_zone->name;
}
sub _listagg_format {
# https://stackoverflow.com/q/16313631/79202
return q{CAST(COLLECT(CAST(%s AS VARCHAR2(512))) AS sqitch_array)};
}
sub _regex_op { 'REGEXP_LIKE(%s, ?)' }
sub _simple_from { ' FROM dual' }
sub _multi_values {
my ($self, $count, $expr) = @_;
return join "\nUNION ALL ", ("SELECT $expr FROM dual") x $count;
}
sub _dt($) {
require App::Sqitch::DateTime;
return App::Sqitch::DateTime->new(split /:/ => shift);
}
sub _cid {
my ( $self, $ord, $offset, $project ) = @_;
return try {
return $self->dbh->selectcol_arrayref(qq{
SELECT change_id FROM (
SELECT change_id, rownum as rnum FROM (
SELECT change_id
FROM changes
WHERE project = ?
ORDER BY committed_at $ord
)
) WHERE rnum = ?
}, undef, $project || $self->plan->project, ($offset // 0) + 1)->[0];
} catch {
return if $self->_no_table_error;
die $_;
};
}
sub _cid_head {
my ($self, $project, $change) = @_;
return $self->dbh->selectcol_arrayref(qq{
SELECT change_id FROM (
SELECT change_id
FROM changes
WHERE project = ?
AND change = ?
ORDER BY committed_at DESC
) WHERE rownum = 1
}, undef, $project, $change)->[0];
}
sub _select_state {
my ( $self, $project, $with_hash ) = @_;
my $cdtcol = sprintf $self->_ts2char_format, 'c.committed_at';
my $pdtcol = sprintf $self->_ts2char_format, 'c.planned_at';
my $tagcol = sprintf $self->_listagg_format, 't.tag';
my $hshcol = $with_hash ? "c.script_hash\n , " : '';
my $dbh = $self->dbh;
return $dbh->selectrow_hashref(qq{
SELECT * FROM (
SELECT c.change_id
, ${hshcol}c.change
, c.project
, c.note
, c.committer_name
, c.committer_email
, $cdtcol AS committed_at
, c.planner_name
, c.planner_email
, $pdtcol AS planned_at
, $tagcol AS tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = ?
GROUP BY c.change_id
, ${hshcol}c.change
, c.project
, c.note
, c.committer_name
, c.committer_email
, c.committed_at
, c.planner_name
, c.planner_email
, c.planned_at
ORDER BY c.committed_at DESC
) WHERE rownum = 1
}, undef, $project // $self->plan->project);
}
sub is_deployed_change {
my ( $self, $change ) = @_;
$self->dbh->selectcol_arrayref(
'SELECT 1 FROM changes WHERE change_id = ?',
undef, $change->id
)->[0];
}
sub initialized {
my $self = shift;
return $self->dbh->selectcol_arrayref(q{
SELECT 1
FROM all_tables
WHERE owner = UPPER(?)
AND table_name = 'CHANGES'
}, undef, $self->registry || $self->username)->[0];
}
sub _log_event {
my ( $self, $event, $change, $tags, $requires, $conflicts) = @_;
my $dbh = $self->dbh;
my $sqitch = $self->sqitch;
$tags ||= $self->_log_tags_param($change);
$requires ||= $self->_log_requires_param($change);
$conflicts ||= $self->_log_conflicts_param($change);
# Use the sqitch_array() constructor to insert arrays of values.
my $tag_ph = 'sqitch_array('. join(', ', ('?') x @{ $tags }) . ')';
my $req_ph = 'sqitch_array('. join(', ', ('?') x @{ $requires }) . ')';
my $con_ph = 'sqitch_array('. join(', ', ('?') x @{ $conflicts }) . ')';
my $ts = $self->_ts_default;
$dbh->do(qq{
INSERT INTO events (
event
, change_id
, change
, project
, note
, tags
, requires
, conflicts
, committer_name
, committer_email
, planned_at
, planner_name
, planner_email
, committed_at
)
VALUES (?, ?, ?, ?, ?, $tag_ph, $req_ph, $con_ph, ?, ?, ?, ?, ?, $ts)
}, undef,
$event,
$change->id,
$change->name,
$change->project,
$change->note,
@{ $tags },
@{ $requires },
@{ $conflicts },
$sqitch->user_name,
$sqitch->user_email,
$self->_char2ts( $change->timestamp ),
$change->planner_name,
$change->planner_email,
);
return $self;
}
sub changes_requiring_change {
my ( $self, $change ) = @_;
# Why CTE: https://forums.oracle.com/forums/thread.jspa?threadID=1005221
return @{ $self->dbh->selectall_arrayref(q{
WITH tag AS (
SELECT tag, committed_at, project,
ROW_NUMBER() OVER (partition by project ORDER BY committed_at) AS rnk
FROM tags
)
SELECT c.change_id, c.project, c.change, t.tag AS asof_tag
FROM dependencies d
JOIN changes c ON c.change_id = d.change_id
LEFT JOIN tag t ON t.project = c.project AND t.committed_at >= c.committed_at
WHERE d.dependency_id = ?
AND (t.rnk IS NULL OR t.rnk = 1)
}, { Slice => {} }, $change->id) };
}
sub name_for_change_id {
my ( $self, $change_id ) = @_;
# Why CTE: https://forums.oracle.com/forums/thread.jspa?threadID=1005221
return $self->dbh->selectcol_arrayref(q{
WITH tag AS (
SELECT tag, committed_at, project,
ROW_NUMBER() OVER (partition by project ORDER BY committed_at) AS rnk
FROM tags
)
SELECT change || COALESCE(t.tag, '@HEAD')
FROM changes c
LEFT JOIN tag t ON c.project = t.project AND t.committed_at >= c.committed_at
WHERE change_id = ?
AND (t.rnk IS NULL OR t.rnk = 1)
}, undef, $change_id)->[0];
}
sub change_id_offset_from_id {
my ( $self, $change_id, $offset ) = @_;
# Just return the ID if there is no offset.
return $change_id unless $offset;
# Are we offset forwards or backwards?
my ( $dir, $op ) = $offset > 0 ? ( 'ASC', '>' ) : ( 'DESC' , '<' );
return $self->dbh->selectcol_arrayref(qq{
SELECT id FROM (
SELECT id, rownum AS rnum FROM (
SELECT change_id AS id
FROM changes
WHERE project = ?
AND committed_at $op (
SELECT committed_at FROM changes WHERE change_id = ?
)
ORDER BY committed_at $dir
)
) WHERE rnum = ?
}, undef, $self->plan->project, $change_id, abs $offset)->[0];
}
sub change_offset_from_id {
my ( $self, $change_id, $offset ) = @_;
# Just return the object if there is no offset.
return $self->load_change($change_id) unless $offset;
# Are we offset forwards or backwards?
my ( $dir, $op ) = $offset > 0 ? ( 'ASC', '>' ) : ( 'DESC' , '<' );
my $tscol = sprintf $self->_ts2char_format, 'c.planned_at';
my $tagcol = sprintf $self->_listagg_format, 't.tag';
my $change = $self->dbh->selectrow_hashref(qq{
SELECT id, name, project, note, timestamp, planner_name, planner_email, tags
FROM (
SELECT id, name, project, note, timestamp, planner_name, planner_email, tags, rownum AS rnum
FROM (
SELECT c.change_id AS id, c.change AS name, c.project, c.note,
$tscol AS timestamp, c.planner_name, c.planner_email,
$tagcol AS tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = ?
AND c.committed_at $op (
SELECT committed_at FROM changes WHERE change_id = ?
)
GROUP BY c.change_id, c.change, c.project, c.note, c.planned_at,
c.planner_name, c.planner_email, c.committed_at
ORDER BY c.committed_at $dir
)
) WHERE rnum = ?
}, undef, $self->plan->project, $change_id, abs $offset) || return undef;
$change->{timestamp} = _dt $change->{timestamp};
return $change;
}
sub is_deployed_tag {
my ( $self, $tag ) = @_;
return $self->dbh->selectcol_arrayref(
'SELECT 1 FROM tags WHERE tag_id = ?',
undef, $tag->id
)->[0];
}
sub are_deployed_changes {
my $self = shift;
my @qs;
my $i = @_;
while ($i > 250) {
push @qs => 'change_id IN (' . join(', ' => ('?') x 250) . ')';
$i -= 250;
}
push @qs => 'change_id IN (' . join(', ' => ('?') x @_) . ')';
my $expr = join ' OR ', @qs;
@{ $self->dbh->selectcol_arrayref(
"SELECT change_id FROM changes WHERE $expr",
undef,
map { $_->id } @_,
) };
}
sub _registry_variable {
my $self = shift;
my $schema = $self->registry;
return $schema ? ("DEFINE registry=$schema") : (
# Select the current schema into ®istry.
# https://www.orafaq.com/node/515
'COLUMN sname for a30 new_value registry',
q{SELECT SYS_CONTEXT('USERENV', 'SESSION_SCHEMA') AS sname FROM DUAL;},
);
}
sub initialize {
my $self = shift;
my $schema = $self->registry;
hurl engine => __ 'Sqitch already initialized' if $self->initialized;
# Load up our database.
(my $file = file(__FILE__)->dir->file('oracle.sql')) =~ s/"/""/g;
$self->_run_with_verbosity($file);
$self->dbh->do("ALTER SESSION SET CURRENT_SCHEMA = $schema") if $schema;
$self->_register_release;
}
# Override for special handling of regular the expression operator and
# LIMIT/OFFSET.
sub search_events {
my ( $self, %p ) = @_;
# Determine order direction.
my $dir = 'DESC';
if (my $d = delete $p{direction}) {
$dir = $d =~ /^ASC/i ? 'ASC'
: $d =~ /^DESC/i ? 'DESC'
: hurl 'Search direction must be either "ASC" or "DESC"';
}
# Limit with regular expressions?
my (@wheres, @params);
for my $spec (
[ committer => 'committer_name' ],
[ planner => 'planner_name' ],
[ change => 'change' ],
[ project => 'project' ],
) {
my $regex = delete $p{ $spec->[0] } // next;
push @wheres => "REGEXP_LIKE($spec->[1], ?)";
push @params => $regex;
}
# Match events?
if (my $e = delete $p{event} ) {
my ($in, @vals) = $self->_in_expr( $e );
push @wheres => "event $in";
push @params => @vals;
}
# Assemble the where clause.
my $where = @wheres
? "\n WHERE " . join( "\n ", @wheres )
: '';
# Handle remaining parameters.
my ($lim, $off) = (delete $p{limit}, delete $p{offset});
hurl 'Invalid parameters passed to search_events(): '
. join ', ', sort keys %p if %p;
# Prepare, execute, and return.
my $cdtcol = sprintf $self->_ts2char_format, 'committed_at';
my $pdtcol = sprintf $self->_ts2char_format, 'planned_at';
my $sql = qq{
SELECT event
, project
, change_id
, change
, note
, requires
, conflicts
, tags
, committer_name
, committer_email
, $cdtcol AS committed_at
, planner_name
, planner_email
, $pdtcol AS planned_at
FROM events$where
ORDER BY events.committed_at $dir
};
if ($lim || $off) {
my @limits;
if ($lim) {
$off //= 0;
push @params => $lim + $off;
push @limits => 'rnum <= ?';
}
if ($off) {
push @params => $off;
push @limits => 'rnum > ?';
}
$sql = "SELECT * FROM ( SELECT ROWNUM AS rnum, i.* FROM ($sql) i ) WHERE "
. join ' AND ', @limits;
}
my $sth = $self->dbh->prepare($sql);
$sth->execute(@params);
return sub {
my $row = $sth->fetchrow_hashref or return;
delete $row->{rnum};
$row->{committed_at} = _dt $row->{committed_at};
$row->{planned_at} = _dt $row->{planned_at};
return $row;
};
}
# Override to lock the changes table. This ensures that only one instance of
# Sqitch runs at one time.
sub begin_work {
my $self = shift;
my $dbh = $self->dbh;
# Start transaction and lock changes to allow only one change at a time.
$dbh->begin_work;
$dbh->do('LOCK TABLE changes IN EXCLUSIVE MODE');
return $self;
}
sub _file_for_script {
my ($self, $file) = @_;
# Just use the file if no special character.
if ($file !~ /[@?%\$]/) {
$file =~ s/"/""/g;
return $file;
}
# Alias or copy the file to a temporary directory that's removed on exit.
(my $alias = $file->basename) =~ s/[@?%\$]/_/g;
$alias = $self->tmpdir->file($alias);
# Remove existing file.
if (-e $alias) {
$alias->remove or hurl oracle => __x(
'Cannot remove {file}: {error}',
file => $alias,
error => $!
);
}
if (App::Sqitch::ISWIN) {
# Copy it.
$file->copy_to($alias) or hurl oracle => __x(
'Cannot copy {file} to {alias}: {error}',
file => $file,
alias => $alias,
error => $!
);
} else {
# Symlink it.
$alias->remove;
symlink $file->absolute, $alias or hurl oracle => __x(
'Cannot symlink {file} to {alias}: {error}',
file => $file,
alias => $alias,
error => $!
);
}
# Return the alias.
$alias =~ s/"/""/g;
return $alias;
}
sub run_file {
my $self = shift;
my $file = $self->_file_for_script(shift);
$self->_run(qq{\@"$file"});
}
sub _run_with_verbosity {
my $self = shift;
my $file = $self->_file_for_script(shift);
# Suppress STDOUT unless we want extra verbosity.
my $meth = $self->can($self->sqitch->verbosity > 1 ? '_run' : '_capture');
$self->$meth(qq{\@"$file"});
}
sub run_upgrade { shift->_run_with_verbosity(@_) }
sub run_verify { shift->_run_with_verbosity(@_) }
sub run_handle {
my ($self, $fh) = @_;
my $conn = $self->_script;
open my $tfh, '<:utf8_strict', \$conn;
$self->sqitch->spool( [$tfh, $fh], $self->sqlplus );
}
# Override to take advantage of the RETURNING expression, and to save tags as
# an array rather than a space-delimited string.
sub log_revert_change {
my ($self, $change) = @_;
my $dbh = $self->dbh;
my $cid = $change->id;
# Delete tags.
my $sth = $dbh->prepare(
'DELETE FROM tags WHERE change_id = ? RETURNING tag INTO ?',
);
$sth->bind_param(1, $cid);
$sth->bind_param_inout_array(2, my $del_tags = [], 0, {
ora_type => DBD::Oracle::ORA_VARCHAR2()
});
$sth->execute;
# Retrieve dependencies.
my $depcol = sprintf $self->_listagg_format, 'dependency';
my ($req, $conf) = $dbh->selectrow_array(qq{
SELECT (
SELECT $depcol
FROM dependencies
WHERE change_id = ?
AND type = 'require'
),
(
SELECT $depcol
FROM dependencies
WHERE change_id = ?
AND type = 'conflict'
) FROM dual
}, undef, $cid, $cid);
# Delete the change record.
$dbh->do(
'DELETE FROM changes where change_id = ?',
undef, $change->id,
);
# Log it.
return $self->_log_event( revert => $change, $del_tags, $req, $conf );
}
sub _no_table_error {
return $DBI::err && $DBI::err == 942; # ORA-00942: table or view does not exist
}
sub _no_column_error {
return $DBI::err && $DBI::err == 904; # ORA-00904: invalid identifier
}
sub _script {
my $self = shift;
my $uri = $self->uri;
my $conn = '';
my ($user, $pass, $host, $port) = (
$self->username, $self->password, $uri->host, $uri->_port
);
if ($user || $pass || $host || $port) {
$conn = $user // '';
if ($pass) {
$pass =~ s/"/""/g;
$conn .= qq{/"$pass"};
}
if (my $db = $uri->dbname) {
$conn .= '@';
$db =~ s/"/""/g;
if ($host || $port) {
$conn .= '//' . ($host || '');
if ($port) {
$conn .= ":$port";
}
$conn .= qq{/"$db"};
} else {
$conn .= qq{"$db"};
}
}
} else {
# OS authentication or Oracle wallet (no username or password).
if (my $db = $uri->dbname) {
$db =~ s/"/""/g;
$conn = qq{/@"$db"};
}
}
my %vars = $self->variables;
return join "\n" => (
'SET ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON TAB OFF',
'WHENEVER OSERROR EXIT 9;',
'WHENEVER SQLERROR EXIT SQL.SQLCODE;',
(map {; (my $v = $vars{$_}) =~ s/"/""/g; qq{DEFINE $_="$v"} } sort keys %vars),
"connect $conn",
$self->_registry_variable,
@_
);
}
sub _run {
my $self = shift;
my $script = $self->_script(@_);
open my $fh, '<:utf8_strict', \$script;
return $self->sqitch->spool( $fh, $self->sqlplus );
}
sub _capture {
my $self = shift;
my $conn = $self->_script(@_);
my @out;
require IPC::Run3;
IPC::Run3::run3(
[$self->sqlplus], \$conn, \@out, \@out,
{ return_if_system_error => 1 },
);
if (my $err = $?) {
# Ugh, send everything to STDERR.
$self->sqitch->vent(@out);
hurl io => __x(
'{command} unexpectedly returned exit value {exitval}',
command => $self->client,
exitval => ($err >> 8),
);
}
return wantarray ? @out : \@out;
}
1;
__END__
=head1 Name
App::Sqitch::Engine::oracle - Sqitch Oracle Engine
=head1 Synopsis
my $oracle = App::Sqitch::Engine->load( engine => 'oracle' );
=head1 Description
App::Sqitch::Engine::oracle provides the Oracle storage engine for Sqitch. It
supports Oracle 10g and higher.
=head1 Interface
=head2 Instance Methods
=head3 C<initialized>
$oracle->initialize unless $oracle->initialized;
Returns true if the database has been initialized for Sqitch, and false if it
has not.
=head3 C<initialize>
$oracle->initialize;
Initializes a database for Sqitch by installing the Sqitch registry schema.
=head3 C<sqlplus>
Returns a list containing the C<sqlplus> client and options to be passed to it.
Used internally when executing scripts.
=head1 Author
David E. Wheeler <david@justatheory.com>
=head1 License
Copyright (c) 2012-2018 iovation Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=cut
| 29.695078 | 227 | 0.529431 |
ed271a222a64c6f52f4982429819e192cc768de6 | 256 | al | Perl | Modules/System Test Libraries/Field Selection/Permissions/FieldSelectionRead.PermissionSet.al | skolbin-ssi/ALAppExtensions | 86cbe13e45b53d9a8db0921269e7468b08b7ca23 | [
"MIT"
]
| 10 | 2021-06-04T12:40:13.000Z | 2021-06-04T13:27:08.000Z | Modules/System Test Libraries/Field Selection/Permissions/FieldSelectionRead.PermissionSet.al | skolbin-ssi/ALAppExtensions | 86cbe13e45b53d9a8db0921269e7468b08b7ca23 | [
"MIT"
]
| null | null | null | Modules/System Test Libraries/Field Selection/Permissions/FieldSelectionRead.PermissionSet.al | skolbin-ssi/ALAppExtensions | 86cbe13e45b53d9a8db0921269e7468b08b7ca23 | [
"MIT"
]
| 1 | 2019-01-08T10:41:44.000Z | 2019-01-08T10:41:44.000Z | permissionset 135036 "Field Selection Read"
{
Assignable = true;
IncludedPermissionSets = "Field Selection - Read";
// Include Test Tables
Permissions = tabledata "Test Table A" = RIMD,
tabledata "Test Table B" = RIMD;
} | 25.6 | 54 | 0.644531 |
ed25e45c86f65752351a82439158d7175c9b7d3c | 567 | pl | Perl | external/win_perl/lib/unicore/lib/Jg/Ain.pl | phixion/l0phtcrack | 48ee2f711134e178dbedbd925640f6b3b663fbb5 | [
"Apache-2.0",
"MIT"
]
| 2 | 2021-10-20T00:25:39.000Z | 2021-11-08T12:52:42.000Z | external/win_perl/lib/unicore/lib/Jg/Ain.pl | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| null | null | null | external/win_perl/lib/unicore/lib/Jg/Ain.pl | Brute-f0rce/l0phtcrack | 25f681c07828e5e68e0dd788d84cc13c154aed3d | [
"Apache-2.0",
"MIT"
]
| 1 | 2022-03-14T06:41:16.000Z | 2022-03-14T06:41:16.000Z | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by ..\lib\unicore\mktables from the Unicode
# database, Version 9.0.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
return <<'END';
V10
1593
1595
1696
1697
1788
1789
1885
1888
2227
2228
END
| 22.68 | 78 | 0.661376 |
73ded4b50c445d5a75e74bdcc468cb11b3a090eb | 968 | t | Perl | db-4.8.30.NC/perl/BerkeleyDB/t/db-4.x.t | xnz-coin/xnz-core | b3ab708e8e91496ee98c9e4c9201bcd6a605c119 | [
"MIT"
]
| 76 | 2018-01-26T12:44:41.000Z | 2019-03-20T06:04:55.000Z | db-4.8.30.NC/perl/BerkeleyDB/t/db-4.x.t | xnz-coin/xnz-core | b3ab708e8e91496ee98c9e4c9201bcd6a605c119 | [
"MIT"
]
| 12 | 2018-06-01T12:29:51.000Z | 2021-12-11T06:58:01.000Z | db-4.8.30.NC/perl/BerkeleyDB/t/db-4.x.t | xnz-coin/xnz-core | b3ab708e8e91496ee98c9e4c9201bcd6a605c119 | [
"MIT"
]
| 26 | 2017-06-06T05:20:40.000Z | 2020-01-18T01:17:35.000Z | #!./perl -w
use strict ;
use lib 't';
use BerkeleyDB;
use Test::More;
use util ;
plan(skip_all => "this needs Berkeley DB 4.x.x or better\n" )
if $BerkeleyDB::db_version < 4;
plan tests => 9;
my $Dfile = "dbhash.tmp";
unlink $Dfile;
umask(0) ;
my $db = BerkeleyDB::Btree->new(
-Filename => $Dfile,
-Flags => DB_CREATE,
-Property => DB_DUP | DB_DUPSORT
) || die "Cannot open file $Dfile: $! $BerkeleyDB::Error\n" ;
my $cursor = $db->db_cursor();
my @pairs = qw(
Alabama/Athens
Alabama/Florence
Alaska/Anchorage
Alaska/Fairbanks
Arizona/Avondale
Arizona/Florence
);
for (@pairs) {
$db->db_put(split '/');
}
my @tests = (
["Alaska", "Fa", "Alaska", "Fairbanks"],
["Arizona", "Fl", "Arizona", "Florence"],
["Alaska", "An", "Alaska", "Anchorage"],
);
#my $i;
while (my $test = shift @tests) {
my ($k1, $v1, $k2, $v2) = @$test;
ok $cursor->c_get($k1, $v1, DB_GET_BOTH_RANGE) == 0;
is $k1, $k2;
is $v1, $v2;
}
undef $db;
unlink $Dfile;
| 16.982456 | 61 | 0.608471 |
ed0c55fdad08e9a0593607a1f122ac23182c9da9 | 3,716 | pm | Perl | src/cli.pm | UIM-Community/DecoCLI | b5988b85ca858bb9b3988e6e64604fb5c501df77 | [
"MIT"
]
| null | null | null | src/cli.pm | UIM-Community/DecoCLI | b5988b85ca858bb9b3988e6e64604fb5c501df77 | [
"MIT"
]
| null | null | null | src/cli.pm | UIM-Community/DecoCLI | b5988b85ca858bb9b3988e6e64604fb5c501df77 | [
"MIT"
]
| null | null | null | package src::cli;
# use perl5 core dependencies
use strict;
use Data::Dumper;
use Scalar::Util qw(looks_like_number);
# use internal dependencies
use src::utils qw(scriptArgsAsHash checkDefined);
#
# DESC: Commande Line interface manager
#
sub new {
my ($class, $optionsHashRef) = @_;
return bless({
usage => $optionsHashRef->{usage} || "",
description => $optionsHashRef->{description} || "",
version => $optionsHashRef->{version} || "1.0.0",
commands => {}
}, ref($class) || $class);
}
#
# DESC: Setup a new command
#
sub setCommand {
my ($self, $command, $optionsHashRef) = @_;
$self->{"commands"}->{$command} = $optionsHashRef;
}
#
# DESC: Initialize the CLI class with default ARGV entry
#
sub init {
my ($self) = @_;
my $script_arguments = scriptArgsAsHash({});
my $ret = {};
#
# DESC: Script start arguments contains --h and/or --help
#
if (defined $script_arguments->{h} || defined $script_arguments->{help}) {
print STDOUT "\nUsage: $self->{usage}\n\n";
print STDOUT "$self->{description}\n\n";
print STDOUT "Options:\n";
print STDOUT "\t[--help] or [--h] Output usage and all available options with description\n";
print STDOUT "\t[--version] or [--v] Ouput the CLI version\n";
foreach my $command (keys %{ $self->{commands} }) {
my $description = $self->{commands}->{$command}->{description} || "";
my $required = $self->{commands}->{$command}->{required} ? "Mandatory" : "Optional";
my $defaultValue = defined($self->{commands}->{$command}->{defaultValue}) ? $self->{commands}->{$command}->{defaultValue} : "none";
print STDOUT "\t[--${command}] $description ($required) (default: $defaultValue)\n";
}
print STDOUT "\n";
# Help will automatically exit the script
exit 0;
}
#
# DESC: Script start arguments contains --v and/or --version
#
if (defined $script_arguments->{v} || defined $script_arguments->{version}) {
print STDOUT "Version ".$self->{version}."\n\n";
# Output script version will automatically exit the script
exit 0;
}
foreach my $commandName (keys %{ $self->{commands} }) {
my $cmd = $self->{commands}->{$commandName};
my $required = defined($cmd->{required}) ? $cmd->{required} : 0;
my $expect = ref($cmd->{expect}) eq "ARRAY" ? $cmd->{expect} : undef;
my $defaultValue;
if (defined($cmd->{defaultValue})) {
$defaultValue = $cmd->{defaultValue};
$required = 0;
}
my $finalValue;
my $keyFound = defined($script_arguments->{$commandName});
if ($keyFound == 0 && $required == 1) {
die "Command line option --$commandName is required !!! Trigger --help for more information on how to use CLI options.\n";
}
elsif ($keyFound == 0 && defined($defaultValue)) {
$finalValue = $defaultValue;
}
if($keyFound == 1) {
$finalValue = $script_arguments->{$commandName};
if (defined($cmd->{match})) {
unless($finalValue =~ $cmd->{match}) {
die "Command line option --$commandName value doesn't match expected Regexp Expression\n";
}
}
}
if (defined($expect)) {
my %params = map { $_ => 1 } @{ $expect };
if (not exists($params{$finalValue})) {
die "Command line option --$commandName value doesn't match expected values: @{$expect}\n";
}
}
$ret->{$commandName} = $finalValue;
}
return $ret;
}
1; | 33.178571 | 143 | 0.561087 |
ed1b567bda7a8a9838258ff7ce07dd7ca7bd2d2c | 1,950 | t | Perl | sas/modules/sources/libwww-perl-5.834/t/base/message-charset.t | Edith1715/GO-FEAT-fast-functional-annotation-web-tool | 2168c317304f3d1dd6c77730305e311e5746f795 | [
"MIT"
]
| 16 | 2017-12-12T20:33:51.000Z | 2022-02-03T17:19:20.000Z | sas/modules/sources/libwww-perl-5.834/t/base/message-charset.t | Edith1715/GO-FEAT-fast-functional-annotation-web-tool | 2168c317304f3d1dd6c77730305e311e5746f795 | [
"MIT"
]
| 4 | 2018-11-22T08:06:22.000Z | 2019-11-08T04:03:09.000Z | sas/modules/sources/libwww-perl-5.834/t/base/message-charset.t | Edith1715/GO-FEAT-fast-functional-annotation-web-tool | 2168c317304f3d1dd6c77730305e311e5746f795 | [
"MIT"
]
| 6 | 2018-01-30T01:10:21.000Z | 2019-10-19T01:02:29.000Z | #!perl -w
use strict;
BEGIN {
eval {
require Encode;
Encode::find_encoding("UTF-16-BE") || die "Need a version of Encode that supports UTF-16-BE";
};
if ($@) {
print "1..0 # Skipped: Encode not available\n";
print $@;
exit;
}
}
use Test;
plan tests => 21;
use HTTP::Response;
my $r = HTTP::Response->new(200, "OK");
ok($r->content_charset, undef);
ok($r->content_type_charset, undef);
$r->content_type("text/plain");
ok($r->content_charset, undef);
$r->content("abc");
ok($r->content_charset, "US-ASCII");
$r->content("f\xE5rep\xF8lse\n");
ok($r->content_charset, "ISO-8859-1");
$r->content("f\xC3\xA5rep\xC3\xB8lse\n");
ok($r->content_charset, "UTF-8");
$r->content_type("text/html");
$r->content(<<'EOT');
<meta charset="UTF-8">
EOT
ok($r->content_charset, "UTF-8");
$r->content(<<'EOT');
<body>
<META CharSet="Utf-16-LE">
<meta charset="ISO-8859-1">
EOT
ok($r->content_charset, "UTF-8");
$r->content(<<'EOT');
<!-- <meta charset="UTF-8">
EOT
ok($r->content_charset, "US-ASCII");
$r->content(<<'EOT');
<meta content="text/plain; charset=UTF-8">
EOT
ok($r->content_charset, "UTF-8");
$r->content_type('text/plain; charset="iso-8859-1"');
ok($r->content_charset, "ISO-8859-1");
ok($r->content_type_charset, "ISO-8859-1");
$r->content_type("application/xml");
$r->content("<foo>..</foo>");
ok($r->content_charset, "UTF-8");
require Encode;
for my $enc ("UTF-16-BE", "UTF-16-LE", "UTF-32-BE", "UTF-32-LE") {
$r->content(Encode::encode($enc, "<foo>..</foo>"));
ok($r->content_charset, $enc);
}
$r->content(<<'EOT');
<?xml version="1.0" encoding="utf8" ?>
EOT
ok($r->content_charset, "utf8");
$r->content(<<'EOT');
<?xml version="1.0" encoding=" "?>
EOT
ok($r->content_charset, "UTF-8");
$r->content(<<'EOT');
<?xml version="1.0" encoding=" ISO-8859-1 "?>
EOT
ok($r->content_charset, "ISO-8859-1");
$r->content(<<'EOT');
<?xml version="1.0"
encoding="US-ASCII" ?>
EOT
ok($r->content_charset, "US-ASCII");
| 20.744681 | 94 | 0.620513 |
ed262c4e9ab13893452648e3ff56ee728f89f88c | 530 | t | Perl | t/05-connect.t | nlewis/Net-ILO | c670a0300524039f12097a3c37fda439a9259b9a | [
"Artistic-1.0-cl8"
]
| 1 | 2017-12-04T11:35:09.000Z | 2017-12-04T11:35:09.000Z | t/05-connect.t | AHinMaine/Net-ILO | e81e03149f29e9c26b7de8dac8c138d6892af4fc | [
"Artistic-1.0-cl8"
]
| null | null | null | t/05-connect.t | AHinMaine/Net-ILO | e81e03149f29e9c26b7de8dac8c138d6892af4fc | [
"Artistic-1.0-cl8"
]
| 3 | 2015-03-31T17:55:19.000Z | 2015-11-17T23:54:39.000Z | #!perl
use strict;
use Net::ILO;
use Test::More tests => 2;
# TODO: mock IO::Socket::SSL object for better testing
my $ilo = Net::ILO->new();
my $connection;
eval { $connection = $ilo->_connect; };
ok( $@ =~ "Can't connect: address not set", 'Connecting without address throws exception' );
$ilo->{_client} = 'Fake connection';
$connection = $ilo->_connect;
ok( $connection eq 'Fake connection', '_connect returns cached connection' );
# so DESTROY doesn't try to disconnect during cleanup
undef $ilo->{_client};
| 20.384615 | 92 | 0.675472 |
73ec21439515b027401a0a4a6d6ae78ec97a8760 | 1,960 | t | Perl | t/from-hash.t | gitpan/CPAN-Meta-Requirements | 855bce3e3df856f2a805c207d63dba938d3e8da3 | [
"Artistic-1.0"
]
| null | null | null | t/from-hash.t | gitpan/CPAN-Meta-Requirements | 855bce3e3df856f2a805c207d63dba938d3e8da3 | [
"Artistic-1.0"
]
| null | null | null | t/from-hash.t | gitpan/CPAN-Meta-Requirements | 855bce3e3df856f2a805c207d63dba938d3e8da3 | [
"Artistic-1.0"
]
| null | null | null | use strict;
use warnings;
use CPAN::Meta::Requirements;
use Test::More 0.88;
sub dies_ok (&@) {
my ($code, $qr, $comment) = @_;
my $lived = eval { $code->(); 1 };
if ($lived) {
fail("$comment: did not die");
} else {
like($@, $qr, $comment);
}
}
{
my $string_hash = {
Left => 10,
Shared => '>= 2, <= 9, != 7',
Right => 18,
};
my $req = CPAN::Meta::Requirements->from_string_hash($string_hash);
is_deeply(
$req->as_string_hash,
$string_hash,
"we can load from a string hash",
);
}
{
my $string_hash = {
Left => 10,
Shared => '= 2',
Right => 18,
};
dies_ok { CPAN::Meta::Requirements->from_string_hash($string_hash) }
qr/Can't convert/,
"we die when we can't understand a version spec";
}
{
my $undef_hash = { Undef => undef };
my $z_hash = { ZeroLength => '' };
my $warning;
local $SIG{__WARN__} = sub { $warning = join("\n",@_) };
my $req = CPAN::Meta::Requirements->from_string_hash($undef_hash);
like ($warning, qr/Undefined requirement.*treated as '0'/, "undef requirement warns");
$req->add_string_requirement(%$z_hash);
like ($warning, qr/Undefined requirement.*treated as '0'/, "'' requirement warns");
is_deeply(
$req->as_string_hash,
{ map { ($_ => 0) } keys(%$undef_hash), keys(%$z_hash) },
"undef/'' requirements treated as '0'",
);
}
{
my $string_hash = {
Left => 10,
Shared => v50.44.60,
Right => 18,
};
my $warning;
local $SIG{__WARN__} = sub { $warning = join("\n",@_) };
my $req = CPAN::Meta::Requirements->from_string_hash($string_hash);
ok(
$req->accepts_module(Shared => 'v50.44.60'),
"vstring treated as if string",
);
}
{
my $req = CPAN::Meta::Requirements->from_string_hash(
{ Bad => 'invalid', },
{ bad_version_hook => sub { version->new(42) } },
);
ok(
$req->accepts_module(Bad => 42),
"options work 2nd arg to f_s_h",
);
}
done_testing;
| 19.79798 | 88 | 0.57449 |
ed1f451df1a32d29decb7e1f1de5cfc561dc8a6d | 1,342 | pm | Perl | auto-lib/Azure/CustomerInsights/EnrichingKpi.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/CustomerInsights/EnrichingKpi.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/CustomerInsights/EnrichingKpi.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| 1 | 2021-04-08T15:26:39.000Z | 2021-04-08T15:26:39.000Z | package Azure::CustomerInsights::EnrichingKpi;
use Moose;
has 'aliases' => (is => 'ro', isa => 'ArrayRef[Azure::CustomerInsights::KpiAlias]' );
has 'calculationWindow' => (is => 'ro', isa => 'Str' );
has 'calculationWindowFieldName' => (is => 'ro', isa => 'Str' );
has 'description' => (is => 'ro', isa => 'HashRef[Str]' );
has 'displayName' => (is => 'ro', isa => 'HashRef[Str]' );
has 'entityType' => (is => 'ro', isa => 'Str' );
has 'entityTypeName' => (is => 'ro', isa => 'Str' );
has 'expression' => (is => 'ro', isa => 'Str' );
has 'extracts' => (is => 'ro', isa => 'ArrayRef[Azure::CustomerInsights::KpiExtract]' );
has 'filter' => (is => 'ro', isa => 'Str' );
has 'function' => (is => 'ro', isa => 'Str' );
has 'groupBy' => (is => 'ro', isa => 'ArrayRef[Str]' );
has 'groupByMetadata' => (is => 'ro', isa => 'ArrayRef[Azure::CustomerInsights::KpiGroupByMetadata]' );
has 'kpiName' => (is => 'ro', isa => 'Str' );
has 'participantProfilesMetadata' => (is => 'ro', isa => 'ArrayRef[Azure::CustomerInsights::KpiParticipantProfilesMetadata]' );
has 'provisioningState' => (is => 'ro', isa => 'Str' );
has 'tenantId' => (is => 'ro', isa => 'Str' );
has 'thresHolds' => (is => 'ro', isa => 'Azure::CustomerInsights::KpiThresholds' );
has 'unit' => (is => 'ro', isa => 'Str' );
1;
| 55.916667 | 130 | 0.552906 |
73d7a5a798ebdff46bc54d6199074492a84faf5a | 46,442 | pl | Perl | samples/broken/peirera.pl | HappyFacade/trealla | 768d15b090c96e659dbfe0617b23483b36e3a2eb | [
"MIT"
]
| null | null | null | samples/broken/peirera.pl | HappyFacade/trealla | 768d15b090c96e659dbfe0617b23483b36e3a2eb | [
"MIT"
]
| null | null | null | samples/broken/peirera.pl | HappyFacade/trealla | 768d15b090c96e659dbfe0617b23483b36e3a2eb | [
"MIT"
]
| null | null | null | :- module(bench_peirera,
[ bench_peirera/0,
bench_peirera/1, % SpeedupOrName
list_bench_results/2 % +File, +Id
]).
%:- meta_predicate do_n(+, 0, -).
%% bench_peirera is det.
%% bench_peirera(+SpeedupOrName) is det.
%
% =|?- bench_peirera|= is the same as =|?- bench_peirera(1)|=.
%
% @param SpeedupOrName If number, run all tests speedup by N; if
% atom, run named test at speddup 1.
bench_peirera :-
benches.
bench_peirera(SpeedupOrName) :-
( number(SpeedupOrName)
-> benches(SpeedupOrName)
; bench_mark(SpeedupOrName)
).
list_bench_results(File, Id) :-
open(File, write, Out),
( bench_result(Name, NetTime),
format(Out, 'bench_result(~q, ~q, ~q).~n', [Id, Name, NetTime]),
fail
; close(Out)
).
%% saved_iterations(+Benchmark, -Iterations)
%
% Iterations is the number of iterations to run Benchmark to get
% approximately 1 sec CPU time.
%
% To update, make it dynamic, delete all clauses and run the
% benchmark. Then list the clauses and insert them below.
%
% Last update: SWI-Prolog 5.6.59 (gcc: -O3; pl: -O) on AMD X2
% 5400+ (64-bits)
:- dynamic saved_iterations/2.
saved_iterations(tail_call_atom_atom, 145946).
saved_iterations(binary_call_atom_atom, 94737).
saved_iterations(cons_list, 91525).
saved_iterations(walk_list, 122727).
saved_iterations(walk_list_rec, 125581).
saved_iterations(args(1), 120000).
saved_iterations(args(2), 81818).
saved_iterations(args(4), 54545).
saved_iterations(args(8), 33333).
saved_iterations(args(16), 19355).
saved_iterations(cons_term, 84375).
saved_iterations(walk_term, 110204).
saved_iterations(walk_term_rec, 122727).
saved_iterations(shallow_backtracking, 415385).
saved_iterations(deep_backtracking, 59341).
saved_iterations(choice_point, 94737).
saved_iterations(trail_variables, 87097).
saved_iterations(medium_unify, 771429).
saved_iterations(deep_unify, 235161).
saved_iterations(integer_add, 49091).
saved_iterations(floating_add, 40909).
saved_iterations(arg(1), 40000).
saved_iterations(arg(2), 40909).
saved_iterations(arg(4), 37500).
saved_iterations(arg(8), 38217).
saved_iterations(arg(16), 38298).
saved_iterations(index, 100000).
saved_iterations(assert_unit, 1525).
saved_iterations(access_unit, 26471).
saved_iterations(slow_access_unit, 1607).
saved_iterations(setof, 7692).
saved_iterations(pair_setof, 6522).
saved_iterations(double_setof, 1837).
saved_iterations(bagof, 10112).
/*
Pereira`s Benchmarks
==================
I've received several requests for the benchmarks that were used in
the June issue of AI Expert. The purpose of these benchmarks is to try
to identify strengths and weaknesses in the basic engine of a Prolog
system. In particular, I try to separate costs normaly conflated in
other benchmark suites, such as procedure call cost, term matching and
term construction costs and the costs of tail calls vs. nontail calls.
I'm sure the benchmarks could be improved, but I don't have time to
work on them right now. Also, I must say that I have relatively little
faith on small benchmark programs. I find that performance (both time
and space) on substantial programs, reliability, adherence to de facto
standards and ease of use are far more important in practice. I've
tried several Prolog systems that performed very well on small
benchmarks (including mine), but that failed badly on one or more of
these criteria.
Some of the benchmarks are inspired on a benchmark suite developed at
ICOT for their SIM project, and other benchmark choices were
influenced by discussions with ICOT researchers on the relative
performance of SIM-I vs. Prolog-20.
-- Fernando Pereira
*/
% SWI-Prolog hooks:
%:- op(1150, fx, [public, mode]).
%public(_).
%mode(_).
:- discontiguous(bench_mark/4).
:- discontiguous(xbench_mark/4).
% File #1, driver.pl:
% File : driver.pl
% Author : Richard O'Keefe based on earlier versions due to
% Paul Wilk, Fernando Pereira, David Warren et al.
% Updated: 29 December 1986
% Defines: from/3 and get_cpu_time/1.
% Version: Dec-10 Prolog & Quintus Prolog.
%:- public
% from/3,
% get_cpu_time/1.
%
%:- mode
% from(+, +, -),
% get_cpu_time(-).
%% from(LowerBound, UpperBound, I)
% binds I to successive integers in the range LowerBound..UpperBound.
% It is designed solely for use in this application; for a general
% way of doing this use the standard library predicate between/3, or
% perhaps repeat/1.
from(I, I, I) :- !.
from(L, U, I) :- M is (L+U) >> 1, from(L, M, I).
from(L, U, I) :- M is (L+U) >> 1 + 1, from(M, U, I).
%% get_cpu_time(T)
% unifies T with the run time since start-up in milliseconds.
% (We can't use the second element of the list, as some of the
% tests will call statistics/2 and reset it.)
get_cpu_time(T) :-
statistics(runtime, [T|_]).
%% bench_time(-Time)
%
% Time to spend on each benchmark.
bench_time(1).
%% bench_mark(Name, Speedup)
% is the new top level. It calls bench_mark/4 to find out
% how many Iterations of the Action and its Control to perform.
% To get the old effect, do something like
% bench_mark(nrev, 50, nrev(L), dummy(L)) :- data(L).
:- dynamic bench_result/2.
bench_mark(Name) :-
bench_mark(Name, 1).
bench_mark(Name, Speedup) :-
bench_mark(Name, NetTime, Speedup),
assert(bench_result(Name, NetTime)).
bench_mark(Name, NetTime, Speedup) :-
bench_mark(Name, I0, Action, Control),
iterations(I0, Name, Action, Control, Iterations0),
Iterations is round(Iterations0/Speedup),
do_n(Iterations, Action, TestTime),
do_n(Iterations, Control, OverHead),
NetTime is TestTime-OverHead,
Average is 1000000*NetTime/Iterations,
format('~w~t~22| took ~2f-~2f=~2f/~d = ~t~1f~60| usec/iter.~n',
[Name, TestTime, OverHead, NetTime, Iterations, Average]).
% iterations(+I0, +Name, +Action, -Iterations)
%
% Learn how many iterations we need for about 1 second CPU time.
iterations(_, Name, _, _, I) :-
saved_iterations(Name, I), !.
iterations(I0, Name, Action, Control, I) :-
do_n(I0, Action, TestTime),
TestTime < 0.33, !,
I1 is I0*3,
iterations(I1, Name, Action, Control, I).
iterations(I0, _Name, Action, Control, I) :-
do_n(I0, Action, TestTime),
do_n(I0, Control, OverHead),
bench_time(Target),
I is round(I0*(Target/(TestTime-OverHead))),
true.
do_n(N, Goal, Time) :-
get_cpu_time(T0),
( between(1,N,_),
call(Goal),
fail
; get_cpu_time(T1),
Time is (T1 - T0)/1000
).
% File #2, benches.pl
% File : benches.pl
% Author : Fernando Pereira
% Updated: 29 December 1986
% Defines: benches/0, bench_mark/1
% Purpose:
% Here are all the benchmarks. Some are based on the ICOT benchmark set
% (version of January 24, 1985), others are different. All the benchmarks
% attempt to measure just one thing, eg. determinate procedure call, list
% construction, list destruction.
% To run the whole set, call 'benches'.
% Do all the benchmarks
% :- public benches/0, bench_mark/1.
:- dynamic total_time/1.
benches :-
benches(1).
benches(Speedup) :-
retractall(bench_result(_,_)),
( bench_mark(Name, _, _, _),
bench_mark(Name, Speedup),
fail
; findall(T, bench_result(_, T), TList),
length(TList, Len),
sumlist(TList, Sum),
format('~w benchmarks took ~w seconds~n', [Len, Sum])
).
sumlist([], 0).
sumlist([H|T], Sum) :-
sumlist(T, Sum0),
Sum is Sum0 + H.
% Trivial predicates for use in controls.
% :- public dummy/0, dummy/1, dummy/2, dummy/3.
dummy.
dummy(_).
dummy(_, _).
dummy(_, _, _).
% The actual benchamarks
% 1. 100 determinate tail calls
bench_mark(tail_call_atom_atom, 2000, p1(a), dummy(a)).
% :- public p1/1.
p1(a) :- p2(a).
p2(a) :- p3(a).
p3(a) :- p4(a).
p4(a) :- p5(a).
p5(a) :- p6(a).
p6(a) :- p7(a).
p7(a) :- p8(a).
p8(a) :- p9(a).
p9(a) :- p10(a).
p10(a) :- p11(a).
p11(a) :- p12(a).
p12(a) :- p13(a).
p13(a) :- p14(a).
p14(a) :- p15(a).
p15(a) :- p16(a).
p16(a) :- p17(a).
p17(a) :- p18(a).
p18(a) :- p19(a).
p19(a) :- p20(a).
p20(a) :- p21(a).
p21(a) :- p22(a).
p22(a) :- p23(a).
p23(a) :- p24(a).
p24(a) :- p25(a).
p25(a) :- p26(a).
p26(a) :- p27(a).
p27(a) :- p28(a).
p28(a) :- p29(a).
p29(a) :- p30(a).
p30(a) :- p31(a).
p31(a) :- p32(a).
p32(a) :- p33(a).
p33(a) :- p34(a).
p34(a) :- p35(a).
p35(a) :- p36(a).
p36(a) :- p37(a).
p37(a) :- p38(a).
p38(a) :- p39(a).
p39(a) :- p40(a).
p40(a) :- p41(a).
p41(a) :- p42(a).
p42(a) :- p43(a).
p43(a) :- p44(a).
p44(a) :- p45(a).
p45(a) :- p46(a).
p46(a) :- p47(a).
p47(a) :- p48(a).
p48(a) :- p49(a).
p49(a) :- p50(a).
p50(a) :- p51(a).
p51(a) :- p52(a).
p52(a) :- p53(a).
p53(a) :- p54(a).
p54(a) :- p55(a).
p55(a) :- p56(a).
p56(a) :- p57(a).
p57(a) :- p58(a).
p58(a) :- p59(a).
p59(a) :- p60(a).
p60(a) :- p61(a).
p61(a) :- p62(a).
p62(a) :- p63(a).
p63(a) :- p64(a).
p64(a) :- p65(a).
p65(a) :- p66(a).
p66(a) :- p67(a).
p67(a) :- p68(a).
p68(a) :- p69(a).
p69(a) :- p70(a).
p70(a) :- p71(a).
p71(a) :- p72(a).
p72(a) :- p73(a).
p73(a) :- p74(a).
p74(a) :- p75(a).
p75(a) :- p76(a).
p76(a) :- p77(a).
p77(a) :- p78(a).
p78(a) :- p79(a).
p79(a) :- p80(a).
p80(a) :- p81(a).
p81(a) :- p82(a).
p82(a) :- p83(a).
p83(a) :- p84(a).
p84(a) :- p85(a).
p85(a) :- p86(a).
p86(a) :- p87(a).
p87(a) :- p88(a).
p88(a) :- p89(a).
p89(a) :- p90(a).
p90(a) :- p91(a).
p91(a) :- p92(a).
p92(a) :- p93(a).
p93(a) :- p94(a).
p94(a) :- p95(a).
p95(a) :- p96(a).
p96(a) :- p97(a).
p97(a) :- p98(a).
p98(a) :- p99(a).
p99(a) :- p100(a).
p100(a).
% 2. 63 determinate nontail calls, 64 determinate tail calls.
bench_mark(binary_call_atom_atom, 2000, q1(a), dummy(a)).
% :- public q1/1.
q1(a) :- q2(a), q3(a).
q2(a) :- q4(a), q5(a).
q3(a) :- q6(a), q7(a).
q4(a) :- q8(a), q9(a).
q5(a) :- q10(a), q11(a).
q6(a) :- q12(a), q13(a).
q7(a) :- q14(a), q15(a).
q8(a) :- q16(a), q17(a).
q9(a) :- q18(a), q19(a).
q10(a) :- q20(a), q21(a).
q11(a) :- q22(a), q23(a).
q12(a) :- q24(a), q25(a).
q13(a) :- q26(a), q27(a).
q14(a) :- q28(a), q29(a).
q15(a) :- q30(a), q31(a).
q16(a) :- q32(a), q33(a).
q17(a) :- q34(a), q35(a).
q18(a) :- q36(a), q37(a).
q19(a) :- q38(a), q39(a).
q20(a) :- q40(a), q41(a).
q21(a) :- q42(a), q43(a).
q22(a) :- q44(a), q45(a).
q23(a) :- q46(a), q47(a).
q24(a) :- q48(a), q49(a).
q25(a) :- q50(a), q51(a).
q26(a) :- q52(a), q53(a).
q27(a) :- q54(a), q55(a).
q28(a) :- q56(a), q57(a).
q29(a) :- q58(a), q59(a).
q30(a) :- q60(a), q61(a).
q31(a) :- q62(a), q63(a).
q32(a) :- q64(a), q65(a).
q33(a) :- q66(a), q67(a).
q34(a) :- q68(a), q69(a).
q35(a) :- q70(a), q71(a).
q36(a) :- q72(a), q73(a).
q37(a) :- q74(a), q75(a).
q38(a) :- q76(a), q77(a).
q39(a) :- q78(a), q79(a).
q40(a) :- q80(a), q81(a).
q41(a) :- q82(a), q83(a).
q42(a) :- q84(a), q85(a).
q43(a) :- q86(a), q87(a).
q44(a) :- q88(a), q89(a).
q45(a) :- q90(a), q91(a).
q46(a) :- q92(a), q93(a).
q47(a) :- q94(a), q95(a).
q48(a) :- q96(a), q97(a).
q49(a) :- q98(a), q99(a).
q50(a) :- q100(a), q101(a).
q51(a) :- q102(a), q103(a).
q52(a) :- q104(a), q105(a).
q53(a) :- q106(a), q107(a).
q54(a) :- q108(a), q109(a).
q55(a) :- q110(a), q111(a).
q56(a) :- q112(a), q113(a).
q57(a) :- q114(a), q115(a).
q58(a) :- q116(a), q117(a).
q59(a) :- q118(a), q119(a).
q60(a) :- q120(a), q121(a).
q61(a) :- q122(a), q123(a).
q62(a) :- q124(a), q125(a).
q63(a) :- q126(a), q127(a).
q64(a).
q65(a).
q66(a).
q67(a).
q68(a).
q69(a).
q70(a).
q71(a).
q72(a).
q73(a).
q74(a).
q75(a).
q76(a).
q77(a).
q78(a).
q79(a).
q80(a).
q81(a).
q82(a).
q83(a).
q84(a).
q85(a).
q86(a).
q87(a).
q88(a).
q89(a).
q90(a).
q91(a).
q92(a).
q93(a).
q94(a).
q95(a).
q96(a).
q97(a).
q98(a).
q99(a).
q100(a).
q101(a).
q102(a).
q103(a).
q104(a).
q105(a).
q106(a).
q107(a).
q108(a).
q109(a).
q110(a).
q111(a).
q112(a).
q113(a).
q114(a).
q115(a).
q116(a).
q117(a).
q118(a).
q119(a).
q120(a).
q121(a).
q122(a).
q123(a).
q124(a).
q125(a).
q126(a).
q127(a).
% 3. Construct one 100 element list, nonrecursively.
bench_mark(cons_list, 2000, r1(L), dummy(L)).
% :- public r1/1.
% 4. Walk down a 100 element list, nonrecursively
bench_mark(walk_list, 2000, r1(L), dummy(L)) :- r1(L).
% 5. Walk down a 100 element list, recursively
bench_mark(walk_list_rec, 2000, wlr(L), dummy(L)) :- r1(L).
% :- public wlr/1.
% 6. Walk down N 100 copies of the same 100 element list, recursively.
bench_mark(args(N), 2000, args(N, L), dummy(N, L)) :- args(N), r1(L).
% :- public args/2.
args(1). args(2). args(4). args(8). args(16).
args(1, L) :- wlr(L).
args(2, L) :- wlr(L, L).
args(4, L) :- wlr(L, L, L, L).
args(8, L) :- wlr(L, L, L, L, L, L, L, L).
args(16, L) :- wlr(L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L).
wlr([]).
wlr([_|L]) :- wlr(L).
wlr([], []).
wlr([_|L1], [_|L2]) :- wlr(L1, L2).
wlr([], [], [], []).
wlr([_|L1], [_|L2], [_|L3], [_|L4]) :- wlr(L1, L2, L3, L4).
wlr([], [], [], [], [], [], [], []).
wlr([_|L1], [_|L2], [_|L3], [_|L4], [_|L5], [_|L6], [_|L7], [_|L8]) :-
wlr(L1, L2, L3, L4, L5, L6, L7, L8).
wlr([], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []).
wlr([_|L1], [_|L2], [_|L3], [_|L4], [_|L5], [_|L6], [_|L7], [_|L8],
[_|L9], [_|L10], [_|L11], [_|L12], [_|L13], [_|L14], [_|L15], [_|L16]) :-
wlr(L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15, L16).
% Nonrecursive list cruncher
r1([1|R]) :- r2(R).
r2([2|R]) :- r3(R).
r3([3|R]) :- r4(R).
r4([4|R]) :- r5(R).
r5([5|R]) :- r6(R).
r6([6|R]) :- r7(R).
r7([7|R]) :- r8(R).
r8([8|R]) :- r9(R).
r9([9|R]) :- r10(R).
r10([10|R]) :- r11(R).
r11([11|R]) :- r12(R).
r12([12|R]) :- r13(R).
r13([13|R]) :- r14(R).
r14([14|R]) :- r15(R).
r15([15|R]) :- r16(R).
r16([16|R]) :- r17(R).
r17([17|R]) :- r18(R).
r18([18|R]) :- r19(R).
r19([19|R]) :- r20(R).
r20([20|R]) :- r21(R).
r21([21|R]) :- r22(R).
r22([22|R]) :- r23(R).
r23([23|R]) :- r24(R).
r24([24|R]) :- r25(R).
r25([25|R]) :- r26(R).
r26([26|R]) :- r27(R).
r27([27|R]) :- r28(R).
r28([28|R]) :- r29(R).
r29([29|R]) :- r30(R).
r30([30|R]) :- r31(R).
r31([31|R]) :- r32(R).
r32([32|R]) :- r33(R).
r33([33|R]) :- r34(R).
r34([34|R]) :- r35(R).
r35([35|R]) :- r36(R).
r36([36|R]) :- r37(R).
r37([37|R]) :- r38(R).
r38([38|R]) :- r39(R).
r39([39|R]) :- r40(R).
r40([40|R]) :- r41(R).
r41([41|R]) :- r42(R).
r42([42|R]) :- r43(R).
r43([43|R]) :- r44(R).
r44([44|R]) :- r45(R).
r45([45|R]) :- r46(R).
r46([46|R]) :- r47(R).
r47([47|R]) :- r48(R).
r48([48|R]) :- r49(R).
r49([49|R]) :- r50(R).
r50([50|R]) :- r51(R).
r51([51|R]) :- r52(R).
r52([52|R]) :- r53(R).
r53([53|R]) :- r54(R).
r54([54|R]) :- r55(R).
r55([55|R]) :- r56(R).
r56([56|R]) :- r57(R).
r57([57|R]) :- r58(R).
r58([58|R]) :- r59(R).
r59([59|R]) :- r60(R).
r60([60|R]) :- r61(R).
r61([61|R]) :- r62(R).
r62([62|R]) :- r63(R).
r63([63|R]) :- r64(R).
r64([64|R]) :- r65(R).
r65([65|R]) :- r66(R).
r66([66|R]) :- r67(R).
r67([67|R]) :- r68(R).
r68([68|R]) :- r69(R).
r69([69|R]) :- r70(R).
r70([70|R]) :- r71(R).
r71([71|R]) :- r72(R).
r72([72|R]) :- r73(R).
r73([73|R]) :- r74(R).
r74([74|R]) :- r75(R).
r75([75|R]) :- r76(R).
r76([76|R]) :- r77(R).
r77([77|R]) :- r78(R).
r78([78|R]) :- r79(R).
r79([79|R]) :- r80(R).
r80([80|R]) :- r81(R).
r81([81|R]) :- r82(R).
r82([82|R]) :- r83(R).
r83([83|R]) :- r84(R).
r84([84|R]) :- r85(R).
r85([85|R]) :- r86(R).
r86([86|R]) :- r87(R).
r87([87|R]) :- r88(R).
r88([88|R]) :- r89(R).
r89([89|R]) :- r90(R).
r90([90|R]) :- r91(R).
r91([91|R]) :- r92(R).
r92([92|R]) :- r93(R).
r93([93|R]) :- r94(R).
r94([94|R]) :- r95(R).
r95([95|R]) :- r96(R).
r96([96|R]) :- r97(R).
r97([97|R]) :- r98(R).
r98([98|R]) :- r99(R).
r99([99|R]) :- r100(R).
r100([100|R]) :- r101(R).
r101([]).
% 7. Construct a term with 100 nodes, nonrecursively
bench_mark(cons_term, 2000, s1(T), dummy(T)).
% :- public s1/1.
% 8. Walk down a term with 100 nodes, nonrecursively.
bench_mark(walk_term, 2000, s1(T), dummy(T)) :- s1(T).
% 9. Walk down a term with 100 nodes, recursively.
bench_mark(walk_term_rec, 2000, wtr(T), dummy(T)) :- s1(T).
% :- public wtr/1.
wtr(nil).
wtr(f(_,R)) :- wtr(R).
% Nonrecursive term cruncher
s1(f(1, R)) :- s2(R).
s2(f(2, R)) :- s3(R).
s3(f(3, R)) :- s4(R).
s4(f(4, R)) :- s5(R).
s5(f(5, R)) :- s6(R).
s6(f(6, R)) :- s7(R).
s7(f(7, R)) :- s8(R).
s8(f(8, R)) :- s9(R).
s9(f(9, R)) :- s10(R).
s10(f(10, R)) :- s11(R).
s11(f(11, R)) :- s12(R).
s12(f(12, R)) :- s13(R).
s13(f(13, R)) :- s14(R).
s14(f(14, R)) :- s15(R).
s15(f(15, R)) :- s16(R).
s16(f(16, R)) :- s17(R).
s17(f(17, R)) :- s18(R).
s18(f(18, R)) :- s19(R).
s19(f(19, R)) :- s20(R).
s20(f(20, R)) :- s21(R).
s21(f(21, R)) :- s22(R).
s22(f(22, R)) :- s23(R).
s23(f(23, R)) :- s24(R).
s24(f(24, R)) :- s25(R).
s25(f(25, R)) :- s26(R).
s26(f(26, R)) :- s27(R).
s27(f(27, R)) :- s28(R).
s28(f(28, R)) :- s29(R).
s29(f(29, R)) :- s30(R).
s30(f(30, R)) :- s31(R).
s31(f(31, R)) :- s32(R).
s32(f(32, R)) :- s33(R).
s33(f(33, R)) :- s34(R).
s34(f(34, R)) :- s35(R).
s35(f(35, R)) :- s36(R).
s36(f(36, R)) :- s37(R).
s37(f(37, R)) :- s38(R).
s38(f(38, R)) :- s39(R).
s39(f(39, R)) :- s40(R).
s40(f(40, R)) :- s41(R).
s41(f(41, R)) :- s42(R).
s42(f(42, R)) :- s43(R).
s43(f(43, R)) :- s44(R).
s44(f(44, R)) :- s45(R).
s45(f(45, R)) :- s46(R).
s46(f(46, R)) :- s47(R).
s47(f(47, R)) :- s48(R).
s48(f(48, R)) :- s49(R).
s49(f(49, R)) :- s50(R).
s50(f(50, R)) :- s51(R).
s51(f(51, R)) :- s52(R).
s52(f(52, R)) :- s53(R).
s53(f(53, R)) :- s54(R).
s54(f(54, R)) :- s55(R).
s55(f(55, R)) :- s56(R).
s56(f(56, R)) :- s57(R).
s57(f(57, R)) :- s58(R).
s58(f(58, R)) :- s59(R).
s59(f(59, R)) :- s60(R).
s60(f(60, R)) :- s61(R).
s61(f(61, R)) :- s62(R).
s62(f(62, R)) :- s63(R).
s63(f(63, R)) :- s64(R).
s64(f(64, R)) :- s65(R).
s65(f(65, R)) :- s66(R).
s66(f(66, R)) :- s67(R).
s67(f(67, R)) :- s68(R).
s68(f(68, R)) :- s69(R).
s69(f(69, R)) :- s70(R).
s70(f(70, R)) :- s71(R).
s71(f(71, R)) :- s72(R).
s72(f(72, R)) :- s73(R).
s73(f(73, R)) :- s74(R).
s74(f(74, R)) :- s75(R).
s75(f(75, R)) :- s76(R).
s76(f(76, R)) :- s77(R).
s77(f(77, R)) :- s78(R).
s78(f(78, R)) :- s79(R).
s79(f(79, R)) :- s80(R).
s80(f(80, R)) :- s81(R).
s81(f(81, R)) :- s82(R).
s82(f(82, R)) :- s83(R).
s83(f(83, R)) :- s84(R).
s84(f(84, R)) :- s85(R).
s85(f(85, R)) :- s86(R).
s86(f(86, R)) :- s87(R).
s87(f(87, R)) :- s88(R).
s88(f(88, R)) :- s89(R).
s89(f(89, R)) :- s90(R).
s90(f(90, R)) :- s91(R).
s91(f(91, R)) :- s92(R).
s92(f(92, R)) :- s93(R).
s93(f(93, R)) :- s94(R).
s94(f(94, R)) :- s95(R).
s95(f(95, R)) :- s96(R).
s96(f(96, R)) :- s97(R).
s97(f(97, R)) :- s98(R).
s98(f(98, R)) :- s99(R).
s99(f(99, R)) :- s100(R).
s100(f(100, R)) :- s101(R).
s101(nil).
% 10. 99 shallow failures; assumes no indexing on 2nd argument
bench_mark(shallow_backtracking, 2000, shallow, dummy).
% :- public shallow/0.
shallow :- b(_, 100).
% 11. 99 deep failures; assumes no indexing on 2nd argument
bench_mark(deep_backtracking, 2000, deep, dummy).
% :- public deep/0.
deep :- b(_, Y), Y = 100.
b(_X, 1).
b(_X, 2).
b(_X, 3).
b(_X, 4).
b(_X, 5).
b(_X, 6).
b(_X, 7).
b(_X, 8).
b(_X, 9).
b(_X, 10).
b(_X, 11).
b(_X, 12).
b(_X, 13).
b(_X, 14).
b(_X, 15).
b(_X, 16).
b(_X, 17).
b(_X, 18).
b(_X, 19).
b(_X, 20).
b(_X, 21).
b(_X, 22).
b(_X, 23).
b(_X, 24).
b(_X, 25).
b(_X, 26).
b(_X, 27).
b(_X, 28).
b(_X, 29).
b(_X, 30).
b(_X, 31).
b(_X, 32).
b(_X, 33).
b(_X, 34).
b(_X, 35).
b(_X, 36).
b(_X, 37).
b(_X, 38).
b(_X, 39).
b(_X, 40).
b(_X, 41).
b(_X, 42).
b(_X, 43).
b(_X, 44).
b(_X, 45).
b(_X, 46).
b(_X, 47).
b(_X, 48).
b(_X, 49).
b(_X, 50).
b(_X, 51).
b(_X, 52).
b(_X, 53).
b(_X, 54).
b(_X, 55).
b(_X, 56).
b(_X, 57).
b(_X, 58).
b(_X, 59).
b(_X, 60).
b(_X, 61).
b(_X, 62).
b(_X, 63).
b(_X, 64).
b(_X, 65).
b(_X, 66).
b(_X, 67).
b(_X, 68).
b(_X, 69).
b(_X, 70).
b(_X, 71).
b(_X, 72).
b(_X, 73).
b(_X, 74).
b(_X, 75).
b(_X, 76).
b(_X, 77).
b(_X, 78).
b(_X, 79).
b(_X, 80).
b(_X, 81).
b(_X, 82).
b(_X, 83).
b(_X, 84).
b(_X, 85).
b(_X, 86).
b(_X, 87).
b(_X, 88).
b(_X, 89).
b(_X, 90).
b(_X, 91).
b(_X, 92).
b(_X, 93).
b(_X, 94).
b(_X, 95).
b(_X, 96).
b(_X, 97).
b(_X, 98).
b(_X, 99).
b(_X, 100).
% 12. Push 100 choice points
% Assumes no super-clever (multipredicate) optimizer
bench_mark(choice_point, 2000, choice, dummy(a)).
% :- public choice/0.
choice :- c1(a), !.
c1(a) :- c2(a).
c1(a).
c2(a) :- c3(a).
c2(a).
c3(a) :- c4(a).
c3(a).
c4(a) :- c5(a).
c4(a).
c5(a) :- c6(a).
c5(a).
c6(a) :- c7(a).
c6(a).
c7(a) :- c8(a).
c7(a).
c8(a) :- c9(a).
c8(a).
c9(a) :- c10(a).
c9(a).
c10(a) :- c11(a).
c10(a).
c11(a) :- c12(a).
c11(a).
c12(a) :- c13(a).
c12(a).
c13(a) :- c14(a).
c13(a).
c14(a) :- c15(a).
c14(a).
c15(a) :- c16(a).
c15(a).
c16(a) :- c17(a).
c16(a).
c17(a) :- c18(a).
c17(a).
c18(a) :- c19(a).
c18(a).
c19(a) :- c20(a).
c19(a).
c20(a) :- c21(a).
c20(a).
c21(a) :- c22(a).
c21(a).
c22(a) :- c23(a).
c22(a).
c23(a) :- c24(a).
c23(a).
c24(a) :- c25(a).
c24(a).
c25(a) :- c26(a).
c25(a).
c26(a) :- c27(a).
c26(a).
c27(a) :- c28(a).
c27(a).
c28(a) :- c29(a).
c28(a).
c29(a) :- c30(a).
c29(a).
c30(a) :- c31(a).
c30(a).
c31(a) :- c32(a).
c31(a).
c32(a) :- c33(a).
c32(a).
c33(a) :- c34(a).
c33(a).
c34(a) :- c35(a).
c34(a).
c35(a) :- c36(a).
c35(a).
c36(a) :- c37(a).
c36(a).
c37(a) :- c38(a).
c37(a).
c38(a) :- c39(a).
c38(a).
c39(a) :- c40(a).
c39(a).
c40(a) :- c41(a).
c40(a).
c41(a) :- c42(a).
c41(a).
c42(a) :- c43(a).
c42(a).
c43(a) :- c44(a).
c43(a).
c44(a) :- c45(a).
c44(a).
c45(a) :- c46(a).
c45(a).
c46(a) :- c47(a).
c46(a).
c47(a) :- c48(a).
c47(a).
c48(a) :- c49(a).
c48(a).
c49(a) :- c50(a).
c49(a).
c50(a) :- c51(a).
c50(a).
c51(a) :- c52(a).
c51(a).
c52(a) :- c53(a).
c52(a).
c53(a) :- c54(a).
c53(a).
c54(a) :- c55(a).
c54(a).
c55(a) :- c56(a).
c55(a).
c56(a) :- c57(a).
c56(a).
c57(a) :- c58(a).
c57(a).
c58(a) :- c59(a).
c58(a).
c59(a) :- c60(a).
c59(a).
c60(a) :- c61(a).
c60(a).
c61(a) :- c62(a).
c61(a).
c62(a) :- c63(a).
c62(a).
c63(a) :- c64(a).
c63(a).
c64(a) :- c65(a).
c64(a).
c65(a) :- c66(a).
c65(a).
c66(a) :- c67(a).
c66(a).
c67(a) :- c68(a).
c67(a).
c68(a) :- c69(a).
c68(a).
c69(a) :- c70(a).
c69(a).
c70(a) :- c71(a).
c70(a).
c71(a) :- c72(a).
c71(a).
c72(a) :- c73(a).
c72(a).
c73(a) :- c74(a).
c73(a).
c74(a) :- c75(a).
c74(a).
c75(a) :- c76(a).
c75(a).
c76(a) :- c77(a).
c76(a).
c77(a) :- c78(a).
c77(a).
c78(a) :- c79(a).
c78(a).
c79(a) :- c80(a).
c79(a).
c80(a) :- c81(a).
c80(a).
c81(a) :- c82(a).
c81(a).
c82(a) :- c83(a).
c82(a).
c83(a) :- c84(a).
c83(a).
c84(a) :- c85(a).
c84(a).
c85(a) :- c86(a).
c85(a).
c86(a) :- c87(a).
c86(a).
c87(a) :- c88(a).
c87(a).
c88(a) :- c89(a).
c88(a).
c89(a) :- c90(a).
c89(a).
c90(a) :- c91(a).
c90(a).
c91(a) :- c92(a).
c91(a).
c92(a) :- c93(a).
c92(a).
c93(a) :- c94(a).
c93(a).
c94(a) :- c95(a).
c94(a).
c95(a) :- c96(a).
c95(a).
c96(a) :- c97(a).
c96(a).
c97(a) :- c98(a).
c97(a).
c98(a) :- c99(a).
c98(a).
c99(a) :- c100(a).
c99(a).
c100(a).
c100(a).
% 13. Create 100 choice points and trail 100 variables
bench_mark(trail_variables, 2000, trail, dummy).
% :- public trail/0.
trail :- t1(_X), !.
t1(a) :- t2(_X).
t1(b).
t2(a) :- t3(_X).
t2(b).
t3(a) :- t4(_X).
t3(b).
t4(a) :- t5(_X).
t4(b).
t5(a) :- t6(_X).
t5(b).
t6(a) :- t7(_X).
t6(b).
t7(a) :- t8(_X).
t7(b).
t8(a) :- t9(_X).
t8(b).
t9(a) :- t10(_X).
t9(b).
t10(a) :- t11(_X).
t10(b).
t11(a) :- t12(_X).
t11(b).
t12(a) :- t13(_X).
t12(b).
t13(a) :- t14(_X).
t13(b).
t14(a) :- t15(_X).
t14(b).
t15(a) :- t16(_X).
t15(b).
t16(a) :- t17(_X).
t16(b).
t17(a) :- t18(_X).
t17(b).
t18(a) :- t19(_X).
t18(b).
t19(a) :- t20(_X).
t19(b).
t20(a) :- t21(_X).
t20(b).
t21(a) :- t22(_X).
t21(b).
t22(a) :- t23(_X).
t22(b).
t23(a) :- t24(_X).
t23(b).
t24(a) :- t25(_X).
t24(b).
t25(a) :- t26(_X).
t25(b).
t26(a) :- t27(_X).
t26(b).
t27(a) :- t28(_X).
t27(b).
t28(a) :- t29(_X).
t28(b).
t29(a) :- t30(_X).
t29(b).
t30(a) :- t31(_X).
t30(b).
t31(a) :- t32(_X).
t31(b).
t32(a) :- t33(_X).
t32(b).
t33(a) :- t34(_X).
t33(b).
t34(a) :- t35(_X).
t34(b).
t35(a) :- t36(_X).
t35(b).
t36(a) :- t37(_X).
t36(b).
t37(a) :- t38(_X).
t37(b).
t38(a) :- t39(_X).
t38(b).
t39(a) :- t40(_X).
t39(b).
t40(a) :- t41(_X).
t40(b).
t41(a) :- t42(_X).
t41(b).
t42(a) :- t43(_X).
t42(b).
t43(a) :- t44(_X).
t43(b).
t44(a) :- t45(_X).
t44(b).
t45(a) :- t46(_X).
t45(b).
t46(a) :- t47(_X).
t46(b).
t47(a) :- t48(_X).
t47(b).
t48(a) :- t49(_X).
t48(b).
t49(a) :- t50(_X).
t49(b).
t50(a) :- t51(_X).
t50(b).
t51(a) :- t52(_X).
t51(b).
t52(a) :- t53(_X).
t52(b).
t53(a) :- t54(_X).
t53(b).
t54(a) :- t55(_X).
t54(b).
t55(a) :- t56(_X).
t55(b).
t56(a) :- t57(_X).
t56(b).
t57(a) :- t58(_X).
t57(b).
t58(a) :- t59(_X).
t58(b).
t59(a) :- t60(_X).
t59(b).
t60(a) :- t61(_X).
t60(b).
t61(a) :- t62(_X).
t61(b).
t62(a) :- t63(_X).
t62(b).
t63(a) :- t64(_X).
t63(b).
t64(a) :- t65(_X).
t64(b).
t65(a) :- t66(_X).
t65(b).
t66(a) :- t67(_X).
t66(b).
t67(a) :- t68(_X).
t67(b).
t68(a) :- t69(_X).
t68(b).
t69(a) :- t70(_X).
t69(b).
t70(a) :- t71(_X).
t70(b).
t71(a) :- t72(_X).
t71(b).
t72(a) :- t73(_X).
t72(b).
t73(a) :- t74(_X).
t73(b).
t74(a) :- t75(_X).
t74(b).
t75(a) :- t76(_X).
t75(b).
t76(a) :- t77(_X).
t76(b).
t77(a) :- t78(_X).
t77(b).
t78(a) :- t79(_X).
t78(b).
t79(a) :- t80(_X).
t79(b).
t80(a) :- t81(_X).
t80(b).
t81(a) :- t82(_X).
t81(b).
t82(a) :- t83(_X).
t82(b).
t83(a) :- t84(_X).
t83(b).
t84(a) :- t85(_X).
t84(b).
t85(a) :- t86(_X).
t85(b).
t86(a) :- t87(_X).
t86(b).
t87(a) :- t88(_X).
t87(b).
t88(a) :- t89(_X).
t88(b).
t89(a) :- t90(_X).
t89(b).
t90(a) :- t91(_X).
t90(b).
t91(a) :- t92(_X).
t91(b).
t92(a) :- t93(_X).
t92(b).
t93(a) :- t94(_X).
t93(b).
t94(a) :- t95(_X).
t94(b).
t95(a) :- t96(_X).
t95(b).
t96(a) :- t97(_X).
t96(b).
t97(a) :- t98(_X).
t97(b).
t98(a) :- t99(_X).
t98(b).
t99(a) :- t100(_X).
t99(b).
t100(a).
t100(b).
% 14. Unify terms that are small in space but textually large.
bench_mark(medium_unify, 2000, equal(Term1, Term2), dummy(Term1, Term2)) :- term64(Term1), term64(Term2).
bench_mark(deep_unify, 100, equal(Term1, Term2), dummy(Term1, Term2)) :- term4096(Term1), term4096(Term2).
% :- public equal/2.
equal(X, X).
term64(X1) :-
X1 = f(X2, X2a),
X2 = f(X4, X4a),
X4 = f(X8, X8a),
X8 = f(X16, X16a),
X16 = f(X32, X32a),
X32 = f(X64, X64a),
duplicate_term(X2, X2a), % Avoid cyclic term-reduction to
duplicate_term(X4, X4a), % make this a no-op.
duplicate_term(X8, X8a),
duplicate_term(X16, X16a),
duplicate_term(X32, X32a),
duplicate_term(X64, X64a).
term4096(X1) :-
X1 = f(X2, X2a),
X2 = f(X4, X4a),
X4 = f(X8, X8a),
X8 = f(X16, X16a),
X16 = f(X32, X32a),
X32 = f(X64, X64a),
X64 = f(X128, X128a),
X128 = f(X256, X256a),
X256 = f(X512, X512a),
X512 = f(X1024, X1024a),
X1024 = f(X2048, X2048a),
X2048 = f(X4096, X4096a),
duplicate_term(X2, X2a),
duplicate_term(X4, X4a),
duplicate_term(X8, X8a),
duplicate_term(X16, X16a),
duplicate_term(X32, X32a),
duplicate_term(X64, X64a),
duplicate_term(X128, X128a),
duplicate_term(X256, X256a),
duplicate_term(X512, X512a),
duplicate_term(X1024, X1024a),
duplicate_term(X2048, X2048a),
duplicate_term(X4096, X4096a).
% 15. Do 100 integer additions nonrecursively,
% avoiding obvious compiler optimizations.
bench_mark(integer_add, 1000, a1(0, 1, R), dummy(0, 1, R)).
% :- public a1/3.
a1(M, K, P) :- N is M + K, a2(N, 2, P).
a2(M, K, P) :- N is M + K, a3(N, 3, P).
a3(M, K, P) :- N is M + K, a4(N, 4, P).
a4(M, K, P) :- N is M + K, a5(N, 5, P).
a5(M, K, P) :- N is M + K, a6(N, 6, P).
a6(M, K, P) :- N is M + K, a7(N, 7, P).
a7(M, K, P) :- N is M + K, a8(N, 8, P).
a8(M, K, P) :- N is M + K, a9(N, 9, P).
a9(M, K, P) :- N is M + K, a10(N, 10, P).
a10(M, K, P) :- N is M + K, a11(N, 11, P).
a11(M, K, P) :- N is M + K, a12(N, 12, P).
a12(M, K, P) :- N is M + K, a13(N, 13, P).
a13(M, K, P) :- N is M + K, a14(N, 14, P).
a14(M, K, P) :- N is M + K, a15(N, 15, P).
a15(M, K, P) :- N is M + K, a16(N, 16, P).
a16(M, K, P) :- N is M + K, a17(N, 17, P).
a17(M, K, P) :- N is M + K, a18(N, 18, P).
a18(M, K, P) :- N is M + K, a19(N, 19, P).
a19(M, K, P) :- N is M + K, a20(N, 20, P).
a20(M, K, P) :- N is M + K, a21(N, 21, P).
a21(M, K, P) :- N is M + K, a22(N, 22, P).
a22(M, K, P) :- N is M + K, a23(N, 23, P).
a23(M, K, P) :- N is M + K, a24(N, 24, P).
a24(M, K, P) :- N is M + K, a25(N, 25, P).
a25(M, K, P) :- N is M + K, a26(N, 26, P).
a26(M, K, P) :- N is M + K, a27(N, 27, P).
a27(M, K, P) :- N is M + K, a28(N, 28, P).
a28(M, K, P) :- N is M + K, a29(N, 29, P).
a29(M, K, P) :- N is M + K, a30(N, 30, P).
a30(M, K, P) :- N is M + K, a31(N, 31, P).
a31(M, K, P) :- N is M + K, a32(N, 32, P).
a32(M, K, P) :- N is M + K, a33(N, 33, P).
a33(M, K, P) :- N is M + K, a34(N, 34, P).
a34(M, K, P) :- N is M + K, a35(N, 35, P).
a35(M, K, P) :- N is M + K, a36(N, 36, P).
a36(M, K, P) :- N is M + K, a37(N, 37, P).
a37(M, K, P) :- N is M + K, a38(N, 38, P).
a38(M, K, P) :- N is M + K, a39(N, 39, P).
a39(M, K, P) :- N is M + K, a40(N, 40, P).
a40(M, K, P) :- N is M + K, a41(N, 41, P).
a41(M, K, P) :- N is M + K, a42(N, 42, P).
a42(M, K, P) :- N is M + K, a43(N, 43, P).
a43(M, K, P) :- N is M + K, a44(N, 44, P).
a44(M, K, P) :- N is M + K, a45(N, 45, P).
a45(M, K, P) :- N is M + K, a46(N, 46, P).
a46(M, K, P) :- N is M + K, a47(N, 47, P).
a47(M, K, P) :- N is M + K, a48(N, 48, P).
a48(M, K, P) :- N is M + K, a49(N, 49, P).
a49(M, K, P) :- N is M + K, a50(N, 50, P).
a50(M, K, P) :- N is M + K, a51(N, 51, P).
a51(M, K, P) :- N is M + K, a52(N, 52, P).
a52(M, K, P) :- N is M + K, a53(N, 53, P).
a53(M, K, P) :- N is M + K, a54(N, 54, P).
a54(M, K, P) :- N is M + K, a55(N, 55, P).
a55(M, K, P) :- N is M + K, a56(N, 56, P).
a56(M, K, P) :- N is M + K, a57(N, 57, P).
a57(M, K, P) :- N is M + K, a58(N, 58, P).
a58(M, K, P) :- N is M + K, a59(N, 59, P).
a59(M, K, P) :- N is M + K, a60(N, 60, P).
a60(M, K, P) :- N is M + K, a61(N, 61, P).
a61(M, K, P) :- N is M + K, a62(N, 62, P).
a62(M, K, P) :- N is M + K, a63(N, 63, P).
a63(M, K, P) :- N is M + K, a64(N, 64, P).
a64(M, K, P) :- N is M + K, a65(N, 65, P).
a65(M, K, P) :- N is M + K, a66(N, 66, P).
a66(M, K, P) :- N is M + K, a67(N, 67, P).
a67(M, K, P) :- N is M + K, a68(N, 68, P).
a68(M, K, P) :- N is M + K, a69(N, 69, P).
a69(M, K, P) :- N is M + K, a70(N, 70, P).
a70(M, K, P) :- N is M + K, a71(N, 71, P).
a71(M, K, P) :- N is M + K, a72(N, 72, P).
a72(M, K, P) :- N is M + K, a73(N, 73, P).
a73(M, K, P) :- N is M + K, a74(N, 74, P).
a74(M, K, P) :- N is M + K, a75(N, 75, P).
a75(M, K, P) :- N is M + K, a76(N, 76, P).
a76(M, K, P) :- N is M + K, a77(N, 77, P).
a77(M, K, P) :- N is M + K, a78(N, 78, P).
a78(M, K, P) :- N is M + K, a79(N, 79, P).
a79(M, K, P) :- N is M + K, a80(N, 80, P).
a80(M, K, P) :- N is M + K, a81(N, 81, P).
a81(M, K, P) :- N is M + K, a82(N, 82, P).
a82(M, K, P) :- N is M + K, a83(N, 83, P).
a83(M, K, P) :- N is M + K, a84(N, 84, P).
a84(M, K, P) :- N is M + K, a85(N, 85, P).
a85(M, K, P) :- N is M + K, a86(N, 86, P).
a86(M, K, P) :- N is M + K, a87(N, 87, P).
a87(M, K, P) :- N is M + K, a88(N, 88, P).
a88(M, K, P) :- N is M + K, a89(N, 89, P).
a89(M, K, P) :- N is M + K, a90(N, 90, P).
a90(M, K, P) :- N is M + K, a91(N, 91, P).
a91(M, K, P) :- N is M + K, a92(N, 92, P).
a92(M, K, P) :- N is M + K, a93(N, 93, P).
a93(M, K, P) :- N is M + K, a94(N, 94, P).
a94(M, K, P) :- N is M + K, a95(N, 95, P).
a95(M, K, P) :- N is M + K, a96(N, 96, P).
a96(M, K, P) :- N is M + K, a97(N, 97, P).
a97(M, K, P) :- N is M + K, a98(N, 98, P).
a98(M, K, P) :- N is M + K, a99(N, 99, P).
a99(M, K, P) :- N is M + K, a100(N, 100, P).
a100(M, K, P) :- P is M + K.
% 16. 100 floating additions
bench_mark(floating_add, 1000, fa1(0.1, 1.1, R), dummy(0.1, 1.1, R)).
% :- public fa1/3.
fa1(M, K, P) :- N is M + K, fa2(N, 2.1, P).
fa2(M, K, P) :- N is M + K, fa3(N, 3.1, P).
fa3(M, K, P) :- N is M + K, fa4(N, 4.1, P).
fa4(M, K, P) :- N is M + K, fa5(N, 5.1, P).
fa5(M, K, P) :- N is M + K, fa6(N, 6.1, P).
fa6(M, K, P) :- N is M + K, fa7(N, 7.1, P).
fa7(M, K, P) :- N is M + K, fa8(N, 8.1, P).
fa8(M, K, P) :- N is M + K, fa9(N, 9.1, P).
fa9(M, K, P) :- N is M + K, fa10(N, 10.1, P).
fa10(M, K, P) :- N is M + K, fa11(N, 11.1, P).
fa11(M, K, P) :- N is M + K, fa12(N, 12.1, P).
fa12(M, K, P) :- N is M + K, fa13(N, 13.1, P).
fa13(M, K, P) :- N is M + K, fa14(N, 14.1, P).
fa14(M, K, P) :- N is M + K, fa15(N, 15.1, P).
fa15(M, K, P) :- N is M + K, fa16(N, 16.1, P).
fa16(M, K, P) :- N is M + K, fa17(N, 17.1, P).
fa17(M, K, P) :- N is M + K, fa18(N, 18.1, P).
fa18(M, K, P) :- N is M + K, fa19(N, 19.1, P).
fa19(M, K, P) :- N is M + K, fa20(N, 20.1, P).
fa20(M, K, P) :- N is M + K, fa21(N, 21.1, P).
fa21(M, K, P) :- N is M + K, fa22(N, 22.1, P).
fa22(M, K, P) :- N is M + K, fa23(N, 23.1, P).
fa23(M, K, P) :- N is M + K, fa24(N, 24.1, P).
fa24(M, K, P) :- N is M + K, fa25(N, 25.1, P).
fa25(M, K, P) :- N is M + K, fa26(N, 26.1, P).
fa26(M, K, P) :- N is M + K, fa27(N, 27.1, P).
fa27(M, K, P) :- N is M + K, fa28(N, 28.1, P).
fa28(M, K, P) :- N is M + K, fa29(N, 29.1, P).
fa29(M, K, P) :- N is M + K, fa30(N, 30.1, P).
fa30(M, K, P) :- N is M + K, fa31(N, 31.1, P).
fa31(M, K, P) :- N is M + K, fa32(N, 32.1, P).
fa32(M, K, P) :- N is M + K, fa33(N, 33.1, P).
fa33(M, K, P) :- N is M + K, fa34(N, 34.1, P).
fa34(M, K, P) :- N is M + K, fa35(N, 35.1, P).
fa35(M, K, P) :- N is M + K, fa36(N, 36.1, P).
fa36(M, K, P) :- N is M + K, fa37(N, 37.1, P).
fa37(M, K, P) :- N is M + K, fa38(N, 38.1, P).
fa38(M, K, P) :- N is M + K, fa39(N, 39.1, P).
fa39(M, K, P) :- N is M + K, fa40(N, 40.1, P).
fa40(M, K, P) :- N is M + K, fa41(N, 41.1, P).
fa41(M, K, P) :- N is M + K, fa42(N, 42.1, P).
fa42(M, K, P) :- N is M + K, fa43(N, 43.1, P).
fa43(M, K, P) :- N is M + K, fa44(N, 44.1, P).
fa44(M, K, P) :- N is M + K, fa45(N, 45.1, P).
fa45(M, K, P) :- N is M + K, fa46(N, 46.1, P).
fa46(M, K, P) :- N is M + K, fa47(N, 47.1, P).
fa47(M, K, P) :- N is M + K, fa48(N, 48.1, P).
fa48(M, K, P) :- N is M + K, fa49(N, 49.1, P).
fa49(M, K, P) :- N is M + K, fa50(N, 50.1, P).
fa50(M, K, P) :- N is M + K, fa51(N, 51.1, P).
fa51(M, K, P) :- N is M + K, fa52(N, 52.1, P).
fa52(M, K, P) :- N is M + K, fa53(N, 53.1, P).
fa53(M, K, P) :- N is M + K, fa54(N, 54.1, P).
fa54(M, K, P) :- N is M + K, fa55(N, 55.1, P).
fa55(M, K, P) :- N is M + K, fa56(N, 56.1, P).
fa56(M, K, P) :- N is M + K, fa57(N, 57.1, P).
fa57(M, K, P) :- N is M + K, fa58(N, 58.1, P).
fa58(M, K, P) :- N is M + K, fa59(N, 59.1, P).
fa59(M, K, P) :- N is M + K, fa60(N, 60.1, P).
fa60(M, K, P) :- N is M + K, fa61(N, 61.1, P).
fa61(M, K, P) :- N is M + K, fa62(N, 62.1, P).
fa62(M, K, P) :- N is M + K, fa63(N, 63.1, P).
fa63(M, K, P) :- N is M + K, fa64(N, 64.1, P).
fa64(M, K, P) :- N is M + K, fa65(N, 65.1, P).
fa65(M, K, P) :- N is M + K, fa66(N, 66.1, P).
fa66(M, K, P) :- N is M + K, fa67(N, 67.1, P).
fa67(M, K, P) :- N is M + K, fa68(N, 68.1, P).
fa68(M, K, P) :- N is M + K, fa69(N, 69.1, P).
fa69(M, K, P) :- N is M + K, fa70(N, 70.1, P).
fa70(M, K, P) :- N is M + K, fa71(N, 71.1, P).
fa71(M, K, P) :- N is M + K, fa72(N, 72.1, P).
fa72(M, K, P) :- N is M + K, fa73(N, 73.1, P).
fa73(M, K, P) :- N is M + K, fa74(N, 74.1, P).
fa74(M, K, P) :- N is M + K, fa75(N, 75.1, P).
fa75(M, K, P) :- N is M + K, fa76(N, 76.1, P).
fa76(M, K, P) :- N is M + K, fa77(N, 77.1, P).
fa77(M, K, P) :- N is M + K, fa78(N, 78.1, P).
fa78(M, K, P) :- N is M + K, fa79(N, 79.1, P).
fa79(M, K, P) :- N is M + K, fa80(N, 80.1, P).
fa80(M, K, P) :- N is M + K, fa81(N, 81.1, P).
fa81(M, K, P) :- N is M + K, fa82(N, 82.1, P).
fa82(M, K, P) :- N is M + K, fa83(N, 83.1, P).
fa83(M, K, P) :- N is M + K, fa84(N, 84.1, P).
fa84(M, K, P) :- N is M + K, fa85(N, 85.1, P).
fa85(M, K, P) :- N is M + K, fa86(N, 86.1, P).
fa86(M, K, P) :- N is M + K, fa87(N, 87.1, P).
fa87(M, K, P) :- N is M + K, fa88(N, 88.1, P).
fa88(M, K, P) :- N is M + K, fa89(N, 89.1, P).
fa89(M, K, P) :- N is M + K, fa90(N, 90.1, P).
fa90(M, K, P) :- N is M + K, fa91(N, 91.1, P).
fa91(M, K, P) :- N is M + K, fa92(N, 92.1, P).
fa92(M, K, P) :- N is M + K, fa93(N, 93.1, P).
fa93(M, K, P) :- N is M + K, fa94(N, 94.1, P).
fa94(M, K, P) :- N is M + K, fa95(N, 95.1, P).
fa95(M, K, P) :- N is M + K, fa96(N, 96.1, P).
fa96(M, K, P) :- N is M + K, fa97(N, 97.1, P).
fa97(M, K, P) :- N is M + K, fa98(N, 98.1, P).
fa98(M, K, P) :- N is M + K, fa99(N, 99.1, P).
fa99(M, K, P) :- N is M + K, fa100(N, 100.1, P).
fa100(M, K, P) :- P is M + K.
% 17. 100 calls to arg at position N
bench_mark(arg(N), 2000, arg1(N, Term, R), dummy(N, Term, R)) :- args(N), complex_nary_term(100, N, Term).
% :- public arg1/3.
complex_nary_term(0, N, N) :- !.
complex_nary_term(I, N, Term) :-
I > 0, J is I - 1,
complex_nary_term(J, N, SubTerm),
nary_term(N, SubTerm, Term).
nary_term(N, SubTerm, Term) :-
functor(Term, f, N),
fill_nary_term(N, SubTerm, Term).
fill_nary_term(0, _, _) :- !.
fill_nary_term(N, SubTerm, Term) :-
N > 0, M is N - 1,
arg(N, Term, SubTerm),
fill_nary_term(M, SubTerm, Term).
arg1(N, T, R) :- arg(N, T, X), arg2(N, X, R).
arg2(N, T, R) :- arg(N, T, X), arg3(N, X, R).
arg3(N, T, R) :- arg(N, T, X), arg4(N, X, R).
arg4(N, T, R) :- arg(N, T, X), arg5(N, X, R).
arg5(N, T, R) :- arg(N, T, X), arg6(N, X, R).
arg6(N, T, R) :- arg(N, T, X), arg7(N, X, R).
arg7(N, T, R) :- arg(N, T, X), arg8(N, X, R).
arg8(N, T, R) :- arg(N, T, X), arg9(N, X, R).
arg9(N, T, R) :- arg(N, T, X), arg10(N, X, R).
arg10(N, T, R) :- arg(N, T, X), arg11(N, X, R).
arg11(N, T, R) :- arg(N, T, X), arg12(N, X, R).
arg12(N, T, R) :- arg(N, T, X), arg13(N, X, R).
arg13(N, T, R) :- arg(N, T, X), arg14(N, X, R).
arg14(N, T, R) :- arg(N, T, X), arg15(N, X, R).
arg15(N, T, R) :- arg(N, T, X), arg16(N, X, R).
arg16(N, T, R) :- arg(N, T, X), arg17(N, X, R).
arg17(N, T, R) :- arg(N, T, X), arg18(N, X, R).
arg18(N, T, R) :- arg(N, T, X), arg19(N, X, R).
arg19(N, T, R) :- arg(N, T, X), arg20(N, X, R).
arg20(N, T, R) :- arg(N, T, X), arg21(N, X, R).
arg21(N, T, R) :- arg(N, T, X), arg22(N, X, R).
arg22(N, T, R) :- arg(N, T, X), arg23(N, X, R).
arg23(N, T, R) :- arg(N, T, X), arg24(N, X, R).
arg24(N, T, R) :- arg(N, T, X), arg25(N, X, R).
arg25(N, T, R) :- arg(N, T, X), arg26(N, X, R).
arg26(N, T, R) :- arg(N, T, X), arg27(N, X, R).
arg27(N, T, R) :- arg(N, T, X), arg28(N, X, R).
arg28(N, T, R) :- arg(N, T, X), arg29(N, X, R).
arg29(N, T, R) :- arg(N, T, X), arg30(N, X, R).
arg30(N, T, R) :- arg(N, T, X), arg31(N, X, R).
arg31(N, T, R) :- arg(N, T, X), arg32(N, X, R).
arg32(N, T, R) :- arg(N, T, X), arg33(N, X, R).
arg33(N, T, R) :- arg(N, T, X), arg34(N, X, R).
arg34(N, T, R) :- arg(N, T, X), arg35(N, X, R).
arg35(N, T, R) :- arg(N, T, X), arg36(N, X, R).
arg36(N, T, R) :- arg(N, T, X), arg37(N, X, R).
arg37(N, T, R) :- arg(N, T, X), arg38(N, X, R).
arg38(N, T, R) :- arg(N, T, X), arg39(N, X, R).
arg39(N, T, R) :- arg(N, T, X), arg40(N, X, R).
arg40(N, T, R) :- arg(N, T, X), arg41(N, X, R).
arg41(N, T, R) :- arg(N, T, X), arg42(N, X, R).
arg42(N, T, R) :- arg(N, T, X), arg43(N, X, R).
arg43(N, T, R) :- arg(N, T, X), arg44(N, X, R).
arg44(N, T, R) :- arg(N, T, X), arg45(N, X, R).
arg45(N, T, R) :- arg(N, T, X), arg46(N, X, R).
arg46(N, T, R) :- arg(N, T, X), arg47(N, X, R).
arg47(N, T, R) :- arg(N, T, X), arg48(N, X, R).
arg48(N, T, R) :- arg(N, T, X), arg49(N, X, R).
arg49(N, T, R) :- arg(N, T, X), arg50(N, X, R).
arg50(N, T, R) :- arg(N, T, X), arg51(N, X, R).
arg51(N, T, R) :- arg(N, T, X), arg52(N, X, R).
arg52(N, T, R) :- arg(N, T, X), arg53(N, X, R).
arg53(N, T, R) :- arg(N, T, X), arg54(N, X, R).
arg54(N, T, R) :- arg(N, T, X), arg55(N, X, R).
arg55(N, T, R) :- arg(N, T, X), arg56(N, X, R).
arg56(N, T, R) :- arg(N, T, X), arg57(N, X, R).
arg57(N, T, R) :- arg(N, T, X), arg58(N, X, R).
arg58(N, T, R) :- arg(N, T, X), arg59(N, X, R).
arg59(N, T, R) :- arg(N, T, X), arg60(N, X, R).
arg60(N, T, R) :- arg(N, T, X), arg61(N, X, R).
arg61(N, T, R) :- arg(N, T, X), arg62(N, X, R).
arg62(N, T, R) :- arg(N, T, X), arg63(N, X, R).
arg63(N, T, R) :- arg(N, T, X), arg64(N, X, R).
arg64(N, T, R) :- arg(N, T, X), arg65(N, X, R).
arg65(N, T, R) :- arg(N, T, X), arg66(N, X, R).
arg66(N, T, R) :- arg(N, T, X), arg67(N, X, R).
arg67(N, T, R) :- arg(N, T, X), arg68(N, X, R).
arg68(N, T, R) :- arg(N, T, X), arg69(N, X, R).
arg69(N, T, R) :- arg(N, T, X), arg70(N, X, R).
arg70(N, T, R) :- arg(N, T, X), arg71(N, X, R).
arg71(N, T, R) :- arg(N, T, X), arg72(N, X, R).
arg72(N, T, R) :- arg(N, T, X), arg73(N, X, R).
arg73(N, T, R) :- arg(N, T, X), arg74(N, X, R).
arg74(N, T, R) :- arg(N, T, X), arg75(N, X, R).
arg75(N, T, R) :- arg(N, T, X), arg76(N, X, R).
arg76(N, T, R) :- arg(N, T, X), arg77(N, X, R).
arg77(N, T, R) :- arg(N, T, X), arg78(N, X, R).
arg78(N, T, R) :- arg(N, T, X), arg79(N, X, R).
arg79(N, T, R) :- arg(N, T, X), arg80(N, X, R).
arg80(N, T, R) :- arg(N, T, X), arg81(N, X, R).
arg81(N, T, R) :- arg(N, T, X), arg82(N, X, R).
arg82(N, T, R) :- arg(N, T, X), arg83(N, X, R).
arg83(N, T, R) :- arg(N, T, X), arg84(N, X, R).
arg84(N, T, R) :- arg(N, T, X), arg85(N, X, R).
arg85(N, T, R) :- arg(N, T, X), arg86(N, X, R).
arg86(N, T, R) :- arg(N, T, X), arg87(N, X, R).
arg87(N, T, R) :- arg(N, T, X), arg88(N, X, R).
arg88(N, T, R) :- arg(N, T, X), arg89(N, X, R).
arg89(N, T, R) :- arg(N, T, X), arg90(N, X, R).
arg90(N, T, R) :- arg(N, T, X), arg91(N, X, R).
arg91(N, T, R) :- arg(N, T, X), arg92(N, X, R).
arg92(N, T, R) :- arg(N, T, X), arg93(N, X, R).
arg93(N, T, R) :- arg(N, T, X), arg94(N, X, R).
arg94(N, T, R) :- arg(N, T, X), arg95(N, X, R).
arg95(N, T, R) :- arg(N, T, X), arg96(N, X, R).
arg96(N, T, R) :- arg(N, T, X), arg97(N, X, R).
arg97(N, T, R) :- arg(N, T, X), arg98(N, X, R).
arg98(N, T, R) :- arg(N, T, X), arg99(N, X, R).
arg99(N, T, R) :- arg(N, T, X), arg100(N, X, R).
arg100(N, T, R) :- arg(N, T, R).
% 18. 100 indexed calls; some systems may require extra declarations to
% put an index on the first argument.
bench_mark(index, 2000, ix(1), dummy(1)).
ix(1) :- ix(10000).
ix(4).
ix(9) :- ix(4).
ix(16) :- ix(9).
ix(25) :- ix(16).
ix(36) :- ix(25).
ix(49) :- ix(36).
ix(64) :- ix(49).
ix(81) :- ix(64).
ix(100) :- ix(81).
ix(121) :- ix(100).
ix(144) :- ix(121).
ix(169) :- ix(144).
ix(196) :- ix(169).
ix(225) :- ix(196).
ix(256) :- ix(225).
ix(289) :- ix(256).
ix(324) :- ix(289).
ix(361) :- ix(324).
ix(400) :- ix(361).
ix(441) :- ix(400).
ix(484) :- ix(441).
ix(529) :- ix(484).
ix(576) :- ix(529).
ix(625) :- ix(576).
ix(676) :- ix(625).
ix(729) :- ix(676).
ix(784) :- ix(729).
ix(841) :- ix(784).
ix(900) :- ix(841).
ix(961) :- ix(900).
ix(1024) :- ix(961).
ix(1089) :- ix(1024).
ix(1156) :- ix(1089).
ix(1225) :- ix(1156).
ix(1296) :- ix(1225).
ix(1369) :- ix(1296).
ix(1444) :- ix(1369).
ix(1521) :- ix(1444).
ix(1600) :- ix(1521).
ix(1681) :- ix(1600).
ix(1764) :- ix(1681).
ix(1849) :- ix(1764).
ix(1936) :- ix(1849).
ix(2025) :- ix(1936).
ix(2116) :- ix(2025).
ix(2209) :- ix(2116).
ix(2304) :- ix(2209).
ix(2401) :- ix(2304).
ix(2500) :- ix(2401).
ix(2601) :- ix(2500).
ix(2704) :- ix(2601).
ix(2809) :- ix(2704).
ix(2916) :- ix(2809).
ix(3025) :- ix(2916).
ix(3136) :- ix(3025).
ix(3249) :- ix(3136).
ix(3364) :- ix(3249).
ix(3481) :- ix(3364).
ix(3600) :- ix(3481).
ix(3721) :- ix(3600).
ix(3844) :- ix(3721).
ix(3969) :- ix(3844).
ix(4096) :- ix(3969).
ix(4225) :- ix(4096).
ix(4356) :- ix(4225).
ix(4489) :- ix(4356).
ix(4624) :- ix(4489).
ix(4761) :- ix(4624).
ix(4900) :- ix(4761).
ix(5041) :- ix(4900).
ix(5184) :- ix(5041).
ix(5329) :- ix(5184).
ix(5476) :- ix(5329).
ix(5625) :- ix(5476).
ix(5776) :- ix(5625).
ix(5929) :- ix(5776).
ix(6084) :- ix(5929).
ix(6241) :- ix(6084).
ix(6400) :- ix(6241).
ix(6561) :- ix(6400).
ix(6724) :- ix(6561).
ix(6889) :- ix(6724).
ix(7056) :- ix(6889).
ix(7225) :- ix(7056).
ix(7396) :- ix(7225).
ix(7569) :- ix(7396).
ix(7744) :- ix(7569).
ix(7921) :- ix(7744).
ix(8100) :- ix(7921).
ix(8281) :- ix(8100).
ix(8464) :- ix(8281).
ix(8649) :- ix(8464).
ix(8836) :- ix(8649).
ix(9025) :- ix(8836).
ix(9216) :- ix(9025).
ix(9409) :- ix(9216).
ix(9604) :- ix(9409).
ix(9801) :- ix(9604).
ix(10000) :- ix(9801).
% 19. Make 1000 asserts of unit clauses
bench_mark(assert_unit, 100, assert_clauses(L), dummy(L)) :-
abolish(ua, 3),
create_units(1, 1000, L).
% :- public assert_clauses/1.
create_units(I, N, []) :- I > N, !.
create_units(I, N, [ua(K, X, f(K, X))|Rest]) :-
K is I * (1 + I//100),
J is I + 1,
create_units(J, N, Rest).
assert_clauses([]).
assert_clauses([Clause|Rest]) :-
assert(Clause),
assert_clauses(Rest).
% 20. Access 100 dynamically-created clauses with 1st arg. instantiated
xbench_mark(access_unit, 1000, access_dix(1, 1), dummy(1, 1)) :-
abolish(dix, 2),
dix_clauses(1, 100, L),
assert_clauses(L).
% :- public access_dix/2.
dix_clauses(I, N, []) :- I > N, !.
dix_clauses(I, N, [dix(P, Q) | L]) :-
I =< N,
P is I*I,
R is 1 + (I+N-2) mod N,
Q is R*R,
J is I + 1,
dix_clauses(J, N, L).
access_dix(Start, End) :-
dix(Start, Where),
( Where = End
-> true
; access_dix(Where, End)
).
% 21. Access 100 dynamic unit clauses (2nd argument instantiated)
% :- public access_back/2.
xbench_mark(slow_access_unit, 100, access_back(1, 1), dummy(1, 1)) :-
abolish(dix, 2),
dix_clauses(1, 100, L),
assert_clauses(L).
access_back(Start, End) :-
dix(Where, Start),
( Where = End
-> true
; access_back(Where, End)
).
% 22. Setof and bagof
bench_mark(setof, 1000, setof(X, Y^pr(X, Y), S), dummy(X, Y^pr(X, Y), S)).
bench_mark(pair_setof, 1000, setof((X,Y), pr(X, Y), S), dummy((X,Y), pr(X, Y), S)).
bench_mark(double_setof, 100, setof((X,S), setof(Y, pr(X, Y), S), T), dummy((X,S), setof(Y, pr(X, Y), S), T)).
bench_mark(bagof, 1000, bagof(X, Y^pr(X, Y), S), dummy(X, Y^pr(X, Y), S)).
pr(99, 1).
pr(98, 2).
pr(97, 3).
pr(96, 4).
pr(95, 5).
pr(94, 6).
pr(93, 7).
pr(92, 8).
pr(91, 9).
pr(90, 10).
pr(89, 11).
pr(88, 12).
pr(87, 13).
pr(86, 14).
pr(85, 15).
pr(84, 16).
pr(83, 17).
pr(82, 18).
pr(81, 19).
pr(80, 20).
pr(79, 21).
pr(78, 22).
pr(77, 23).
pr(76, 24).
pr(75, 25).
pr(74, 26).
pr(73, 27).
pr(72, 28).
pr(71, 29).
pr(70, 30).
pr(69, 31).
pr(68, 32).
pr(67, 33).
pr(66, 34).
pr(65, 35).
pr(64, 36).
pr(63, 37).
pr(62, 38).
pr(61, 39).
pr(60, 40).
pr(59, 41).
pr(58, 42).
pr(57, 43).
pr(56, 44).
pr(55, 45).
pr(54, 46).
pr(53, 47).
pr(52, 48).
pr(51, 49).
pr(50, 50).
pr(49, 51).
pr(48, 52).
pr(47, 53).
pr(46, 54).
pr(45, 55).
pr(44, 56).
pr(43, 57).
pr(42, 58).
pr(41, 59).
pr(40, 60).
pr(39, 61).
pr(38, 62).
pr(37, 63).
pr(36, 64).
pr(35, 65).
pr(34, 66).
pr(33, 67).
pr(32, 68).
pr(31, 69).
pr(30, 70).
pr(29, 71).
pr(28, 72).
pr(27, 73).
pr(26, 74).
pr(25, 75).
pr(24, 76).
pr(23, 77).
pr(22, 78).
pr(21, 79).
pr(20, 80).
pr(19, 81).
pr(18, 82).
pr(17, 83).
pr(16, 84).
pr(15, 85).
pr(14, 86).
pr(13, 87).
pr(12, 88).
pr(11, 89).
pr(10, 90).
pr(9, 91).
pr(8, 92).
pr(7, 93).
pr(6, 94).
pr(5, 95).
pr(4, 96).
pr(3, 97).
pr(2, 98).
pr(1, 99).
pr(0, 100).
% ==================
| 23.349422 | 110 | 0.517269 |
73f8396b32492daf00b958539329f92879842d27 | 2,717 | pl | Perl | scripts/test/samtools.pl | dkj/bowtie | d1f4eb8f9a3f7c8dcfbaadfee4f67c9805e038d6 | [
"Artistic-1.0"
]
| 2 | 2017-01-10T08:06:56.000Z | 2019-03-26T07:04:34.000Z | scripts/test/samtools.pl | dkj/bowtie | d1f4eb8f9a3f7c8dcfbaadfee4f67c9805e038d6 | [
"Artistic-1.0"
]
| null | null | null | scripts/test/samtools.pl | dkj/bowtie | d1f4eb8f9a3f7c8dcfbaadfee4f67c9805e038d6 | [
"Artistic-1.0"
]
| null | null | null | #!/usr/bin/perl -w
##
# cs_trim.pl
#
# Basic tests to ensure that colorspace primer trimming is working as
# expected.
#
use strict;
use warnings;
my $bowtie = "./bowtie";
if(system("$bowtie --version") != 0) {
$bowtie = `which bowtie`;
chomp($bowtie);
if(system("$bowtie --version") != 0) {
die "Could not find bowtie in current directory or in PATH\n";
}
}
my $bowtie_d = "./bowtie-debug";
if(system("$bowtie_d --version") != 0) {
$bowtie_d = `which bowtie-debug`;
chomp($bowtie_d);
if(system("$bowtie_d --version") != 0) {
die "Could not find bowtie-debug in current directory or in PATH\n";
}
}
my $samtools = "samtools";
if(! -x $samtools) {
$samtools = `which samtools`;
chomp($samtools);
if($samtools eq "" || ! -x $samtools) {
die "Could not find samtools in current directory or in PATH\n";
}
}
my $bcftools = "bcftools";
if(! -x $bcftools) {
$bcftools = `which bcftools`;
chomp($bcftools);
if($bcftools eq "" || ! -x $bcftools) {
die "Could not find bcftools in current directory or in PATH\n";
}
}
if(! -f "e_coli_c.1.ebwt") {
print STDERR "Making colorspace e_coli index\n";
my $bowtie_build = "./bowtie-build";
if(system("$bowtie_build --version") != 0) {
print STDERR "Could not execute ./bowtie-build; looking in PATH...\n";
$bowtie_build = `which $bowtie_build`;
chomp($bowtie_build);
if(system("$bowtie_build --version") != 0) {
die "Could not find bowtie-build in current directory or in PATH\n";
}
}
system("$bowtie_build -C genomes/NC_008253.fna e_coli_c") && die;
} else {
print STDERR "Colorspace e_coli index already present...\n";
}
sub run($) {
my $cmd = shift;
print "$cmd\n";
return system($cmd);
}
# BTL 4/11/2013: Couldn't get samtools / bcftools to find SNPs from the
# colorspace invocation of Bowtie. Not sure why.
for my $cmd ("$bowtie_d -S e_coli reads/e_coli_10000snp.fq"
#, "$bowtie_d -S -C -f e_coli_c reads/e_coli_10000snp.csfasta"
)
{
system("rm -f .samtools.pl.*");
# Run Bowtie and output SAM
run("$cmd .samtools.pl.sam") && die;
# Convert to BAM
run("$samtools view -bS -o .samtools.pl.bam .samtools.pl.sam") && die;
# Sort BAM
run("$samtools sort .samtools.pl.bam .samtools.pl.sorted") && die;
# Run samtools mpileup / bcftools to get SNPs
my $bcfcmd = "$samtools mpileup -uf genomes/NC_008253.fna .samtools.pl.sorted.bam | $bcftools view -vcg -";
print STDERR "$bcfcmd\n";
open SAM, "$bcfcmd |" || die;
my $snps = 0;
while(<SAM>) {
next if substr($_, 0, 1) eq "#";
print $_;
$snps++;
}
close(SAM);
$? == 0 || die "samtools mpileup quit with exitlevel $?\n";
$snps == 10 || die "Wrong number of SNPs output by samtools; expected 10, got $snps\n";
print "PASSED\n";
}
| 27.444444 | 108 | 0.645933 |
ed0193f56dce4f8b9ee18eef1c1b4d833e903420 | 3,994 | pm | Perl | lib/WeBWorK/Authen/Cosign.pm | jrchamp/webwork2 | eda37450e1758ad859d6fe9cb6d08405846992ab | [
"FTL"
]
| 99 | 2015-01-12T14:18:26.000Z | 2022-02-27T18:45:10.000Z | lib/WeBWorK/Authen/Cosign.pm | cucucucumber/webwork2 | 165f532304ec43b93c0089dafa92525d9004a55c | [
"FTL"
]
| 929 | 2015-01-01T00:54:42.000Z | 2022-03-31T19:19:41.000Z | lib/WeBWorK/Authen/Cosign.pm | cucucucumber/webwork2 | 165f532304ec43b93c0089dafa92525d9004a55c | [
"FTL"
]
| 107 | 2015-02-13T02:39:53.000Z | 2022-03-04T21:26:50.000Z | ################################################################################
# WeBWorK Online Homework Delivery System
# Copyright © 2000-2018 The WeBWorK Project, http://openwebwork.sf.net/
# $CVSHeader: webwork2/lib/WeBWorK/Authen/Cosign.pm,v 1.2 2007/03/27 17:06:04 glarose Exp $
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of either: (a) the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version, or (b) the "Artistic License" which comes with this package.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the
# Artistic License for more details.
################################################################################
package WeBWorK::Authen::Cosign;
use base qw/WeBWorK::Authen/;
=head1 NAME
WeBWorK::Authen::Cosign - Authentication plug in for cosign
to use: include in localOverrides.conf or course.conf
$authen{user_module} = "WeBWorK::Authen::Cosign";
and add /webwork2 or /webwork2/courseName as a CosignProtected
Location
if $r->ce->{cosignoff} is set for a course, authentication reverts
to standard WeBWorK authentication.
=cut
use strict;
use warnings;
use WeBWorK::Debug;
# this is similar to the method in the base class, except that cosign
# ensures that we don't get to the address without a login. this means
# that we can't allow guest logins, but don't have to do any password
# checking or cookie management.
sub get_credentials {
my ($self) = @_;
my $r = $self->{r};
my $ce = $r->ce;
my $db = $r->db;
if ( $ce->{cosignoff} ) {
return $self->SUPER::get_credentials( );
} else {
if ( defined( $ENV{'REMOTE_USER'} ) ) {
$self->{'user_id'} = $ENV{'REMOTE_USER'};
$self->{r}->param("user", $ENV{'REMOTE_USER'});
} else {
return 0;
}
# set external auth parameter so that Login.pm knows
# not to rely on internal logins if there's a check_user
# failure.
$self->{external_auth} = 1;
# the session key isn't used (cosign is managing this
# for us), and we want to force checking against the
# site_checkPassword
$self->{'session_key'} = undef;
$self->{'password'} = 1;
$self->{'credential_source'} = "params";
$self->{login_type} = "cosign";
return 1;
}
}
sub site_checkPassword {
my ( $self, $userID, $clearTextPassword ) = @_;
if ( $self->{r}->ce->{cosignoff} ) {
return 0;
#return $self->SUPER::checkPassword( $userID, $clearTextPassword );
} else {
# this is easy; if we're here at all, we've authenticated
# through cosign
return 1;
}
}
# disable cookie functionality
sub maybe_send_cookie {
my ($self, @args) = @_;
if ( $self->{r}->ce->{cosignoff} ) {
return $self->SUPER::maybe_send_cookie( @args );
} else {
# nothing to do here
}
}
sub fetchCookie {
my ($self, @args) = @_;
if ( $self->{r}->ce->{cosignoff} ) {
return $self->SUPER::fetchCookie( @args );
} else {
# nothing to do here
}
}
sub sendCookie {
my ($self, @args) = @_;
if ( $self->{r}->ce->{cosignoff} ) {
return $self->SUPER::sendCookie( @args);
} else {
# nothing to do here
}
}
sub killCookie {
my ($self, @args) = @_;
if ( $self->{r}->ce->{cosignoff} ) {
return $self->SUPER::killCookie( @args );
} else {
# nothing to do here
}
}
# this is a bit of a cheat, because it does the redirect away from the
# logout script or what have you, but I don't see a way around that.
sub forget_verification {
my ($self, @args) = @_;
my $r = $self->{r};
if ( $r->ce->{cosignoff} ) {
return $self->SUPER::forget_verification( @args);
} else {
$self->{was_verified} = 0;
# $r->headers_out->{"Location"} = $r->ce->{cosign_logout_script};
# $r->send_http_header;
# return;
$self->{redirect} = $r->ce->{cosign_logout_script};
}
}
1;
| 28.528571 | 91 | 0.638958 |
ed0cdfcdf50be52094bcbccde83f5dbc9f8a6a84 | 4,631 | pl | Perl | Aula 7/swipl/xpce/prolog/lib/emacs/html_mode.pl | FunkyCracky/good_owly_stuff | c56c1897d85724982da531d04ed6b310c0464098 | [
"MIT"
]
| null | null | null | Aula 7/swipl/xpce/prolog/lib/emacs/html_mode.pl | FunkyCracky/good_owly_stuff | c56c1897d85724982da531d04ed6b310c0464098 | [
"MIT"
]
| null | null | null | Aula 7/swipl/xpce/prolog/lib/emacs/html_mode.pl | FunkyCracky/good_owly_stuff | c56c1897d85724982da531d04ed6b310c0464098 | [
"MIT"
]
| 1 | 2021-05-09T15:32:17.000Z | 2021-05-09T15:32:17.000Z | /* Part of XPCE --- The SWI-Prolog GUI toolkit
Author: Jan Wielemaker and Anjo Anjewierden
E-mail: jan@swi.psy.uva.nl
WWW: http://www.swi.psy.uva.nl/projects/xpce/
Copyright (c) 2000-2012, University of Amsterdam
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
:- module(emacs_html_mode, []).
:- use_module(library(pce)).
:- require([ send_list/3
]).
:- op(100, fx, #). % `DTD' attributes
:- op(100, fy, *).
:- op(100, fy, ?).
:- op(100, fy, +).
:- pce_global(@html_paragraph_end_regex,
make_parent_regex).
make_parent_regex(R) :-
findall(P, par(P), Ps),
atomic_list_concat(Ps, '|', P0),
atomic_list_concat(['\\s*(\n|<(', P0, '))'], P1),
new(R, regex(P1)),
send(R, ignore_case, @on).
par('h[1-4]').
par('dl').
par('ul').
par('ol').
par('li').
par('dt').
par('tr').
par('p').
par('hr').
par('table').
par('blockquote').
:- emacs_begin_mode(html, language,
"Mode for editing HTML documents",
[ open_document = key('\\C-c\\C-o') + button('HTML')
],
[ '<' = open_bracket('>'),
paragraph_end(@html_paragraph_end_regex)
]).
:- pce_global(@html_end_element_regex, new(regex('</\\(\\w+\\)[^>]*>'))).
setup_mode(E) :->
"Switch editor into fill-mode"::
send(E, fill_mode, @on).
/*******************************
* DOCUMENT *
*******************************/
open_document(M) :->
"Insert document header"::
send(M, format,
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">\n\n'),
send(M, make_element, html),
send(M, make_element, head),
send(M, make_element, title),
get(M, caret, Caret),
send(M, out), % out of the title
send(M, out), % out of the head
send(M, make_element, body),
send(M, out), % hack
send(M, format, '\n'),
send(M, caret, Caret).
/*******************************
* ELEMENTS *
*******************************/
make_element(M, E:name) :->
"Insert element at location"::
( cdata_element(E)
-> send(M, format, '<%s>', E),
get(M, caret, Caret),
send(M, format, '</%s>', E)
; send(M, format, '<%s>\n', E),
get(M, caret, Caret),
send(M, format, '\n</%s>', E)
),
send(M, caret, Caret).
out(M) :->
"Get to the end of this element"::
get(M, text_buffer, TB),
get(M, caret, Caret),
get(@html_end_element_regex, search, TB, Caret, _Start),
get(@html_end_element_regex, register_end, 0, End),
send(M, caret, End),
( send(M, looking_at, '\\s *$')
-> send(M, forward_char)
; true
).
/*******************************
* ELEMENT DEFS *
*******************************/
cdata_element(E) :-
element(E, Content, _Attributes),
memberchk(#cdata, Content),
!.
element(html, [head, body], []).
element(head, [title, meta*], []).
element(body, [], []).
element(title, [#cdata], []).
:- emacs_end_mode.
| 31.719178 | 76 | 0.541784 |
ed1a0e8acbdec0c84ff61629d00ec2a80fb24fe3 | 997 | t | Perl | integration/failure-and-callsame.t | jmaslak/roast | d69446499800e7cb274c0c240691a8199e69b22c | [
"Artistic-2.0"
]
| 1 | 2019-11-06T05:07:10.000Z | 2019-11-06T05:07:10.000Z | integration/failure-and-callsame.t | jmaslak/roast | d69446499800e7cb274c0c240691a8199e69b22c | [
"Artistic-2.0"
]
| null | null | null | integration/failure-and-callsame.t | jmaslak/roast | d69446499800e7cb274c0c240691a8199e69b22c | [
"Artistic-2.0"
]
| null | null | null | use Test;
# This test covers a nasty once-bug involving callsame and Failure, where the
# finalization of Failure could steal the target of a callsame and so lead to
# delegation not taking place. Golfed from a bug report on OO::Monitors, which
# turned out to be a bug in Rakudo. This at the time of adding it would fail
# even without any GC stress applied provided a decent number of iterations
# are done (thus the 50 repetitions; it relies on unfortunate timing).
plan 50;
class Grid {
has @.grid;
method change-cell($x, $s) {
@!grid[$x] = $s;
}
}
my $leaving = 0;
Grid.^lookup('change-cell').wrap(-> \SELF, | {
LEAVE ++$leaving;
callsame
});
my $grid = Grid.new();
for ^50 {
$grid.grid = 'BUG' xx 100;
for ^(100 div 2) -> $x {
Failure.new() // ''; # Triggered glitches
$grid.change-cell($x * 2, 'a');
$grid.change-cell($x * 2 + 1, 'b');
}
ok $grid.grid.join !~~ /BUG/, 'callsame + Failure glitch not observed';
}
| 27.694444 | 78 | 0.626881 |
73f05caac59c1e512ad3699bb35ef20b074f03f4 | 557 | pm | Perl | perl/vendor/lib/Moose/Meta/Method/Accessor/Native/Array/elements.pm | mnikolop/Thesis_project_CyberDoc | 9a37fdd5a31de24cb902ee31ef19eb992faa1665 | [
"Apache-2.0"
]
| 4 | 2018-04-20T07:27:13.000Z | 2021-12-21T05:19:24.000Z | perl/vendor/lib/Moose/Meta/Method/Accessor/Native/Array/elements.pm | mnikolop/Thesis_project_CyberDoc | 9a37fdd5a31de24cb902ee31ef19eb992faa1665 | [
"Apache-2.0"
]
| 4 | 2021-03-10T19:10:00.000Z | 2021-05-11T14:58:19.000Z | perl/vendor/lib/Moose/Meta/Method/Accessor/Native/Array/elements.pm | mnikolop/Thesis_project_CyberDoc | 9a37fdd5a31de24cb902ee31ef19eb992faa1665 | [
"Apache-2.0"
]
| 1 | 2019-11-12T02:29:26.000Z | 2019-11-12T02:29:26.000Z | package Moose::Meta::Method::Accessor::Native::Array::elements;
BEGIN {
$Moose::Meta::Method::Accessor::Native::Array::elements::AUTHORITY = 'cpan:STEVAN';
}
{
$Moose::Meta::Method::Accessor::Native::Array::elements::VERSION = '2.0604';
}
use strict;
use warnings;
use Moose::Role;
with 'Moose::Meta::Method::Accessor::Native::Reader' =>
{ -excludes => ['_maximum_arguments'] };
sub _maximum_arguments { 0 }
sub _return_value {
my $self = shift;
my ($slot_access) = @_;
return '@{ (' . $slot_access . ') }';
}
no Moose::Role;
1;
| 19.206897 | 85 | 0.642729 |
73f2f746d4e09cd4bf201439fec8a932de67a4b1 | 917 | t | Perl | YDR418W_YEL054C_estimatedTau_Noinitial/IGCgeo_50.0/sim_56/2NG.t | xji3/IGCCodonSimulation | 2daf1e566ec01eb6c59693d5758be7db91edc57b | [
"MIT"
]
| null | null | null | YDR418W_YEL054C_estimatedTau_Noinitial/IGCgeo_50.0/sim_56/2NG.t | xji3/IGCCodonSimulation | 2daf1e566ec01eb6c59693d5758be7db91edc57b | [
"MIT"
]
| null | null | null | YDR418W_YEL054C_estimatedTau_Noinitial/IGCgeo_50.0/sim_56/2NG.t | xji3/IGCCodonSimulation | 2daf1e566ec01eb6c59693d5758be7db91edc57b | [
"MIT"
]
| null | null | null | 13
castelliiYDR418W
castelliiYEL054C 0.2325
mikataeYDR418W 0.5180 0.5547
mikataeYEL054C 0.4560 0.4409 0.4028
kluyveriYDR418W 0.3560 0.3710 0.6047 0.5113
paradoxusYDR418W 0.4649 0.4856 0.1725 0.3097 0.5047
paradoxusYEL054C 0.4642 0.4490 0.4410 0.0941 0.4920 0.3023
kudriavzeviiYDR418W 0.5358 0.5490 0.2747 0.4637 0.6119 0.2884 0.5036
kudriavzeviiYEL054C 0.4977 0.4952 0.4484 0.2054 0.5549 0.3677 0.2261 0.4963
bayanusYDR418W 0.4053 0.4475 0.1925 0.3589 0.4938 0.1989 0.3962 0.2066 0.3737
bayanusYEL054C 0.3900 0.3668 0.3883 0.1262 0.4178 0.3096 0.1458 0.4343 0.1656 0.2608
cerevisiaeYDR418W 0.5239 0.5617 0.1526 0.3874 0.5925 0.1459 0.4245 0.2877 0.4622 0.2191 0.3877
cerevisiaeYEL054C 0.4864 0.4715 0.4325 0.0876 0.5430 0.3373 0.0813 0.5092 0.2325 0.4024 0.1523 0.4021
| 61.133333 | 117 | 0.653217 |
73f59d9130bfe461180e186580487c7230641b71 | 182 | pm | Perl | auto-lib/Azure/CognitiveCustomVision/ProjectSettings.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/CognitiveCustomVision/ProjectSettings.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| null | null | null | auto-lib/Azure/CognitiveCustomVision/ProjectSettings.pm | pplu/azure-sdk-perl | 26cbef2d926f571bc1617c26338c106856f95568 | [
"Apache-2.0"
]
| 1 | 2021-04-08T15:26:39.000Z | 2021-04-08T15:26:39.000Z | package Azure::CognitiveCustomVision::ProjectSettings;
use Moose;
has 'classificationType' => (is => 'ro', isa => 'Str' );
has 'domainId' => (is => 'ro', isa => 'Str' );
1;
| 26 | 59 | 0.598901 |
ed1c3a5b7e3ad3973404f9e1a76f5c4b2be2bccb | 11,210 | t | Perl | src/couch_set_view/test/20-debug-params.t | bryandmc/couchdb | b7df92caa359993bd7e785e49875e6c5c82d5eaf | [
"Apache-2.0"
]
| 93 | 2015-01-19T16:36:36.000Z | 2022-03-24T00:26:33.000Z | src/couch_set_view/test/20-debug-params.t | bryandmc/couchdb | b7df92caa359993bd7e785e49875e6c5c82d5eaf | [
"Apache-2.0"
]
| 4 | 2015-04-27T00:01:05.000Z | 2021-07-26T08:16:56.000Z | src/couch_set_view/test/20-debug-params.t | bryandmc/couchdb | b7df92caa359993bd7e785e49875e6c5c82d5eaf | [
"Apache-2.0"
]
| 62 | 2015-01-04T13:07:15.000Z | 2022-02-25T10:02:14.000Z | #!/usr/bin/env escript
%% -*- Mode: Erlang; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
%%! -smp enable
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
% the License.
-include("../../couchdb/couch_db.hrl").
-include_lib("couch_set_view/include/couch_set_view.hrl").
-define(etap_match(Got, Expected, Desc),
etap:fun_is(fun(XXXXXX) ->
case XXXXXX of Expected -> true; _ -> false end
end, Got, Desc)).
-define(MAX_WAIT_TIME, 10 * 1000).
test_set_name() -> <<"couch_test_set_index_debug_params">>.
num_set_partitions() -> 64.
ddoc_id() -> <<"_design/test">>.
num_docs() -> 1024. % keep it a multiple of num_set_partitions()
main(_) ->
test_util:init_code_path(),
etap:plan(16),
case (catch test()) of
ok ->
etap:end_tests();
Other ->
etap:diag(io_lib:format("Test died abnormally: ~p", [Other])),
etap:bail(Other)
end,
ok.
test() ->
couch_set_view_test_util:start_server(test_set_name()),
etap:diag("Testing debug parameters"),
test_filter_parameter_main(erlang),
test_filter_parameter_replica(erlang),
test_filter_parameter_main(http),
test_filter_parameter_replica(http),
couch_set_view_test_util:stop_server(),
ok.
setup_test() ->
couch_set_view_test_util:delete_set_dbs(test_set_name(), num_set_partitions()),
couch_set_view_test_util:create_set_dbs(test_set_name(), num_set_partitions()),
DDoc = {[
{<<"meta">>, {[{<<"id">>, ddoc_id()}]}},
{<<"json">>, {[
{<<"views">>, {[
{<<"test">>, {[
{<<"map">>, <<"function(doc, meta) { emit(meta.id, doc.value); }">>}
]}},
{<<"testred">>, {[
{<<"map">>, <<"function(doc, meta) { emit(meta.id, doc.value); }">>},
{<<"reduce">>, <<"_count">>}
]}}
]}}
]}}
]},
populate_set(DDoc).
test_filter_parameter_main(AccessType) ->
setup_test(),
% There are 75% active, 12.5% passive and 12.5% cleanup partitions
ok = configure_view_group(ddoc_id(), lists:seq(0, 47), lists:seq(48, 55),
lists:seq(56, 63)),
{ok, Rows} = (catch query_map_view(AccessType, <<"test">>, main, true)),
etap:is(length(Rows), (num_docs()) * 0.75,
"Map view query returned all rows from active partitions"),
{ok, Rows2} = (catch query_map_view(AccessType, <<"test">>, main, false)),
etap:is(length(Rows2), num_docs(),
"Map view query queried with _filter=false returns all "
"partitions"),
% The same, but with a reduce function
{ok, RowsRed} = (catch query_reduce_view(
AccessType, <<"testred">>, main, true)),
etap:is(RowsRed, (num_docs()) * 0.75,
"Reduce view query returned all rows from active partitions"),
{ok, RowsRed2} = (catch query_reduce_view(
AccessType, <<"testred">>, main, false)),
etap:is(RowsRed2, num_docs(),
"Reduce view query queried with _filter=false returns all "
"partitions"),
GroupPid = get_main_pid(),
couch_set_view_test_util:wait_for_updater_to_finish(GroupPid, ?MAX_WAIT_TIME),
shutdown_group().
test_filter_parameter_replica(AccessType) ->
setup_test(),
ok = configure_view_group(ddoc_id(), lists:seq(0, 47), [], []),
ok = couch_set_view:add_replica_partitions(
mapreduce_view, test_set_name(), ddoc_id(), lists:seq(48, 63)),
% There are 75% main and 25% replica partitions, from the replica
% partitions are 87.5% active and 12.5% passive
ok = configure_replica_group(ddoc_id(), lists:seq(48, 61),
lists:seq(62, 63)),
{ok, Rows} = (catch query_map_view(
AccessType, <<"test">>, replica, true)),
etap:is(length(Rows), (num_docs() * 0.25) * 0.125,
"Replica map view query returned all rows from "
"passive partitions"),
{ok, Rows2} = (catch query_map_view(
AccessType, <<"test">>, replica, false)),
% There are 75% main and 25% replica partitions
etap:is(length(Rows2), (num_docs()) * 0.25,
"Replica map view query queried with _filter=false returns all "
"partitions"),
% The same, but with a reduce function
{ok, RowsRed} = (catch query_reduce_view(
AccessType, <<"testred">>, replica, true)),
etap:is(RowsRed, (num_docs() * 0.25) * 0.125,
"Replica reduce view query returned all rows from passive partitions"),
{ok, RowsRed2} = (catch query_reduce_view(
AccessType, <<"testred">>, replica, false)),
% There are 75% active and 25% replica partitions
etap:is(RowsRed2, (num_docs()) * 0.25,
"Replica reduce view query queried with _filter=false returns all "
"partitions"),
GroupPid = get_replica_pid(),
couch_set_view_test_util:wait_for_updater_to_finish(GroupPid, ?MAX_WAIT_TIME),
shutdown_group().
shutdown_group() ->
GroupPid = couch_set_view:get_group_pid(
mapreduce_view, test_set_name(), ddoc_id(), prod),
couch_set_view_test_util:delete_set_dbs(test_set_name(), num_set_partitions()),
MonRef = erlang:monitor(process, GroupPid),
receive
{'DOWN', MonRef, _, _, _} ->
ok
after 10000 ->
etap:bail("Timeout waiting for group shutdown")
end.
query_map_view(erlang, ViewName, Type, Filter) ->
query_map_view_erlang(ViewName, Type, Filter);
query_map_view(http, ViewName, Type, Filter) ->
query_map_view_http(ViewName, Type, Filter).
query_map_view_erlang(ViewName, Type, Filter) ->
etap:diag("Querying map view " ++ binary_to_list(ddoc_id()) ++ "/" ++
binary_to_list(ViewName)),
Req = #set_view_group_req{
stale = false,
type = Type
},
{ok, View, Group, _} = couch_set_view:get_map_view(
test_set_name(), ddoc_id(), ViewName, Req),
FoldFun = fun({{Key, DocId}, {_PartId, Value}}, _, Acc) ->
{ok, [{{Key, DocId}, Value} | Acc]}
end,
ViewArgs = #view_query_args{
run_reduce = true,
view_name = ViewName,
filter = Filter
},
{ok, _, Rows} = couch_set_view:fold(Group, View, FoldFun, [], ViewArgs),
couch_set_view:release_group(Group),
{ok, Rows}.
query_map_view_http(ViewName, Type, Filter) ->
etap:diag("Querying map view " ++ binary_to_list(ddoc_id()) ++ "/" ++
binary_to_list(ViewName) ++ " through HTTP"),
QueryString = "_filter=" ++ atom_to_list(Filter) ++
"&_type=" ++ atom_to_list(Type),
{ok, {ViewResults}} = couch_set_view_test_util:query_view(
test_set_name(), ddoc_id(), ViewName, QueryString),
Rows = couch_util:get_value(<<"rows">>, ViewResults),
{ok, Rows}.
query_reduce_view(erlang, ViewName, Type, Filter) ->
query_reduce_view_erlang(ViewName, Type, Filter);
query_reduce_view(http, ViewName, Type, Filter) ->
query_reduce_view_http(ViewName, Type, Filter).
query_reduce_view_erlang(ViewName, Type, Filter) ->
etap:diag("Querying reduce view " ++ binary_to_list(ddoc_id()) ++ "/" ++
binary_to_list(ViewName) ++ "with ?group=true"),
Req = #set_view_group_req{
stale = false,
type = Type
},
{ok, View, Group, _} = couch_set_view:get_reduce_view(
test_set_name(), ddoc_id(), ViewName, Req),
FoldFun = fun(Key, {json, Red}, Acc) ->
{ok, [{Key, ejson:decode(Red)} | Acc]}
end,
ViewArgs = #view_query_args{
run_reduce = true,
view_name = ViewName,
filter = Filter
},
{ok, Rows} = couch_set_view:fold_reduce(Group, View, FoldFun, [], ViewArgs),
couch_set_view:release_group(Group),
case Rows of
[{_Key, RedValue}] ->
{ok, RedValue};
[] ->
empty
end.
query_reduce_view_http(ViewName, Type, Filter) ->
etap:diag("Querying reduce view " ++ binary_to_list(ddoc_id()) ++ "/" ++
binary_to_list(ViewName) ++ "with through HTTP"),
QueryString = "_filter=" ++ atom_to_list(Filter) ++
"&_type=" ++ atom_to_list(Type),
{ok, {ViewResults}} = couch_set_view_test_util:query_view(
test_set_name(), ddoc_id(), ViewName, QueryString),
Rows = couch_util:get_value(<<"rows">>, ViewResults),
[{[_Key, {<<"value">>, RedValue}]}] = Rows,
{ok, RedValue}.
populate_set(DDoc) ->
etap:diag("Populating the " ++ integer_to_list(num_set_partitions()) ++
" databases with " ++ integer_to_list(num_docs()) ++ " documents"),
ok = couch_set_view_test_util:update_ddoc(test_set_name(), DDoc),
DocList = lists:map(
fun(I) ->
{[
{<<"meta">>, {[{<<"id">>, iolist_to_binary(["doc", integer_to_list(I)])}]}},
{<<"json">>, {[{<<"value">>, I}]}}
]}
end,
lists:seq(1, num_docs())),
ok = couch_set_view_test_util:populate_set_sequentially(
test_set_name(),
lists:seq(0, num_set_partitions() - 1),
DocList).
configure_view_group(DDocId, Active, Passive, Cleanup) ->
etap:diag("Configuring view group"),
Params = #set_view_params{
max_partitions = num_set_partitions(),
% Set all partitions to active an later on passive/cleanup
active_partitions = lists:seq(0, num_set_partitions()-1),
passive_partitions = [],
use_replica_index = true
},
try
couch_set_view:define_group(
mapreduce_view, test_set_name(), DDocId, Params),
GroupPid = couch_set_view:get_group_pid(
mapreduce_view, test_set_name(), ddoc_id(), prod),
ok = gen_server:call(GroupPid, {set_auto_cleanup, false}, infinity),
% Somehow the set_auto_cleanup doesn't get set when I don't request
% the group afterwards
Req = #set_view_group_req{stale = false},
{ok, _Group} = couch_set_view:get_group(
mapreduce_view, test_set_name(), DDocId, Req),
couch_set_view_group:set_state(GroupPid, Active, Passive, Cleanup)
catch _:Error ->
Error
end.
configure_replica_group(DDocId, Active, Passive) ->
etap:diag("Configuring replica group"),
Req = #set_view_group_req{stale = false},
{ok, Group} = couch_set_view:get_group(
mapreduce_view, test_set_name(), DDocId, Req),
couch_set_view_group:set_state(
Group#set_view_group.replica_pid, Active, Passive, []),
couch_set_view:release_group(Group).
get_main_pid() ->
couch_set_view:get_group_pid(
mapreduce_view, test_set_name(), ddoc_id(), prod).
get_replica_pid() ->
MainPid = get_main_pid(),
{ok, Group} = gen_server:call(MainPid, request_group, infinity),
Group#set_view_group.replica_pid.
| 35.251572 | 92 | 0.626405 |
73de424315aac94a8c80f522c5df522ee631c11e | 1,304 | t | Perl | t/01_connection.t | campaignmonitor/createsend-perl | 5d0a41ab7631551ba14b3c1de48a8b6b391a5b5d | [
"MIT"
]
| null | null | null | t/01_connection.t | campaignmonitor/createsend-perl | 5d0a41ab7631551ba14b3c1de48a8b6b391a5b5d | [
"MIT"
]
| 1 | 2016-07-12T05:49:40.000Z | 2016-07-12T05:49:40.000Z | t/01_connection.t | campaignmonitor/createsend-perl | 5d0a41ab7631551ba14b3c1de48a8b6b391a5b5d | [
"MIT"
]
| null | null | null | #!/usr/bin/perl
use strict;
use Test::More;
use Params::Util qw{_STRING};
if ( Params::Util::_STRING($ENV{'CAMPAIGN_MONITOR_API_KEY'}) ) {
my $api_key = $ENV{'CAMPAIGN_MONITOR_API_KEY'};
plan tests => 9;
use_ok( 'Net::CampaignMonitor' );
my $cm_secure_apikey = Net::CampaignMonitor->new({
secure => 1,
api_key => $api_key,
});
my $cm_insecure_apikey = Net::CampaignMonitor->new({
secure => 0,
api_key => $api_key,
});
my $cm_secure = Net::CampaignMonitor->new({
secure => 1,
});
my $cm_insecure = Net::CampaignMonitor->new({
secure => 0,
});
my $cm_flat = Net::CampaignMonitor->new(
secure => 0,
);
isa_ok( $cm_secure_apikey, 'Net::CampaignMonitor' );
isa_ok( $cm_insecure_apikey, 'Net::CampaignMonitor' );
isa_ok( $cm_secure, 'Net::CampaignMonitor' );
isa_ok( $cm_insecure, 'Net::CampaignMonitor' );
isa_ok( $cm_flat, 'Net::CampaignMonitor' );
my $results = $cm_secure_apikey->account_clients();
ok( Params::Util::_POSINT( $results->{code} ), 'Result code' );
ok( Params::Util::_HASH( $results->{headers} ), 'Result headers' );
ok( Params::Util::_ARRAY0( $results->{response} ), 'Result response' );
} else {
plan tests => 1;
use_ok( 'Net::CampaignMonitor' );
} | 25.568627 | 74 | 0.611963 |
73f77af271eaa41142e598974e06a5087d9954a2 | 6,005 | pl | Perl | perl/lib/unicore/lib/WB/LE.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | perl/lib/unicore/lib/WB/LE.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | perl/lib/unicore/lib/WB/LE.pl | DDMoReFoundation/PortableNonmem | 7e40b30887537f24fed12421935b58325ba2e5c3 | [
"BSD-3-Clause-Clear"
]
| null | null | null | # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by mktables from the Unicode
# database, Version 6.3.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
return <<'END';
V840
65
91
97
123
170
171
181
182
186
187
192
215
216
247
248
706
710
722
736
741
748
749
750
751
880
885
886
888
890
894
902
903
904
907
908
909
910
930
931
1014
1015
1154
1162
1320
1329
1367
1369
1370
1377
1416
1523
1524
1568
1611
1646
1648
1649
1748
1749
1750
1765
1767
1774
1776
1786
1789
1791
1792
1808
1809
1810
1840
1869
1958
1969
1970
1994
2027
2036
2038
2042
2043
2048
2070
2074
2075
2084
2085
2088
2089
2112
2137
2208
2209
2210
2221
2308
2362
2365
2366
2384
2385
2392
2402
2417
2424
2425
2432
2437
2445
2447
2449
2451
2473
2474
2481
2482
2483
2486
2490
2493
2494
2510
2511
2524
2526
2527
2530
2544
2546
2565
2571
2575
2577
2579
2601
2602
2609
2610
2612
2613
2615
2616
2618
2649
2653
2654
2655
2674
2677
2693
2702
2703
2706
2707
2729
2730
2737
2738
2740
2741
2746
2749
2750
2768
2769
2784
2786
2821
2829
2831
2833
2835
2857
2858
2865
2866
2868
2869
2874
2877
2878
2908
2910
2911
2914
2929
2930
2947
2948
2949
2955
2958
2961
2962
2966
2969
2971
2972
2973
2974
2976
2979
2981
2984
2987
2990
3002
3024
3025
3077
3085
3086
3089
3090
3113
3114
3124
3125
3130
3133
3134
3160
3162
3168
3170
3205
3213
3214
3217
3218
3241
3242
3252
3253
3258
3261
3262
3294
3295
3296
3298
3313
3315
3333
3341
3342
3345
3346
3387
3389
3390
3406
3407
3424
3426
3450
3456
3461
3479
3482
3506
3507
3516
3517
3518
3520
3527
3840
3841
3904
3912
3913
3949
3976
3981
4256
4294
4295
4296
4301
4302
4304
4347
4348
4681
4682
4686
4688
4695
4696
4697
4698
4702
4704
4745
4746
4750
4752
4785
4786
4790
4792
4799
4800
4801
4802
4806
4808
4823
4824
4881
4882
4886
4888
4955
4992
5008
5024
5109
5121
5741
5743
5760
5761
5787
5792
5867
5870
5873
5888
5901
5902
5906
5920
5938
5952
5970
5984
5997
5998
6001
6176
6264
6272
6313
6314
6315
6320
6390
6400
6429
6656
6679
6917
6964
6981
6988
7043
7073
7086
7088
7098
7142
7168
7204
7245
7248
7258
7294
7401
7405
7406
7410
7413
7415
7424
7616
7680
7958
7960
7966
7968
8006
8008
8014
8016
8024
8025
8026
8027
8028
8029
8030
8031
8062
8064
8117
8118
8125
8126
8127
8130
8133
8134
8141
8144
8148
8150
8156
8160
8173
8178
8181
8182
8189
8305
8306
8319
8320
8336
8349
8450
8451
8455
8456
8458
8468
8469
8470
8473
8478
8484
8485
8486
8487
8488
8489
8490
8494
8495
8506
8508
8512
8517
8522
8526
8527
8544
8585
9398
9450
11264
11311
11312
11359
11360
11493
11499
11503
11506
11508
11520
11558
11559
11560
11565
11566
11568
11624
11631
11632
11648
11671
11680
11687
11688
11695
11696
11703
11704
11711
11712
11719
11720
11727
11728
11735
11736
11743
11823
11824
12293
12294
12347
12349
12549
12590
12593
12687
12704
12731
40960
42125
42192
42238
42240
42509
42512
42528
42538
42540
42560
42607
42623
42648
42656
42736
42775
42784
42786
42889
42891
42895
42896
42900
42912
42923
43000
43010
43011
43014
43015
43019
43020
43043
43072
43124
43138
43188
43250
43256
43259
43260
43274
43302
43312
43335
43360
43389
43396
43443
43471
43472
43520
43561
43584
43587
43588
43596
43744
43755
43762
43765
43777
43783
43785
43791
43793
43799
43808
43815
43816
43823
43968
44003
44032
55204
55216
55239
55243
55292
64256
64263
64275
64280
64336
64434
64467
64830
64848
64912
64914
64968
65008
65020
65136
65141
65142
65277
65313
65339
65345
65371
65440
65471
65474
65480
65482
65488
65490
65496
65498
65501
65536
65548
65549
65575
65576
65595
65596
65598
65599
65614
65616
65630
65664
65787
65856
65909
66176
66205
66208
66257
66304
66335
66352
66379
66432
66462
66464
66500
66504
66512
66513
66518
66560
66718
67584
67590
67592
67593
67594
67638
67639
67641
67644
67645
67647
67670
67840
67862
67872
67898
67968
68024
68030
68032
68096
68097
68112
68116
68117
68120
68121
68148
68192
68221
68352
68406
68416
68438
68448
68467
68608
68681
69635
69688
69763
69808
69840
69865
69891
69927
70019
70067
70081
70085
71296
71339
73728
74607
74752
74851
77824
78895
92160
92729
93952
94021
94032
94033
94099
94112
119808
119893
119894
119965
119966
119968
119970
119971
119973
119975
119977
119981
119982
119994
119995
119996
119997
120004
120005
120070
120071
120075
120077
120085
120086
120093
120094
120122
120123
120127
120128
120133
120134
120135
120138
120145
120146
120486
120488
120513
120514
120539
120540
120571
120572
120597
120598
120629
120630
120655
120656
120687
120688
120713
120714
120745
120746
120771
120772
120780
126464
126468
126469
126496
126497
126499
126500
126501
126503
126504
126505
126515
126516
126520
126521
126522
126523
126524
126530
126531
126535
126536
126537
126538
126539
126540
126541
126544
126545
126547
126548
126549
126551
126552
126553
126554
126555
126556
126557
126558
126559
126560
126561
126563
126564
126565
126567
126571
126572
126579
126580
126584
126585
126589
126590
126591
126592
126602
126603
126620
126625
126628
126629
126634
126635
126652
END
| 7.023392 | 78 | 0.692423 |
73d3a48451b4d4da60182592ae263ad98de1b667 | 1,412 | t | Perl | t/35-NSEC3-match.t | kjpye/P5-Net-DNS | d875f156961c61a3161d3946e0ade368d8034831 | [
"Unlicense"
]
| null | null | null | t/35-NSEC3-match.t | kjpye/P5-Net-DNS | d875f156961c61a3161d3946e0ade368d8034831 | [
"Unlicense"
]
| null | null | null | t/35-NSEC3-match.t | kjpye/P5-Net-DNS | d875f156961c61a3161d3946e0ade368d8034831 | [
"Unlicense"
]
| null | null | null | # $Id: 35-NSEC3-match.t 1389 2015-09-09 13:09:43Z willem $ -*-perl-*-
#
use strict;
use Test::More;
use Net::DNS;
my @prerequisite = qw(
Digest::SHA
Net::DNS::RR::NSEC3;
);
foreach my $package (@prerequisite) {
next if eval "require $package";
plan skip_all => "$package not installed";
exit;
}
plan tests => 10;
my $algorithm = 1; ## test vectors from RFC5155
my $flags = 0;
my $iteration = 12;
my $salt = 'aabbccdd';
my $hnxtname = 'irrelevent';
my @name = qw(example a.example ai.example ns1.example ns2.example
w.example *.w.example x.w.example y.w.example x.y.w.example);
my %testcase = (
'example' => '0p9mhaveqvm6t7vbl5lop2u3t2rp3tom',
'a.example' => '35mthgpgcu1qg68fab165klnsnk3dpvl',
'ai.example' => 'gjeqe526plbf1g8mklp59enfd789njgi',
'ns1.example' => '2t7b4g4vsa5smi47k61mv5bv1a22bojr',
'ns2.example' => 'q04jkcevqvmu85r014c7dkba38o0ji5r',
'w.example' => 'k8udemvp1j2f7eg6jebps17vp3n8i58h',
'*.w.example' => 'r53bq7cc2uvmubfu5ocmm6pers9tk9en',
'x.w.example' => 'b4um86eghhds6nea196smvmlo4ors995',
'y.w.example' => 'ji6neoaepv8b5o6k4ev33abha8ht9fgc',
'x.y.w.example' => '2vptu5timamqttgl4luu9kg21e0aor3s',
);
foreach my $name (@name) {
my $hash = $testcase{$name};
my @args = ( $algorithm, $flags, $iteration, $salt, $hnxtname );
my $nsec3 = new Net::DNS::RR("$hash.example. NSEC3 @args");
ok( $nsec3->match($name), "nsec3->match($name)" );
}
exit;
| 26.148148 | 69 | 0.679887 |
73f1a737411a034f586ddd9c8c6190b524b8e4dc | 85 | t | Perl | t/01-basic.t | mudler/p5-Deeme | 108a1ccd4e1b124298a041c14286ca2f5c677900 | [
"Artistic-1.0"
]
| null | null | null | t/01-basic.t | mudler/p5-Deeme | 108a1ccd4e1b124298a041c14286ca2f5c677900 | [
"Artistic-1.0"
]
| null | null | null | t/01-basic.t | mudler/p5-Deeme | 108a1ccd4e1b124298a041c14286ca2f5c677900 | [
"Artistic-1.0"
]
| null | null | null | use strict;
use Test::More;
use_ok($_) for qw(Deeme Deeme::Watcher);
done_testing;
| 12.142857 | 40 | 0.717647 |
ed1b9359ab3fb75598256a814187f8d4a555e0cc | 24,372 | pm | Perl | modules/Bio/EnsEMBL/Analysis/Hive/RunnableDB/HiveVegaChecks.pm | Niaz-lab-ux/ensembl-analysis | 210d98d521141d607fa76f5f1634e72b926b7f9a | [
"Apache-2.0"
]
| 8 | 2016-05-03T04:43:32.000Z | 2021-12-13T16:48:00.000Z | modules/Bio/EnsEMBL/Analysis/Hive/RunnableDB/HiveVegaChecks.pm | Niaz-lab-ux/ensembl-analysis | 210d98d521141d607fa76f5f1634e72b926b7f9a | [
"Apache-2.0"
]
| 88 | 2015-12-15T14:20:33.000Z | 2022-03-31T09:01:27.000Z | modules/Bio/EnsEMBL/Analysis/Hive/RunnableDB/HiveVegaChecks.pm | Niaz-lab-ux/ensembl-analysis | 210d98d521141d607fa76f5f1634e72b926b7f9a | [
"Apache-2.0"
]
| 33 | 2015-03-05T14:44:32.000Z | 2021-09-08T11:42:37.000Z | # Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2020] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Usage examples:
# Generic:
# standaloneJob.pl Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveVegaChecks -dbname my_vega_after_merge -dbhost genebuild1 -dnadbname my_dna_db -dnadbhost genebuild1 -dnadbport 3306 -port 3306 -user ensro -coord_system toplevel -path Zv9 [-chromosome 13] [-user *** -pass *** -write 1] [-sql_output $SCR9/vega_check.sql] [-affix 1] [-biotypes_extension 1] [-dbtype vega]"
# Vega check before the merge:
# standaloneJob.pl Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveVegaChecks -dbname my_vega_fixed_before_merge -dbhost genebuild1 -dnadbname my_dna_db -dnadbhost genebuild1 -dnadbport 3306 -port 3306 -user ensro -coord_system toplevel -path Zv9 -sql_output $SCR9/vega_check_before.sql -stdout_file REPORTS_DIR/vega_checks_before.out -stderr_file REPORTS_DIR/vega_checks_before.err"
# Vega check after the merge:
# standaloneJob.pl Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveVegaChecks -dbname my_vega_after_merge -dbhost genebuild1 -dnadbname my_dna_db -dnadbhost genebuild1 -dnadbport 3306 -port 3306 -user ensro -coord_system toplevel -path Zv9 -sql_output $SCR9/vega_check_after.sql] -affix 1 -biotypes_extension 1 -stdout_file REPORTS_DIR/vega_checks_after.out -stderr_file REPORTS_DIR/vega_checks_after.err"
# Vega check after the merge and after cleaning biotypes affixes:
# standaloneJob.pl Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveVegaChecks -dbname my_vega_after_merge -dbhost genebuild1 -dnadbname my_dna_db -dnadbhost genebuild1 -dnadbport 3306 -port 3306 -user ensro -coord_system toplevel -path Zv9 -sql_output $SCR9/vega_check_after.sql] -biotypes_extension 1 -stdout_file REPORTS_DIR/vega_checks_after.out -stderr_file REPORTS_DIR/vega_checks_after.err"
package Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveVegaChecks;
use strict;
use warnings;
use parent ('Bio::EnsEMBL::Analysis::Hive::RunnableDB::HiveBaseRunnableDB');
use Getopt::Long;
use integer; # to get integers instead of floats
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Merge::vega_check qw(get_combos get_biotype_groups get_actions);
sub param_defaults {
return {
dbname => '',
dbhost => '',
dnadbname => '',
dnadbhost => '',
dnadbport => '3306',
coord_system => '',
path => '',
sql_output => '',
dbtype => '', # can be 'vega' or '' (empty string)
port => '3306',
user => 'ensro',
pass => '',
chromosome => '',
write => '',
affix => 0, # perform the checks by using the biotypes with or without the prefixes and suffixes like weird_, _Ens, _hav, ... ; without affixes by default
biotypes_extension => 0, # use additional biotypes in 'gene_trans_type_combination_extension'; default=no
stdout_file => '', # full path to the file where the standard output will be printed
stderr_file => '' # full path to the file where the standard error will be printed
}
}
sub fetch_input {
my $self = shift;
$self->param('gene_trans_type_combination',get_combos('ensembl'));
$self->param('gene_trans_type_combination_extension',get_combos('ensembl_extension'));
$self->param('ensembl_biotype_groups',get_biotype_groups('ensembl'));
$self->param('gene_coding_biotypes',${$self->param('ensembl_biotype_groups')}{'gene_coding'});
$self->param('gene_non_coding_biotypes',${$self->param('ensembl_biotype_groups')}{'gene_non_coding'});
$self->param('transcript_coding_biotypes',${$self->param('ensembl_biotype_groups')}{'transcript_coding'});
$self->param('transcript_non_coding_biotypes',${$self->param('ensembl_biotype_groups')}{'transcript_non_coding'});
return 1;
}
sub run {
my $self = shift;
my $TXT_NO_TRANSLATION_TRANSCRIPT_TO_PROCESSED_TRANSCRIPT = "Translation not found for given transcript. Transcript biotype should be";
my $TXT_TRANSLATION_STOP_TRANSCRIPT_TO_POLY = "Translation has a stop codon. Transcript biotype should be";
my $TXT_TRANSLATION_NO_STOP_TRANSCRIPT_TO_CODING = "Translation without stop codon found. Transcript biotype should be";
my $TXT_GENE_TO_POLY = "Gene contains at least one '\%polymorphic_pseudogene\%' transcript. Gene biotype should be";
my $TXT_GENE_TO_CODING = "Gene contains at least one '\%protein_coding\%' transcript and no '\%polymorphic_pseudogene\%' transcripts. Gene biotype should be";
my $TXT_GENE_TO_PROCESSED_TRANSCRIPT = "Gene contains no '\%polymorphic_pseudogene\%' transcripts, no '\%protein_coding\%' transcripts and at least one '\%processed_transcript\%' transcript. Gene biotype should be";
my $TXT_TRANS_BIOTYPE_NOT_FOUND = "Unknown transcript biotype. Please, correct this problem and run this script again.";
my $TXT_GENE_BIOTYPE_NOT_FOUND = "Unknown gene biotype. Please, correct this problem and run this script again.";
my $TXT_GENE_TRANS_BIOTYPE_NOT_ALLOWED = "Gene and transcript biotypes combination is not allowed. Please, correct this problem and run this script again.";
# allowed affixes for gene biotypes:
my @GENE_PREFIXES = ('','weird_');
my @GENE_SUFFIXES = ('','_Ens','_Hav','_Ens_Hav');
# allowed affixes for transcript biotypes:
my @TRANSCRIPT_PREFIXES = ('','weird_');
my @TRANSCRIPT_SUFFIXES = ('','_ens','_hav','_hav_mrgd','_hav_m','_hav_mrg','_mrgd');
my $num_poly_genes = 0;
my $num_protein_coding_genes = 0;
my $num_processed_transcript_genes = 0;
my $num_polymorphic_transcript = 0;
my $num_protein_coding_transcript = 0;
my $num_processed_transcript = 0;
my $num_unknown_genes = 0;
my $num_unknown_transcripts = 0;
my $num_gt_comb_not_allowed = 0;
open STDOUT, '>', $self->param('stdout_file') if ($self->param('stdout_file'));
open STDERR, '>', $self->param('stderr_file') if ($self->param('stderr_file'));
if (not $self->param('user') or not $self->param('dbhost') or not $self->param('dbname')) {
$self->throw("DB connection parameters missing. Can't connect.");
}
my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-dbname => $self->param('dbname'),
-host => $self->param('dbhost'),
-user => $self->param('user'),
-pass => $self->param('pass'),
-port => $self->param('port'));
my $coord_system_adaptor = $db->get_CoordSystemAdaptor();
$coord_system_adaptor->fetch_all->[0]->version($self->param('path'));
# The DNA is in the ref db
if ($self->param('dnadbname')) {
if (not $self->param('dnadbhost')) {
$self->throw("Can't connect to DNA DB. Please specify the host the DNA DB is on.");
}
my $dnadb = Bio::EnsEMBL::DBSQL::DBAdaptor->new(-dbname => $self->param('dnadbname'),
-host => $self->param('dnadbhost'),
-user => $self->param('user'),
-pass => $self->param('pass'),
-port => $self->param('dnadbport'));
$db->dnadb($dnadb);
}
# we want that the biotypes regexp match the 'base' biotype and also
# the 'base' biotype plus extensions (prefix and/or suffix) like 'weird_','_hav','_hav_mrgd','_Ens',...
# depending on the parameter 'affix' value
my $gene_prefixes_str = ""; $gene_prefixes_str = join("|",@GENE_PREFIXES) if ($self->param('affix'));
my $gene_suffixes_str = ""; $gene_suffixes_str = join("|",@GENE_SUFFIXES) if ($self->param('affix'));
my $transcript_prefixes_str = ""; $transcript_prefixes_str = join("|",@TRANSCRIPT_PREFIXES) if ($self->param('affix'));
my $transcript_suffixes_str = ""; $transcript_suffixes_str = join("|",@TRANSCRIPT_SUFFIXES) if ($self->param('affix'));
my $gene_coding_biotypes_str = join("|",@{$self->param('gene_coding_biotypes')});
my $gene_non_coding_biotypes_str = join("|",@{$self->param('gene_non_coding_biotypes')});
my $gene_biotypes_str = $gene_coding_biotypes_str."|".$gene_non_coding_biotypes_str;
my $transcript_coding_biotypes_str = join("|",@{$self->param('transcript_coding_biotypes')});
my $transcript_non_coding_biotypes_str = join("|",@{$self->param('transcript_non_coding_biotypes')});
my $transcript_biotypes_str = $transcript_coding_biotypes_str."|".$transcript_non_coding_biotypes_str;
my $ga = $db->get_GeneAdaptor();
my $ta = $db->get_TranscriptAdaptor();
my $sa = $db->get_SliceAdaptor();
my @slices;
my $all_slices = $sa->fetch_all( 'toplevel', $self->param('path'), 1, undef );
if ($self->param('chromosome')) { # if chr was defined as parameter, choose one slice
foreach my $sl ( @{$all_slices} ) {
if ( $sl->seq_region_name eq $self->param('chromosome') ) {
$slices[0] = $sl;
}
}
} else { # if chr was not defined, choose all toplevel slices
@slices = @{$all_slices};
}
if ($self->param('sql_output')) {
if (-e $self->param('sql_output')) {
open(SQL_FILE,">".$self->param('sql_output'));
close(SQL_FILE);
print("\nThe file ".$self->param('sql_output')." has been truncated.\n");
}
}
print("\nGene coding biotypes:\n$gene_coding_biotypes_str\n\n");
print("Gene non-coding biotypes:\n$gene_non_coding_biotypes_str\n\n");
print("Transcript coding biotypes:\n$transcript_coding_biotypes_str\n\n");
print("Transcript non-coding biotypes:\n$transcript_non_coding_biotypes_str\n\n");
print("Gene biotype prefixes:\n$gene_prefixes_str\n\n") if ($gene_prefixes_str);
print("Gene biotype suffixes:\n$gene_suffixes_str\n\n") if ($gene_suffixes_str);
print("Transcript biotype prefixes:\n$transcript_prefixes_str\n\n") if ($transcript_prefixes_str);
print("Transcript biotype suffixes:\n$transcript_suffixes_str\n\n") if ($transcript_suffixes_str);
foreach my $slice (@slices)
{
# Fetch all genes on the slice and load their transcripts at the same time
my @genes = @{$slice->get_all_Genes(undef, undef, 1, undef, undef)};
print("--------------- Processing ".scalar(@genes)." genes from slice: ".$slice->seq_region_name."\n");
foreach my $gene (@genes) {
my $polymorphic_transcript = 0;
my $protein_coding_transcript = 0;
my $processed_transcript = 0;
my $g_biotype = $gene->biotype();
my $g_biotype_basename = get_biotype_basename($g_biotype,$gene_biotypes_str,$gene_prefixes_str,$gene_suffixes_str); # remove any prefix and suffix
if ((exists(${$self->param('gene_trans_type_combination')}{$g_biotype_basename})) or
($self->param('biotypes_extension') and exists(${$self->param('gene_trans_type_combination_extension')}{$g_biotype_basename}))) {
my $g_allowed_transcript_biotypes_str = "";
if (exists(${$self->param('gene_trans_type_combination')}{$g_biotype_basename})) {
$g_allowed_transcript_biotypes_str .= join("|",@{${$self->param('gene_trans_type_combination')}{$g_biotype_basename}});
}
if ($self->param('biotypes_extension') and exists(${$self->param('gene_trans_type_combination_extension')}{$g_biotype_basename})) {
$g_allowed_transcript_biotypes_str .= "|" if (!($g_allowed_transcript_biotypes_str eq ""));
$g_allowed_transcript_biotypes_str .= join("|",@{${$self->param('gene_trans_type_combination_extension')}{$g_biotype_basename}});
}
my @transcripts = @{$gene->get_all_Transcripts()};
my $num_transcripts = scalar(@transcripts);
foreach my $trans (@transcripts) {
my $t_biotype = $trans->biotype();
# check if transcript biotype is known
if ($t_biotype =~ /^($transcript_prefixes_str)($transcript_biotypes_str)($transcript_suffixes_str)$/) {
# check if gene-transcript biotype combination is allowed
if ($t_biotype !~ /^($transcript_prefixes_str)($g_allowed_transcript_biotypes_str)($transcript_suffixes_str)$/) {
print_gene_transcript_info($gene,$trans,$TXT_GENE_TRANS_BIOTYPE_NOT_ALLOWED) unless $self->param('dbtype') =~ /vega/;
$num_gt_comb_not_allowed++ unless $self->param('dbtype') =~ /vega/;
}
if (!$trans->translation) { # transcript has no translation
if ($t_biotype =~ /^($transcript_prefixes_str)($transcript_coding_biotypes_str)($transcript_suffixes_str)$/) { # but its biotype is protein coding (including polymorphic_pseudogene)
# transcript biotype should be processed_transcript, which means it is non-coding
my ($t_biotype_prefix,$t_biotype_suffix) = get_biotype_affix($t_biotype,$transcript_coding_biotypes_str,$transcript_prefixes_str,$transcript_suffixes_str);
my $new_suggested_biotype = $t_biotype_prefix.'processed_transcript'.$t_biotype_suffix;
print_gene_transcript_info($gene,$trans,$TXT_NO_TRANSLATION_TRANSCRIPT_TO_PROCESSED_TRANSCRIPT,$new_suggested_biotype);
update_gt("transcript",$ta,$trans,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_processed_transcript++; # keep track of the total number of updates to this type of transcripts
}
# we want to keep track of the presence of processed_transcript/non-coding transcripts to decide about the gene biotype later on
$processed_transcript = 1;
} elsif ($trans->translate->seq =~ /\*/ and $t_biotype !~ /TR_.*gene/ and $t_biotype !~ /IG_.*gene/) { # transcript has translation with stop codon
if ($t_biotype !~ /.*polymorphic.*/) { # but its biotype is not polymorphic or polymorphic_pseudogene
# transcript biotype should be polymorphic_pseudogene
my ($t_biotype_prefix,$t_biotype_suffix) = get_biotype_affix($t_biotype,$transcript_biotypes_str,$transcript_prefixes_str,$transcript_suffixes_str);
my $new_suggested_biotype = $t_biotype_prefix.'polymorphic_pseudogene'.$t_biotype_suffix;
print_gene_transcript_info($gene,$trans,$TXT_TRANSLATION_STOP_TRANSCRIPT_TO_POLY,$new_suggested_biotype);
update_gt("transcript",$ta,$trans,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_polymorphic_transcript++; # keep track of the total number of updates to this type of transcripts
}
# we want to keep track of the presence of polymorphic_pseudogene transcripts to decide about the gene biotype later on
# regardless it was a polymorphic transcript before or after this check
$polymorphic_transcript = 1;
} else { # transcript has translation without stop codon
if (($t_biotype =~ /^($transcript_prefixes_str)($transcript_non_coding_biotypes_str)($transcript_suffixes_str)$/)) { # but its biotype is non-coding
# transcript biotype should be protein_coding
my ($t_biotype_prefix,$t_biotype_suffix) = get_biotype_affix($t_biotype,$transcript_biotypes_str,$transcript_prefixes_str,$transcript_suffixes_str);
my $new_suggested_biotype = $t_biotype_prefix.'protein_coding'.$t_biotype_suffix;
print_gene_transcript_info($gene,$trans,$TXT_TRANSLATION_NO_STOP_TRANSCRIPT_TO_CODING,$new_suggested_biotype);
update_gt("transcript",$ta,$trans,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_protein_coding_transcript++; # keep track of the total number of updates to this type of transcripts
}
# we want to keep track of the presence of protein_coding transcripts to decide about the gene biotype later on
# regardless it was a protein_coding transcript before or after this check
if ($t_biotype !~ /.*polymorphic.*/) {
$protein_coding_transcript = 1;
} else {
$polymorphic_transcript = 1;
}
}
} else { # transcript biotype unknown
print_gene_transcript_info($gene,$trans,$TXT_TRANS_BIOTYPE_NOT_FOUND) unless $self->param('dbtype') =~ /vega/;
$num_unknown_transcripts++;
}
} # foreach transcripts
# decide the gene biotype
# precedence: polymorphic_pseudogene > protein_coding > processed_transcript
# note that we want to keep the gene biotype if no change has been suggested
if ($polymorphic_transcript > 0) {
if ($g_biotype !~ /.*polymorphic.*/) {
my ($g_biotype_prefix,$g_biotype_suffix) = get_biotype_affix($g_biotype,$gene_biotypes_str,$gene_prefixes_str,$gene_suffixes_str);
my $new_suggested_biotype = $g_biotype_prefix.'polymorphic_pseudogene'.$g_biotype_suffix;
print_gene_info($gene,$TXT_GENE_TO_POLY,$new_suggested_biotype);
update_gt("gene",$ga,$gene,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_poly_genes++;
}
} elsif ($protein_coding_transcript > 0) {
if (($g_biotype =~ /^($gene_prefixes_str)($gene_non_coding_biotypes_str)($gene_suffixes_str)$/) or ($g_biotype =~ /.*polymorphic.*/)) { # if gene biotype is protein coding excluding polymorphic (or "is non-coding or polymorphic")
my ($g_biotype_prefix,$g_biotype_suffix) = get_biotype_affix($g_biotype,$gene_biotypes_str,$gene_prefixes_str,$gene_suffixes_str);
my $new_suggested_biotype = $g_biotype_prefix.'protein_coding'.$g_biotype_suffix;
print_gene_info($gene,$TXT_GENE_TO_CODING,$new_suggested_biotype);
update_gt("gene",$ga,$gene,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_protein_coding_genes++;
}
} elsif ($processed_transcript > 0 and !gene_has_assembly_error_attribute($gene)) {
# note we want to skip the protein_coding gene biotypes set by Havana for genes with NoTransRefError attrib
if ($g_biotype !~ /^($gene_prefixes_str)($gene_non_coding_biotypes_str)($gene_suffixes_str)$/) {
my ($g_biotype_prefix,$g_biotype_suffix) = get_biotype_affix($g_biotype,$gene_biotypes_str,$gene_prefixes_str,$gene_suffixes_str);
my $new_suggested_biotype = $g_biotype_prefix.'processed_transcript'.$g_biotype_suffix;
print_gene_info($gene,$TXT_GENE_TO_PROCESSED_TRANSCRIPT,$new_suggested_biotype);
update_gt("gene",$ga,$gene,$new_suggested_biotype,$self->param('write'),$self->param('sql_output'));
$num_processed_transcript_genes++;
}
} #else {} # we want to keep the gene biotype if no change has been suggested
} else { # if does not exist gene_trans_type_combination
print_gene_info($gene,$TXT_GENE_BIOTYPE_NOT_FOUND) unless $self->param('dbtype') =~ /vega/;
$num_unknown_genes++;
}
} # foreach gene
} # foreach slice
my $should_be_or_has_been = "should be";
$should_be_or_has_been = "has been" if ($self->param('write'));
print("\n--- SUMMARY ---\n\n");
print("The number of unknown gene biotypes is: $num_unknown_genes\n") unless $self->param('dbtype') =~ /vega/;
print("The number of unknown transcript biotypes is: $num_unknown_transcripts\n\n") unless $self->param('dbtype') =~ /vega/;
print("The number of gene-transcript biotype combinations not allowed is: $num_gt_comb_not_allowed\n\n") unless $self->param('dbtype') =~ /vega/;
print("The number of genes whose biotype $should_be_or_has_been updated to '\%protein_coding\%' is: $num_protein_coding_genes\n");
print("The number of genes whose biotype $should_be_or_has_been updated to '\%polymorphic_pseudogene\%' is: $num_poly_genes\n");
print("The number of genes whose biotype $should_be_or_has_been updated to '\%processed_transcript\%' is: $num_processed_transcript_genes\n\n");
print("The number of transcripts whose biotype $should_be_or_has_been updated to '\%protein_coding\%' is: $num_protein_coding_transcript\n");
print("The number of transcripts whose biotype $should_be_or_has_been updated to '\%polymorphic_pseudogene\%' is: $num_polymorphic_transcript\n");
print("The number of transcripts whose biotype $should_be_or_has_been updated to '\%processed_transcript\%' is: $num_processed_transcript\n\n");
if ($self->param('sql_output')) {
my $not_sql_output = '';
$not_sql_output = " NOT" if (!(-e $self->param('sql_output')));
print("The SQL file ".$self->param('sql_output')." that $should_be_or_has_been run to apply the suggested updates has$not_sql_output been written.\n");
}
return 1;
}
sub write_output {
my $self = shift;
return 1;
}
sub print_gene_transcript_info {
my $gene = shift;
my $trans = shift;
my $message = shift;
my $new_biotype = shift;
my $g_id = $gene->dbID;
my $g_stable_id = "undefined"; $g_stable_id = $gene->stable_id if ($gene->stable_id);
my $g_biotype = $gene->biotype;
my $t_id = $trans->dbID;
my $t_stable_id = "undefined"; $t_stable_id = $trans->stable_id if ($trans->stable_id);
my $t_biotype = $trans->biotype;
my $str_to_print = "Gene ID: $g_id, Gene stable_id: $g_stable_id, Gene biotype: $g_biotype, Transcript ID: $t_id, Transcript stable_id: $t_stable_id, Transcript biotype: $t_biotype. $message";
$str_to_print .= " \'$new_biotype\'" if (defined($new_biotype));
$str_to_print .= ".\n";
print($str_to_print);
}
sub print_gene_info {
my $gene = shift;
my $message = shift;
my $new_biotype = shift;
my $g_id = $gene->dbID;
my $g_stable_id = "undefined"; $g_stable_id = $gene->stable_id if ($gene->stable_id);
my $g_biotype = $gene->biotype;
my $str_to_print = "Gene ID: $g_id, Gene stable_id: $g_stable_id, Gene biotype: $g_biotype. $message";
$str_to_print .= " \'$new_biotype\'" if (defined($new_biotype));
$str_to_print .= ".\n";
print($str_to_print);
}
sub get_biotype_affix {
my $biotype = shift;
my $biotypes_str = shift; # biotypes regex string with no affixes
my $prefixes_str = shift;
my $suffixes_str = shift;
my $prefix = '';
my $suffix = '';
if ($biotype =~ /^($prefixes_str)($biotypes_str)($suffixes_str)$/) {
$prefix = $1;
$suffix = $3;
}
return $prefix,$suffix;
}
sub get_biotype_basename {
my $biotype = shift;
my $biotypes_str = shift; # biotypes regex string with no affixes
my $prefixes_str = shift;
my $suffixes_str = shift;
my $biotype_basename = '';
if ($biotype =~ /^($prefixes_str)($biotypes_str)($suffixes_str)$/) {
$biotype_basename = $2;
}
return $biotype_basename;
}
sub update_gt {
my $gt_str = shift; # it will be string "gene" or "transcript"
my $gta = shift; # gene/transcript adaptor
my $gt = shift; # gene/transcript object
my $new_suggested_biotype = shift; # new biotype
my $write = shift; # update db or not
my $sql_output = shift; # output file for SQL commands
my $gt_id = $gt->dbID;
my $gt_stable_id = $gt->stable_id;
if ($write) {
$gt->biotype($new_suggested_biotype);
$gta->update($gt);
print("$gt_str $gt_id biotype has been updated to \'$new_suggested_biotype\'.\n");
}
if ($sql_output) {
open(SQL_FILE,">>$sql_output");
if ($gt_stable_id) {
print SQL_FILE "update $gt_str set biotype='$new_suggested_biotype' where stable_id='$gt_stable_id';\n";
}
else {
print SQL_FILE "update $gt_str set biotype='$new_suggested_biotype' where $gt_str"."_id=$gt_id;\n";
}
close(SQL_FILE);
}
}
sub gene_has_assembly_error_attribute {
my $gene = shift;
my @attribs = @{$gene->get_all_Attributes('NoTransRefError')};
return (scalar(@attribs) > 0);
}
1;
| 53.682819 | 403 | 0.686279 |
ed00ba121b44f46ef720b16d705d5e4d68feb44f | 42,536 | pm | Perl | lib/YAML/Tiny.pm | richlv/YAML-Tiny | 2867e2cba54f60896c05c653e2c8bc1946f41bea | [
"Artistic-1.0"
]
| null | null | null | lib/YAML/Tiny.pm | richlv/YAML-Tiny | 2867e2cba54f60896c05c653e2c8bc1946f41bea | [
"Artistic-1.0"
]
| null | null | null | lib/YAML/Tiny.pm | richlv/YAML-Tiny | 2867e2cba54f60896c05c653e2c8bc1946f41bea | [
"Artistic-1.0"
]
| null | null | null | use 5.008001; # sane UTF-8 support
use strict;
use warnings;
package YAML::Tiny;
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
our $VERSION = '1.74';
#####################################################################
# The YAML::Tiny API.
#
# These are the currently documented API functions/methods and
# exports:
use Exporter;
our @ISA = qw{ Exporter };
our @EXPORT = qw{ Load Dump };
our @EXPORT_OK = qw{ LoadFile DumpFile freeze thaw };
###
# Functional/Export API:
sub Dump {
return YAML::Tiny->new(@_)->_dump_string;
}
# XXX-INGY Returning last document seems a bad behavior.
# XXX-XDG I think first would seem more natural, but I don't know
# that it's worth changing now
sub Load {
my $self = YAML::Tiny->_load_string(@_);
if ( wantarray ) {
return @$self;
} else {
# To match YAML.pm, return the last document
return $self->[-1];
}
}
# XXX-INGY Do we really need freeze and thaw?
# XXX-XDG I don't think so. I'd support deprecating them.
BEGIN {
*freeze = \&Dump;
*thaw = \&Load;
}
sub DumpFile {
my $file = shift;
return YAML::Tiny->new(@_)->_dump_file($file);
}
sub LoadFile {
my $file = shift;
my $self = YAML::Tiny->_load_file($file);
if ( wantarray ) {
return @$self;
} else {
# Return only the last document to match YAML.pm,
return $self->[-1];
}
}
###
# Object Oriented API:
# Create an empty YAML::Tiny object
# XXX-INGY Why do we use ARRAY object?
# NOTE: I get it now, but I think it's confusing and not needed.
# Will change it on a branch later, for review.
#
# XXX-XDG I don't support changing it yet. It's a very well-documented
# "API" of YAML::Tiny. I'd support deprecating it, but Adam suggested
# we not change it until YAML.pm's own OO API is established so that
# users only have one API change to digest, not two
sub new {
my $class = shift;
bless [ @_ ], $class;
}
# XXX-INGY It probably doesn't matter, and it's probably too late to
# change, but 'read/write' are the wrong names. Read and Write
# are actions that take data from storage to memory
# characters/strings. These take the data to/from storage to native
# Perl objects, which the terms dump and load are meant. As long as
# this is a legacy quirk to YAML::Tiny it's ok, but I'd prefer not
# to add new {read,write}_* methods to this API.
sub read_string {
my $self = shift;
$self->_load_string(@_);
}
sub write_string {
my $self = shift;
$self->_dump_string(@_);
}
sub read {
my $self = shift;
$self->_load_file(@_);
}
sub write {
my $self = shift;
$self->_dump_file(@_);
}
#####################################################################
# Constants
# Printed form of the unprintable characters in the lowest range
# of ASCII characters, listed by ASCII ordinal position.
my @UNPRINTABLE = qw(
0 x01 x02 x03 x04 x05 x06 a
b t n v f r x0E x0F
x10 x11 x12 x13 x14 x15 x16 x17
x18 x19 x1A e x1C x1D x1E x1F
);
# Printable characters for escapes
my %UNESCAPES = (
0 => "\x00", z => "\x00", N => "\x85",
a => "\x07", b => "\x08", t => "\x09",
n => "\x0a", v => "\x0b", f => "\x0c",
r => "\x0d", e => "\x1b", '\\' => '\\',
);
# XXX-INGY
# I(ngy) need to decide if these values should be quoted in
# YAML::Tiny or not. Probably yes.
# These 3 values have special meaning when unquoted and using the
# default YAML schema. They need quotes if they are strings.
my %QUOTE = map { $_ => 1 } qw{
null true false
};
# The commented out form is simpler, but overloaded the Perl regex
# engine due to recursion and backtracking problems on strings
# larger than 32,000ish characters. Keep it for reference purposes.
# qr/\"((?:\\.|[^\"])*)\"/
my $re_capture_double_quoted = qr/\"([^\\"]*(?:\\.[^\\"]*)*)\"/;
my $re_capture_single_quoted = qr/\'([^\']*(?:\'\'[^\']*)*)\'/;
# unquoted re gets trailing space that needs to be stripped
my $re_capture_unquoted_key = qr/([^:]+(?::+\S(?:[^:]*|.*?(?=:)))*)(?=\s*\:(?:\s+|$))/;
my $re_trailing_comment = qr/(?:\s+\#.*)?/;
my $re_key_value_separator = qr/\s*:(?:\s+(?:\#.*)?|$)/;
#####################################################################
# YAML::Tiny Implementation.
#
# These are the private methods that do all the work. They may change
# at any time.
###
# Loader functions:
# Create an object from a file
sub _load_file {
my $class = ref $_[0] ? ref shift : shift;
# Check the file
my $file = shift or $class->_error( 'You did not specify a file name' );
$class->_error( "File '$file' does not exist" )
unless -e $file;
$class->_error( "'$file' is a directory, not a file" )
unless -f _;
$class->_error( "Insufficient permissions to read '$file'" )
unless -r _;
# Open unbuffered with strict UTF-8 decoding and no translation layers
open( my $fh, "<:unix:encoding(UTF-8)", $file );
unless ( $fh ) {
$class->_error("Failed to open file '$file': $!");
}
# flock if available (or warn if not possible for OS-specific reasons)
if ( _can_flock() ) {
flock( $fh, Fcntl::LOCK_SH() )
or warn "Couldn't lock '$file' for reading: $!";
}
# slurp the contents
my $contents = eval {
use warnings FATAL => 'utf8';
local $/;
<$fh>
};
if ( my $err = $@ ) {
$class->_error("Error reading from file '$file': $err");
}
# close the file (release the lock)
unless ( close $fh ) {
$class->_error("Failed to close file '$file': $!");
}
$class->_load_string( $contents );
}
# Create an object from a string
sub _load_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
eval {
unless ( defined $string ) {
die \"Did not provide a string to load";
}
# Check if Perl has it marked as characters, but it's internally
# inconsistent. E.g. maybe latin1 got read on a :utf8 layer
if ( utf8::is_utf8($string) && ! utf8::valid($string) ) {
die \<<'...';
Read an invalid UTF-8 string (maybe mixed UTF-8 and 8-bit character set).
Did you decode with lax ":utf8" instead of strict ":encoding(UTF-8)"?
...
}
# Ensure Unicode character semantics, even for 0x80-0xff
utf8::upgrade($string);
# Check for and strip any leading UTF-8 BOM
$string =~ s/^\x{FEFF}//;
# Check for some special cases
return $self unless length $string;
# Split the file into lines
my @lines = grep { ! /^\s*(?:\#.*)?\z/ }
split /(?:\015{1,2}\012|\015|\012)/, $string;
# Strip the initial YAML header
@lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines;
# A nibbling parser
my $in_document = 0;
while ( @lines ) {
# Do we have a document header?
if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) {
# Handle scalar documents
shift @lines;
if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) {
push @$self,
$self->_load_scalar( "$1", [ undef ], \@lines );
next;
}
$in_document = 1;
}
if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) {
# A naked document
push @$self, undef;
while ( @lines and $lines[0] !~ /^---/ ) {
shift @lines;
}
$in_document = 0;
# XXX The final '-+$' is to look for -- which ends up being an
# error later.
} elsif ( ! $in_document && @$self ) {
# only the first document can be explicit
die \"YAML::Tiny failed to classify the line '$lines[0]'";
} elsif ( $lines[0] =~ /^\s*\-(?:\s|$|-+$)/ ) {
# An array at the root
my $document = [ ];
push @$self, $document;
$self->_load_array( $document, [ 0 ], \@lines );
} elsif ( $lines[0] =~ /^(\s*)\S/ ) {
# A hash at the root
my $document = { };
push @$self, $document;
$self->_load_hash( $document, [ length($1) ], \@lines );
} else {
# Shouldn't get here. @lines have whitespace-only lines
# stripped, and previous match is a line with any
# non-whitespace. So this clause should only be reachable via
# a perlbug where \s is not symmetric with \S
# uncoverable statement
die \"YAML::Tiny failed to classify the line '$lines[0]'";
}
}
};
my $err = $@;
if ( ref $err eq 'SCALAR' ) {
$self->_error(${$err});
} elsif ( $err ) {
$self->_error($err);
}
return $self;
}
sub _unquote_single {
my ($self, $string) = @_;
return '' unless length $string;
$string =~ s/\'\'/\'/g;
return $string;
}
sub _unquote_double {
my ($self, $string) = @_;
return '' unless length $string;
$string =~ s/\\"/"/g;
$string =~
s{\\([Nnever\\fartz0b]|x([0-9a-fA-F]{2}))}
{(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}}gex;
return $string;
}
# Load a YAML scalar string to the actual Perl scalar
sub _load_scalar {
my ($self, $string, $indent, $lines) = @_;
# Trim trailing whitespace
$string =~ s/\s*\z//;
# Explitic null/undef
return undef if $string eq '~';
# Single quote
if ( $string =~ /^$re_capture_single_quoted$re_trailing_comment\z/ ) {
return $self->_unquote_single($1);
}
# Double quote.
if ( $string =~ /^$re_capture_double_quoted$re_trailing_comment\z/ ) {
return $self->_unquote_double($1);
}
# Special cases
if ( $string =~ /^[\'\"!&]/ ) {
die \"YAML::Tiny does not support a feature in line '$string'";
}
return {} if $string =~ /^{}(?:\s+\#.*)?\z/;
return [] if $string =~ /^\[\](?:\s+\#.*)?\z/;
# Regular unquoted string
if ( $string !~ /^[>|]/ ) {
die \"YAML::Tiny found illegal characters in plain scalar: '$string'"
if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or
$string =~ /:(?:\s|$)/;
$string =~ s/\s+#.*\z//;
return $string;
}
# Error
die \"YAML::Tiny failed to find multi-line scalar content" unless @$lines;
# Check the indent depth
$lines->[0] =~ /^(\s*)/;
$indent->[-1] = length("$1");
if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
# Pull the lines
my @multiline = ();
while ( @$lines ) {
$lines->[0] =~ /^(\s*)/;
last unless length($1) >= $indent->[-1];
push @multiline, substr(shift(@$lines), $indent->[-1]);
}
my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
my $t = (substr($string, 1, 1) eq '-') ? '' : "\n";
return join( $j, @multiline ) . $t;
}
# Load an array
sub _load_array {
my ($self, $array, $indent, $lines) = @_;
while ( @$lines ) {
# Check for a new document
if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
while ( @$lines and $lines->[0] !~ /^---/ ) {
shift @$lines;
}
return 1;
}
# Check the indent level
$lines->[0] =~ /^(\s*)/;
if ( length($1) < $indent->[-1] ) {
return 1;
} elsif ( length($1) > $indent->[-1] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) {
# Inline nested hash
my $indent2 = length("$1");
$lines->[0] =~ s/-/ /;
push @$array, { };
$self->_load_hash( $array->[-1], [ @$indent, $indent2 ], $lines );
} elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) {
shift @$lines;
unless ( @$lines ) {
push @$array, undef;
return 1;
}
if ( $lines->[0] =~ /^(\s*)\-/ ) {
my $indent2 = length("$1");
if ( $indent->[-1] == $indent2 ) {
# Null array entry
push @$array, undef;
} else {
# Naked indenter
push @$array, [ ];
$self->_load_array(
$array->[-1], [ @$indent, $indent2 ], $lines
);
}
} elsif ( $lines->[0] =~ /^(\s*)\S/ ) {
push @$array, { };
$self->_load_hash(
$array->[-1], [ @$indent, length("$1") ], $lines
);
} else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
} elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) {
# Array entry with a value
shift @$lines;
push @$array, $self->_load_scalar(
"$2", [ @$indent, undef ], $lines
);
} elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) {
# This is probably a structure like the following...
# ---
# foo:
# - list
# bar: value
#
# ... so lets return and let the hash parser handle it
return 1;
} else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
}
return 1;
}
# Load a hash
sub _load_hash {
my ($self, $hash, $indent, $lines) = @_;
while ( @$lines ) {
# Check for a new document
if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) {
while ( @$lines and $lines->[0] !~ /^---/ ) {
shift @$lines;
}
return 1;
}
# Check the indent level
$lines->[0] =~ /^(\s*)/;
if ( length($1) < $indent->[-1] ) {
return 1;
} elsif ( length($1) > $indent->[-1] ) {
die \"YAML::Tiny found bad indenting in line '$lines->[0]'";
}
# Find the key
my $key;
# Quoted keys
if ( $lines->[0] =~
s/^\s*$re_capture_single_quoted$re_key_value_separator//
) {
$key = $self->_unquote_single($1);
}
elsif ( $lines->[0] =~
s/^\s*$re_capture_double_quoted$re_key_value_separator//
) {
$key = $self->_unquote_double($1);
}
elsif ( $lines->[0] =~
s/^\s*$re_capture_unquoted_key$re_key_value_separator//
) {
$key = $1;
$key =~ s/\s+$//;
}
elsif ( $lines->[0] =~ /^\s*\?/ ) {
die \"YAML::Tiny does not support a feature in line '$lines->[0]'";
}
else {
die \"YAML::Tiny failed to classify line '$lines->[0]'";
}
if ( exists $hash->{$key} ) {
warn "YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'";
}
# Do we have a value?
if ( length $lines->[0] ) {
# Yes
$hash->{$key} = $self->_load_scalar(
shift(@$lines), [ @$indent, undef ], $lines
);
} else {
# An indent
shift @$lines;
unless ( @$lines ) {
$hash->{$key} = undef;
return 1;
}
if ( $lines->[0] =~ /^(\s*)-/ ) {
$hash->{$key} = [];
$self->_load_array(
$hash->{$key}, [ @$indent, length($1) ], $lines
);
} elsif ( $lines->[0] =~ /^(\s*)./ ) {
my $indent2 = length("$1");
if ( $indent->[-1] >= $indent2 ) {
# Null hash entry
$hash->{$key} = undef;
} else {
$hash->{$key} = {};
$self->_load_hash(
$hash->{$key}, [ @$indent, length($1) ], $lines
);
}
}
}
}
return 1;
}
###
# Dumper functions:
# Save an object to a file
sub _dump_file {
my $self = shift;
require Fcntl;
# Check the file
my $file = shift or $self->_error( 'You did not specify a file name' );
my $fh;
# flock if available (or warn if not possible for OS-specific reasons)
if ( _can_flock() ) {
# Open without truncation (truncate comes after lock)
my $flags = Fcntl::O_WRONLY()|Fcntl::O_CREAT();
sysopen( $fh, $file, $flags )
or $self->_error("Failed to open file '$file' for writing: $!");
# Use no translation and strict UTF-8
binmode( $fh, ":raw:encoding(UTF-8)");
flock( $fh, Fcntl::LOCK_EX() )
or warn "Couldn't lock '$file' for reading: $!";
# truncate and spew contents
truncate $fh, 0;
seek $fh, 0, 0;
}
else {
open $fh, ">:unix:encoding(UTF-8)", $file;
}
# serialize and spew to the handle
print {$fh} $self->_dump_string;
# close the file (release the lock)
unless ( close $fh ) {
$self->_error("Failed to close file '$file': $!");
}
return 1;
}
# Save an object to a string
sub _dump_string {
my $self = shift;
return '' unless ref $self && @$self;
# Iterate over the documents
my $indent = 0;
my @lines = ();
eval {
foreach my $cursor ( @$self ) {
push @lines, '---';
# An empty document
if ( ! defined $cursor ) {
# Do nothing
# A scalar document
} elsif ( ! ref $cursor ) {
$lines[-1] .= ' ' . $self->_dump_scalar( $cursor );
# A list at the root
} elsif ( ref $cursor eq 'ARRAY' ) {
unless ( @$cursor ) {
$lines[-1] .= ' []';
next;
}
push @lines, $self->_dump_array( $cursor, $indent, {} );
# A hash at the root
} elsif ( ref $cursor eq 'HASH' ) {
unless ( %$cursor ) {
$lines[-1] .= ' {}';
next;
}
push @lines, $self->_dump_hash( $cursor, $indent, {} );
} else {
die \("Cannot serialize " . ref($cursor));
}
}
};
if ( ref $@ eq 'SCALAR' ) {
$self->_error(${$@});
} elsif ( $@ ) {
$self->_error($@);
}
join '', map { "$_\n" } @lines;
}
sub _has_internal_string_value {
my $value = shift;
my $b_obj = B::svref_2object(\$value); # for round trip problem
return $b_obj->FLAGS & B::SVf_POK();
}
sub _dump_scalar {
my $string = $_[1];
my $is_key = $_[2];
# Check this before checking length or it winds up looking like a string!
my $has_string_flag = _has_internal_string_value($string);
return '~' unless defined $string;
return "''" unless length $string;
if (Scalar::Util::looks_like_number($string)) {
# keys and values that have been used as strings get quoted
if ( $is_key || $has_string_flag ) {
return qq['$string'];
}
else {
return $string;
}
}
if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
$string =~ s/\\/\\\\/g;
$string =~ s/"/\\"/g;
$string =~ s/\n/\\n/g;
$string =~ s/[\x85]/\\N/g;
$string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g;
$string =~ s/([\x7f-\x9f])/'\x' . sprintf("%X",ord($1))/ge;
return qq|"$string"|;
}
if ( $string =~ /(?:^[~!@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or
$QUOTE{$string}
) {
return "'$string'";
}
return $string;
}
sub _dump_array {
my ($self, $array, $indent, $seen) = @_;
if ( $seen->{refaddr($array)}++ ) {
die \"YAML::Tiny does not support circular references";
}
my @lines = ();
foreach my $el ( @$array ) {
my $line = (' ' x $indent) . '-';
my $type = ref $el;
if ( ! $type ) {
$line .= ' ' . $self->_dump_scalar( $el );
push @lines, $line;
} elsif ( $type eq 'ARRAY' ) {
if ( @$el ) {
push @lines, $line;
push @lines, $self->_dump_array( $el, $indent + 1, $seen );
} else {
$line .= ' []';
push @lines, $line;
}
} elsif ( $type eq 'HASH' ) {
if ( keys %$el ) {
push @lines, $line;
push @lines, $self->_dump_hash( $el, $indent + 1, $seen );
} else {
$line .= ' {}';
push @lines, $line;
}
} else {
die \"YAML::Tiny does not support $type references";
}
}
@lines;
}
sub _dump_hash {
my ($self, $hash, $indent, $seen) = @_;
if ( $seen->{refaddr($hash)}++ ) {
die \"YAML::Tiny does not support circular references";
}
my @lines = ();
foreach my $name ( sort keys %$hash ) {
my $el = $hash->{$name};
my $line = (' ' x $indent) . $self->_dump_scalar($name, 1) . ":";
my $type = ref $el;
if ( ! $type ) {
$line .= ' ' . $self->_dump_scalar( $el );
push @lines, $line;
} elsif ( $type eq 'ARRAY' ) {
if ( @$el ) {
push @lines, $line;
push @lines, $self->_dump_array( $el, $indent + 1, $seen );
} else {
$line .= ' []';
push @lines, $line;
}
} elsif ( $type eq 'HASH' ) {
if ( keys %$el ) {
push @lines, $line;
push @lines, $self->_dump_hash( $el, $indent + 1, $seen );
} else {
$line .= ' {}';
push @lines, $line;
}
} else {
die \"YAML::Tiny does not support $type references";
}
}
@lines;
}
#####################################################################
# DEPRECATED API methods:
# Error storage (DEPRECATED as of 1.57)
our $errstr = '';
# Set error
sub _error {
require Carp;
$errstr = $_[1];
$errstr =~ s/ at \S+ line \d+.*//;
Carp::croak( $errstr );
}
# Retrieve error
my $errstr_warned;
sub errstr {
require Carp;
Carp::carp( "YAML::Tiny->errstr and \$YAML::Tiny::errstr is deprecated" )
unless $errstr_warned++;
$errstr;
}
#####################################################################
# Helper functions. Possibly not needed.
# Use to detect nv or iv
use B;
# XXX-INGY Is flock YAML::Tiny's responsibility?
# Some platforms can't flock :-(
# XXX-XDG I think it is. When reading and writing files, we ought
# to be locking whenever possible. People (foolishly) use YAML
# files for things like session storage, which has race issues.
my $HAS_FLOCK;
sub _can_flock {
if ( defined $HAS_FLOCK ) {
return $HAS_FLOCK;
}
else {
require Config;
my $c = \%Config::Config;
$HAS_FLOCK = grep { $c->{$_} } qw/d_flock d_fcntl_can_lock d_lockf/;
require Fcntl if $HAS_FLOCK;
return $HAS_FLOCK;
}
}
# XXX-INGY Is this core in 5.8.1? Can we remove this?
# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this
#####################################################################
# Use Scalar::Util if possible, otherwise emulate it
use Scalar::Util ();
BEGIN {
local $@;
if ( eval { Scalar::Util->VERSION(1.18); } ) {
*refaddr = *Scalar::Util::refaddr;
}
else {
eval <<'END_PERL';
# Scalar::Util failed to load or too old
sub refaddr {
my $pkg = ref($_[0]) or return undef;
if ( !! UNIVERSAL::can($_[0], 'can') ) {
bless $_[0], 'Scalar::Util::Fake';
} else {
$pkg = undef;
}
"$_[0]" =~ /0x(\w+)/;
my $i = do { no warnings 'portable'; hex $1 };
bless $_[0], $pkg if defined $pkg;
$i;
}
END_PERL
}
}
delete $YAML::Tiny::{refaddr};
1;
# XXX-INGY Doc notes I'm putting up here. Changing the doc when it's wrong
# but leaving grey area stuff up here.
#
# I would like to change Read/Write to Load/Dump below without
# changing the actual API names.
#
# It might be better to put Load/Dump API in the SYNOPSIS instead of the
# dubious OO API.
#
# null and bool explanations may be outdated.
__END__
=pod
=head1 NAME
YAML::Tiny - Read/Write YAML files with as little code as possible
=head1 PREAMBLE
The YAML specification is huge. Really, B<really> huge. It contains all the
functionality of XML, except with flexibility and choice, which makes it
easier to read, but with a formal specification that is more complex than
XML.
The original pure-Perl implementation L<YAML> costs just over 4 megabytes
of memory to load. Just like with Windows F<.ini> files (3 meg to load) and
CSS (3.5 meg to load) the situation is just asking for a B<YAML::Tiny>
module, an incomplete but correct and usable subset of the functionality,
in as little code as possible.
Like the other C<::Tiny> modules, YAML::Tiny has no non-core dependencies,
does not require a compiler to install, is back-compatible to Perl v5.8.1,
and can be inlined into other modules if needed.
In exchange for this adding this extreme flexibility, it provides support
for only a limited subset of YAML. But the subset supported contains most
of the features for the more common uses of YAML.
=head1 SYNOPSIS
Assuming F<file.yml> like this:
---
rootproperty: blah
section:
one: two
three: four
Foo: Bar
empty: ~
Read and write F<file.yml> like this:
use YAML::Tiny;
# Open the config
my $yaml = YAML::Tiny->read( 'file.yml' );
# Get a reference to the first document
my $config = $yaml->[0];
# Or read properties directly
my $root = $yaml->[0]->{rootproperty};
my $one = $yaml->[0]->{section}->{one};
my $Foo = $yaml->[0]->{section}->{Foo};
# Change data directly
$yaml->[0]->{newsection} = { this => 'that' }; # Add a section
$yaml->[0]->{section}->{Foo} = 'Not Bar!'; # Change a value
delete $yaml->[0]->{section}; # Delete a value
# Save the document back to the file
$yaml->write( 'file.yml' );
To create a new YAML file from scratch:
# Create a new object with a single hashref document
my $yaml = YAML::Tiny->new( { wibble => "wobble" } );
# Add an arrayref document
push @$yaml, [ 'foo', 'bar', 'baz' ];
# Save both documents to a file
$yaml->write( 'data.yml' );
Then F<data.yml> will contain:
---
wibble: wobble
---
- foo
- bar
- baz
=head1 DESCRIPTION
B<YAML::Tiny> is a perl class for reading and writing YAML-style files,
written with as little code as possible, reducing load time and memory
overhead.
Most of the time it is accepted that Perl applications use a lot
of memory and modules. The B<::Tiny> family of modules is specifically
intended to provide an ultralight and zero-dependency alternative to
many more-thorough standard modules.
This module is primarily for reading human-written files (like simple
config files) and generating very simple human-readable files. Note that
I said B<human-readable> and not B<geek-readable>. The sort of files that
your average manager or secretary should be able to look at and make
sense of.
=for stopwords normalise
L<YAML::Tiny> does not generate comments, it won't necessarily preserve the
order of your hashes, and it will normalise if reading in and writing out
again.
It only supports a very basic subset of the full YAML specification.
=for stopwords embeddable
Usage is targeted at files like Perl's META.yml, for which a small and
easily-embeddable module is extremely attractive.
Features will only be added if they are human readable, and can be written
in a few lines of code. Please don't be offended if your request is
refused. Someone has to draw the line, and for YAML::Tiny that someone
is me.
If you need something with more power move up to L<YAML> (7 megabytes of
memory overhead) or L<YAML::XS> (6 megabytes memory overhead and requires
a C compiler).
To restate, L<YAML::Tiny> does B<not> preserve your comments, whitespace,
or the order of your YAML data. But it should round-trip from Perl
structure to file and back again just fine.
=head1 METHODS
=for Pod::Coverage HAVE_UTF8 refaddr
=head2 new
The constructor C<new> creates a C<YAML::Tiny> object as a blessed array
reference. Any arguments provided are taken as separate documents
to be serialized.
=head2 read $filename
The C<read> constructor reads a YAML file from a file name,
and returns a new C<YAML::Tiny> object containing the parsed content.
Returns the object on success or throws an error on failure.
=head2 read_string $string;
The C<read_string> constructor reads YAML data from a character string, and
returns a new C<YAML::Tiny> object containing the parsed content. If you have
read the string from a file yourself, be sure that you have correctly decoded
it into characters first.
Returns the object on success or throws an error on failure.
=head2 write $filename
The C<write> method generates the file content for the properties, and
writes it to disk using UTF-8 encoding to the filename specified.
Returns true on success or throws an error on failure.
=head2 write_string
Generates the file content for the object and returns it as a character
string. This may contain non-ASCII characters and should be encoded
before writing it to a file.
Returns true on success or throws an error on failure.
=for stopwords errstr
=head2 errstr (DEPRECATED)
Prior to version 1.57, some errors were fatal and others were available only
via the C<$YAML::Tiny::errstr> variable, which could be accessed via the
C<errstr()> method.
Starting with version 1.57, all errors are fatal and throw exceptions.
The C<$errstr> variable is still set when exceptions are thrown, but
C<$errstr> and the C<errstr()> method are deprecated and may be removed in a
future release. The first use of C<errstr()> will issue a deprecation
warning.
=head1 FUNCTIONS
YAML::Tiny implements a number of functions to add compatibility with
the L<YAML> API. These should be a drop-in replacement.
=head2 Dump
my $string = Dump(list-of-Perl-data-structures);
Turn Perl data into YAML. This function works very much like
Data::Dumper::Dumper().
It takes a list of Perl data structures and dumps them into a serialized
form.
It returns a character string containing the YAML stream. Be sure to encode
it as UTF-8 before serializing to a file or socket.
The structures can be references or plain scalars.
Dies on any error.
=head2 Load
my @data_structures = Load(string-containing-a-YAML-stream);
Turn YAML into Perl data. This is the opposite of Dump.
Just like L<Storable>'s thaw() function or the eval() function in relation
to L<Data::Dumper>.
It parses a character string containing a valid YAML stream into a list of
Perl data structures representing the individual YAML documents. Be sure to
decode the character string correctly if the string came from a file or
socket.
my $last_data_structure = Load(string-containing-a-YAML-stream);
For consistency with YAML.pm, when Load is called in scalar context, it
returns the data structure corresponding to the last of the YAML documents
found in the input stream.
Dies on any error.
=head2 freeze() and thaw()
Aliases to Dump() and Load() for L<Storable> fans. This will also allow
YAML::Tiny to be plugged directly into modules like POE.pm, that use the
freeze/thaw API for internal serialization.
=head2 DumpFile(filepath, list)
Writes the YAML stream to a file with UTF-8 encoding instead of just
returning a string.
Dies on any error.
=head2 LoadFile(filepath)
Reads the YAML stream from a UTF-8 encoded file instead of a string.
Dies on any error.
=head1 YAML TINY SPECIFICATION
This section of the documentation provides a specification for "YAML Tiny",
a subset of the YAML specification.
It is based on and described comparatively to the YAML 1.1 Working Draft
2004-12-28 specification, located at L<http://yaml.org/spec/current.html>.
Terminology and chapter numbers are based on that specification.
=head2 1. Introduction and Goals
The purpose of the YAML Tiny specification is to describe a useful subset
of the YAML specification that can be used for typical document-oriented
use cases such as configuration files and simple data structure dumps.
=for stopwords extensibility
Many specification elements that add flexibility or extensibility are
intentionally removed, as is support for complex data structures, class
and object-orientation.
In general, the YAML Tiny language targets only those data structures
available in JSON, with the additional limitation that only simple keys
are supported.
As a result, all possible YAML Tiny documents should be able to be
transformed into an equivalent JSON document, although the reverse is
not necessarily true (but will be true in simple cases).
=for stopwords PCRE
As a result of these simplifications the YAML Tiny specification should
be implementable in a (relatively) small amount of code in any language
that supports Perl Compatible Regular Expressions (PCRE).
=head2 2. Introduction
YAML Tiny supports three data structures. These are scalars (in a variety
of forms), block-form sequences and block-form mappings. Flow-style
sequences and mappings are not supported, with some minor exceptions
detailed later.
The use of three dashes "---" to indicate the start of a new document is
supported, and multiple documents per file/stream is allowed.
Both line and inline comments are supported.
Scalars are supported via the plain style, single quote and double quote,
as well as literal-style and folded-style multi-line scalars.
The use of explicit tags is not supported.
The use of "null" type scalars is supported via the ~ character.
The use of "bool" type scalars is not supported.
=for stopwords serializer
However, serializer implementations should take care to explicitly escape
strings that match a "bool" keyword in the following set to prevent other
implementations that do support "bool" accidentally reading a string as a
boolean
y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF
The use of anchors and aliases is not supported.
The use of directives is supported only for the %YAML directive.
=head2 3. Processing YAML Tiny Information
B<Processes>
=for stopwords deserialization
The YAML specification dictates three-phase serialization and three-phase
deserialization.
The YAML Tiny specification does not mandate any particular methodology
or mechanism for parsing.
Any compliant parser is only required to parse a single document at a
time. The ability to support streaming documents is optional and most
likely non-typical.
=for stopwords acyclic
Because anchors and aliases are not supported, the resulting representation
graph is thus directed but (unlike the main YAML specification) B<acyclic>.
Circular references/pointers are not possible, and any YAML Tiny serializer
detecting a circular reference should error with an appropriate message.
B<Presentation Stream>
=for stopwords unicode
YAML Tiny reads and write UTF-8 encoded files. Operations on strings expect
or produce Unicode characters not UTF-8 encoded bytes.
B<Loading Failure Points>
=for stopwords modality
=for stopwords parsers
YAML Tiny parsers and emitters are not expected to recover from, or
adapt to, errors. The specific error modality of any implementation is
not dictated (return codes, exceptions, etc.) but is expected to be
consistent.
=head2 4. Syntax
B<Character Set>
YAML Tiny streams are processed in memory as Unicode characters and
read/written with UTF-8 encoding.
The escaping and unescaping of the 8-bit YAML escapes is required.
The escaping and unescaping of 16-bit and 32-bit YAML escapes is not
required.
B<Indicator Characters>
Support for the "~" null/undefined indicator is required.
Implementations may represent this as appropriate for the underlying
language.
Support for the "-" block sequence indicator is required.
Support for the "?" mapping key indicator is B<not> required.
Support for the ":" mapping value indicator is required.
Support for the "," flow collection indicator is B<not> required.
Support for the "[" flow sequence indicator is B<not> required, with
one exception (detailed below).
Support for the "]" flow sequence indicator is B<not> required, with
one exception (detailed below).
Support for the "{" flow mapping indicator is B<not> required, with
one exception (detailed below).
Support for the "}" flow mapping indicator is B<not> required, with
one exception (detailed below).
Support for the "#" comment indicator is required.
Support for the "&" anchor indicator is B<not> required.
Support for the "*" alias indicator is B<not> required.
Support for the "!" tag indicator is B<not> required.
Support for the "|" literal block indicator is required.
Support for the ">" folded block indicator is required.
Support for the "'" single quote indicator is required.
Support for the """ double quote indicator is required.
Support for the "%" directive indicator is required, but only
for the special case of a %YAML version directive before the
"---" document header, or on the same line as the document header.
For example:
%YAML 1.1
---
- A sequence with a single element
Special Exception:
To provide the ability to support empty sequences
and mappings, support for the constructs [] (empty sequence) and {}
(empty mapping) are required.
For example,
%YAML 1.1
# A document consisting of only an empty mapping
--- {}
# A document consisting of only an empty sequence
--- []
# A document consisting of an empty mapping within a sequence
- foo
- {}
- bar
B<Syntax Primitives>
Other than the empty sequence and mapping cases described above, YAML Tiny
supports only the indentation-based block-style group of contexts.
All five scalar contexts are supported.
Indentation spaces work as per the YAML specification in all cases.
Comments work as per the YAML specification in all simple cases.
Support for indented multi-line comments is B<not> required.
Separation spaces work as per the YAML specification in all cases.
B<YAML Tiny Character Stream>
The only directive supported by the YAML Tiny specification is the
%YAML language/version identifier. Although detected, this directive
will have no control over the parsing itself.
=for stopwords recognise
The parser must recognise both the YAML 1.0 and YAML 1.1+ formatting
of this directive (as well as the commented form, although no explicit
code should be needed to deal with this case, being a comment anyway)
That is, all of the following should be supported.
--- #YAML:1.0
- foo
%YAML:1.0
---
- foo
% YAML 1.1
---
- foo
Support for the %TAG directive is B<not> required.
Support for additional directives is B<not> required.
Support for the document boundary marker "---" is required.
Support for the document boundary market "..." is B<not> required.
If necessary, a document boundary should simply by indicated with a
"---" marker, with not preceding "..." marker.
Support for empty streams (containing no documents) is required.
Support for implicit document starts is required.
That is, the following must be equivalent.
# Full form
%YAML 1.1
---
foo: bar
# Implicit form
foo: bar
B<Nodes>
Support for nodes optional anchor and tag properties is B<not> required.
Support for node anchors is B<not> required.
Support for node tags is B<not> required.
Support for alias nodes is B<not> required.
Support for flow nodes is B<not> required.
Support for block nodes is required.
B<Scalar Styles>
Support for all five scalar styles is required as per the YAML
specification, although support for quoted scalars spanning more
than one line is B<not> required.
Support for multi-line scalar documents starting on the header
is not required.
Support for the chomping indicators on multi-line scalar styles
is required.
B<Collection Styles>
Support for block-style sequences is required.
Support for flow-style sequences is B<not> required.
Support for block-style mappings is required.
Support for flow-style mappings is B<not> required.
Both sequences and mappings should be able to be arbitrarily
nested.
Support for plain-style mapping keys is required.
Support for quoted keys in mappings is B<not> required.
Support for "?"-indicated explicit keys is B<not> required.
=for stopwords endeth
Here endeth the specification.
=head2 Additional Perl-Specific Notes
For some Perl applications, it's important to know if you really have a
number and not a string.
That is, in some contexts is important that 3 the number is distinctive
from "3" the string.
Because even Perl itself is not trivially able to understand the difference
(certainly without XS-based modules) Perl implementations of the YAML Tiny
specification are not required to retain the distinctiveness of 3 vs "3".
=head1 SUPPORT
Bugs should be reported via the CPAN bug tracker at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=YAML-Tiny>
=begin html
For other issues, or commercial enhancement or support, please contact
<a href="http://ali.as/">Adam Kennedy</a> directly.
=end html
=head1 AUTHOR
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
=head1 SEE ALSO
=over 4
=item * L<YAML>
=item * L<YAML::Syck>
=item * L<Config::Tiny>
=item * L<CSS::Tiny>
=item * L<http://use.perl.org/use.perl.org/_Alias/journal/29427.html>
=item * L<http://ali.as/>
=back
=head1 COPYRIGHT
Copyright 2006 - 2013 Adam Kennedy.
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the
LICENSE file included with this module.
=cut
| 28.663073 | 88 | 0.593944 |
73ead73cbf877e55a7b32b2d20acb95902c07857 | 1,463 | pl | Perl | contrib/ldapmodify.pl | dugword/net-ldap | 17733221e71b906f5503c0f86cef02da58fcf58a | [
"MIT"
]
| null | null | null | contrib/ldapmodify.pl | dugword/net-ldap | 17733221e71b906f5503c0f86cef02da58fcf58a | [
"MIT"
]
| null | null | null | contrib/ldapmodify.pl | dugword/net-ldap | 17733221e71b906f5503c0f86cef02da58fcf58a | [
"MIT"
]
| null | null | null | #! /usr/bin/perl
# $Id: ldapmodify.pl,v 1.1 2001/10/23 15:07:41 gbarr Exp $
=head1 NAME
ldapmodify.pl - A (simplified) ldapmodify clone written in Perl.
=head1 DESCRIPTION
ldapmodify.pl is a simplified ldapmodify clone written in Perl.
=head1 SYNOPSIS
ldapmodify.pl [B<-a>] [B<-c>] [B<-e errors>] [B<-f file>] [B<-D binddn>]
[B<-w passwd>] [B<-h ldaphost>] [B<-p port>]
The options have the same meaning as those for the standard ldapmodify command.
=cut
use Net::LDAP;
use Net::LDAP::LDIF;
use Getopt::Std;
use IO::File;
use vars qw(%opt);
use strict;
getopts('acD:e:f:h:p:P:w:', \%opt);
$opt{h} ||= 'localhost';
my $conn = Net::LDAP->new($opt{h}) or die "$opt{h}: $!\n";
my $result = $conn->bind($opt{D}, password => $opt{w});
$result->code && die("$opt{h}: bind: ", $result->error, "\n");
my $ldif = Net::LDAP::LDIF->new($opt{f}, "r");
$ldif->{changetype} = 'add' if $opt{a};
my $ldiferr;
while (my $change = $ldif->read_entry()) {
print "dn: ", $change->dn, "\n";
my $result = $change->update($conn);
if ($result->code) {
print STDERR "ldapmodify: ", $result->error, "\n";
if ($opt{e}) {
if (!$ldiferr) {
$ldiferr = Net::LDAP::LDIF->new($opt{e}, 'a', change => 1)
or die "$opt{e}: $!\n";
}
print { $ldiferr->{fh} } "# Error: ", $result->error;
$ldiferr->write_entry($change);
print { $ldiferr->{fh} } "\n";
}
last unless $opt{c};
}
print "\n";
}
=head1 AUTHOR
Kartik Subbarao <subbarao@computer.org>
=cut
| 22.859375 | 79 | 0.600137 |
Subsets and Splits