line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#ifdef __cplusplus |
2
|
|
|
|
|
|
|
extern "C" { |
3
|
|
|
|
|
|
|
#endif |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#include "EXTERN.h" |
6
|
|
|
|
|
|
|
#include "perl.h" |
7
|
|
|
|
|
|
|
#include "XSUB.h" |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#if !defined(_AIX) && !defined(__DragonFly__) |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
#else |
12
|
|
|
|
|
|
|
#include |
13
|
|
|
|
|
|
|
#endif |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#ifdef __cplusplus |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
#endif |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
MODULE = Term::Size PACKAGE = Term::Size |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
void |
24
|
|
|
|
|
|
|
chars( f = PerlIO_stdin() ) |
25
|
|
|
|
|
|
|
PerlIO *f; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
PREINIT: |
28
|
2
|
|
|
|
|
|
struct winsize w = { 0, 0, 0, 0 }; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
PPCODE: |
31
|
2
|
50
|
|
|
|
|
if (ioctl(PerlIO_fileno(f), TIOCGWINSZ, &w) == -1) |
32
|
2
|
|
|
|
|
|
XSRETURN(0); |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(w.ws_col))); |
35
|
0
|
0
|
|
|
|
|
if (GIMME != G_SCALAR) |
|
|
0
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(w.ws_row))); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
void |
39
|
|
|
|
|
|
|
pixels( f = PerlIO_stdin() ) |
40
|
|
|
|
|
|
|
PerlIO *f; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
PREINIT: |
43
|
2
|
|
|
|
|
|
struct winsize w = { 0, 0, 0, 0 }; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
PPCODE: |
46
|
2
|
50
|
|
|
|
|
if (ioctl(PerlIO_fileno(f), TIOCGWINSZ, &w) == -1) |
47
|
2
|
|
|
|
|
|
XSRETURN(0); |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(w.ws_xpixel))); |
50
|
0
|
0
|
|
|
|
|
if (GIMME != G_SCALAR) |
|
|
0
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(w.ws_ypixel))); |