1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "./plan9/math.h"
4
5 #define _PLAN9_SOURCE
6 #include <u.h>
7
8 /** Function fpclassify(double) is required by sv.c, which was refactored in perl-5.24 era and uses other libraries to classify floating points. **/
9
10 /* See /sys/src/lib/port/frexp.c */
11 #define SHIFT 20
12
fpclassify(double d)13 int fpclassify(double d) {
14 FPdbleword x;
15
16 /* order matters: only isNaN can operate on NaN */
17 if ( isNaN(d) )
18 return FP_NAN;
19 else if ( isInf(d, 0) )
20 return FP_INFINITE;
21 else if ( d == 0 )
22 return FP_ZERO;
23
24 x.x = fabs(d);
25 return (x.hi >> SHIFT) ? FP_NORMAL : FP_SUBNORMAL;
26 }
27
28 /* Functions mentioned in /sys/include/ape/sys/socket.h but not implemented */
29
recvmsg(int a,struct msghdr * b,int c)30 int recvmsg(int a, struct msghdr *b, int c)
31 {
32 croak("Function \"recvmsg\" not implemented in this version of perl.");
33 return (int)NULL;
34 }
35
sendmsg(int a,struct msghdr * b,int c)36 int sendmsg(int a, struct msghdr *b, int c)
37 {
38 croak("Function \"sendmsg\" not implemented in this version of perl.");
39 return (int)NULL;
40 }
41
42
43 /* Functions mentioned in /sys/include/ape/sys/netdb.h but not implemented */
getnetbyname(const char * a)44 struct netent *getnetbyname(const char *a)
45 {
46 croak("Function \"getnetbyname\" not implemented in this version of perl.");
47 return (struct netent *)NULL;
48 }
49
getnetbyaddr(long a,int b)50 struct netent *getnetbyaddr(long a, int b)
51 {
52 croak("Function \"getnetbyaddr\" not implemented in this version of perl.");
53 return (struct netent *)NULL;
54 }
55
getnetent()56 struct netent *getnetent()
57 {
58 croak("Function \"getnetent\" not implemented in this version of perl.");
59 return (struct netent *)NULL;
60 }
61
getprotobyname(const char * a)62 struct protoent *getprotobyname(const char *a)
63 {
64 croak("Function \"getprotobyname\" not implemented in this version of perl.");
65 return (struct protoent *)NULL;
66 }
67
getprotobynumber(int a)68 struct protoent *getprotobynumber(int a)
69 {
70 croak("Function \"getprotobynumber\" not implemented in this version of perl.");
71 return (struct protoent *)NULL;
72 }
73
getprotoent()74 struct protoent *getprotoent()
75 {
76 croak("Function \"getprotoent\" not implemented in this version of perl.");
77 return (struct protoent *)NULL;
78 }
79
getservbyport(int a,const char * b)80 struct servent *getservbyport(int a, const char *b)
81 {
82 croak("Function \"getservbyport\" not implemented in this version of perl.");
83 return (struct servent *)NULL;
84 }
85
getservent()86 struct servent *getservent()
87 {
88 croak("Function \"getservent\" not implemented in this version of perl.");
89 return (struct servent *)NULL;
90 }
91
sethostent(int a)92 void sethostent(int a)
93 {
94 croak("Function \"sethostent\" not implemented in this version of perl.");
95 }
96
setnetent(int a)97 void setnetent(int a)
98 {
99 croak("Function \"setnetent\" not implemented in this version of perl.");
100 }
101
setprotoent(int a)102 void setprotoent(int a)
103 {
104 croak("Function \"setprotoent\" not implemented in this version of perl.");
105 }
106
setservent(int a)107 void setservent(int a)
108 {
109 croak("Function \"setservent\" not implemented in this version of perl.");
110 }
111
endnetent()112 void endnetent()
113 {
114 croak("Function \"endnetent\" not implemented in this version of perl.");
115 }
116
endprotoent()117 void endprotoent()
118 {
119 croak("Function \"endprotoent\" not implemented in this version of perl.");
120 }
121
endservent()122 void endservent()
123 {
124 croak("Function \"endservent\" not implemented in this version of perl.");
125 }
126