summaryrefslogtreecommitdiff
path: root/plan9/plan9.c
blob: 0cae63e9effc80e086bd8b034938af0ec47a96cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "EXTERN.h"
#include "perl.h"
#include "./plan9/math.h"

#define _PLAN9_SOURCE
#include <u.h>

/** Function fpclassify(double) is required by sv.c, which was refactored in perl-5.24 era and uses other libraries to classify floating points. **/

/* See /sys/src/lib/port/frexp.c */
#define SHIFT 20

int fpclassify(double d) {
        FPdbleword x;

        /* order matters: only isNaN can operate on NaN */
        if ( isNaN(d) )
                return FP_NAN;
        else if ( isInf(d, 0) )
                return FP_INFINITE;
        else if ( d == 0 )
                return FP_ZERO;

        x.x = fabs(d);
        return (x.hi >> SHIFT) ? FP_NORMAL : FP_SUBNORMAL;
}

/* Functions mentioned in /sys/include/ape/sys/socket.h but not implemented */

int recvmsg(int a, struct msghdr *b, int c)
{
    croak("Function \"recvmsg\" not implemented in this version of perl.");
    return (int)NULL;
} 

int sendmsg(int a, struct msghdr *b, int c)
{
    croak("Function \"sendmsg\" not implemented in this version of perl.");
    return (int)NULL;
} 


/* Functions mentioned in /sys/include/ape/sys/netdb.h but not implemented */
struct netent *getnetbyname(const char *a)
{
    croak("Function \"getnetbyname\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct netent *getnetbyaddr(long a, int b)
{
    croak("Function \"getnetbyaddr\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct netent *getnetent()
{
    croak("Function \"getnetent\" not implemented in this version of perl.");
    return (struct netent *)NULL;
}

struct protoent *getprotobyname(const char *a)
{
    croak("Function \"getprotobyname\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct protoent *getprotobynumber(int a)
{
    croak("Function \"getprotobynumber\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct protoent *getprotoent()
{
    croak("Function \"getprotoent\" not implemented in this version of perl.");
    return (struct protoent *)NULL;
}

struct servent *getservbyport(int a, const char *b)
{
    croak("Function \"getservbyport\" not implemented in this version of perl.");
    return (struct servent *)NULL;
}

struct servent *getservent()
{
    croak("Function \"getservent\" not implemented in this version of perl.");
    return (struct servent *)NULL;
}

void sethostent(int a)
{
    croak("Function \"sethostent\" not implemented in this version of perl.");
}

void setnetent(int a)
{
    croak("Function \"setnetent\" not implemented in this version of perl.");
}

void setprotoent(int a)
{
    croak("Function \"setprotoent\" not implemented in this version of perl.");
}

void setservent(int a)
{
    croak("Function \"setservent\" not implemented in this version of perl.");
}

void endnetent()
{
    croak("Function \"endnetent\" not implemented in this version of perl.");
}

void endprotoent()
{
    croak("Function \"endprotoent\" not implemented in this version of perl.");
}

void endservent()
{
    croak("Function \"endservent\" not implemented in this version of perl.");
}