blib/lib/LibUI.pm

filter: Statementstmt 87.5% 14 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 90.9% 20 / 22 CC 1 SCAR 0.5
CC
1
Cov
88%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/LibUI/ScrollingArea.pm ↑ Summary blib/lib/LibUI/Area/Handler.pm »
1 2 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package LibUI 0.02 {
4 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶ use lib '../lib', '../blib/arch', '../blib/lib';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶ use Affix;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶ use Alien::libui;
Subroutine BEGIN: called CC=1 SCAR=2.6
9 use Exporter 'import'; # gives you Exporter's import() method directly
10 use Config;
11 our %EXPORT_TAGS;
12 $|++;
13 #
14 #my $path = '/home/sanko/Downloads/libui-ng-master/build/meson-out/libui.so.0';
15 sub lib () { CORE::state $lib //= Alien::libui->dynamic_libs; $lib }
16 #
17 sub export {
18 my ( $tag, @funcs ) = @_;
19 push @{ $EXPORT_TAGS{$tag} }, map { m[^ui]; $'; } @funcs;
20 }
21  
22 sub func {
23 my ( $func, $params, $ret ) = @_;
24 my $name = $func;
25 $name =~ s[^ui][LibUI::];
26 $name
27 =~ s[LibUI::(Box|Button|Combobox|Control|Menu|NonWrappingMultilineEntry|RadioButtons|Slider|Window)][LibUI::$1::];
28 $name =~ s[::New(.+)$][::$1::new];
29  
30 #warn sprintf '%30s => %-50s', $func, $name;
31 affix( lib, [ $func, $name ], $params, $ret );
32 }
33 #
34 sub Init {
35 my $aggs = @_ ? shift : { Size => 1024 };
36 CORE::state $func
37 //= wrap( lib(), 'uiInit', [ Pointer [ Struct [ Size => Size_t ] ] ], Str );
38 $func->($aggs);
39 }
40  
41 sub Timer($&;$) {
42 my ( $timeout, $coderef, $agg ) = @_;
43 CORE::state $func
44 //= wrap( lib(), 'uiTimer', [ Int, CodeRef [ [Any] => Int ], Any ] => Void );
45 $func->( $timeout, $coderef, $agg // undef );
46 }
47 typedef uiForEach => Enum [qw[uiForEachContinue uiForEachStop]];
48 {
49 export default => qw[uiInit uiUninit uiFreeInitError
50 uiMain uiMainSteps uiMainStep uiQuit
51 uiQueueMain
52 uiTimer
53 uiFreeText
54 ];
55 func( 'uiUninit', [] => Void );
56 func( 'uiMain', [] => Void );
57 func( 'uiQuit', [] => Void );
58  
59 # Undocumented
60 func( 'uiFreeInitError', [Str] => Void );
61 #
62 func( 'uiMainSteps', [] => Void );
63 func( 'uiMainStep', [Int] => Int );
64 #
65 func( 'uiQueueMain', [ CodeRef [ [ Pointer [Void] ] => Void ], Any ] => Void );
66 #
67 affix(
68 lib(),
69 [ 'uiOnShouldQuit', 'LibUI::onShouldQuit' ],
70 [ CodeRef [ [Any] => Int ], Any ] => Void
71 );
72 func( 'uiFreeText', [Str] => Void );
73 }
74 ##############################################################################################
75 #
76 {
77 my %seen;
78 push @{ $EXPORT_TAGS{all} }, grep { !$seen{$_}++ } @{ $EXPORT_TAGS{$_} }
79 for keys %EXPORT_TAGS;
80 our @EXPORT_OK = @{ $EXPORT_TAGS{all} };
81 }
82 };
83 1;
84 #
85 __END__
« blib/lib/LibUI/ScrollingArea.pm ↑ Summary blib/lib/LibUI/Area/Handler.pm »