nettobac
0.0.0
Network features for FreeBASIC code
nettobac_system.bi
Go to the documentation of this file.
1
/'* \file nettobac_system.bi
2
\brief Header with informations on the executable
3
4
This file contains some macros to create informational texts about the
5
\Proj version, its compile date and target operating system. And also
6
constructor and destructor `SUB`s for non-UNIX systems.
7
8
Copyright (C) LGPLv2.1, see ReadMe.md for details.
9
10
\since 0.0.0
11
'/
12
13
#IF __FB_VERSION__
<
"1.0"
14
#ERROR
Fatal
error
: please compile
WITH
FreeBASIC version 1.0
OR
above
15
#ENDIF
16
17
#IFDEF __FB_UNIX__
18
#INCLUDE
"crt/unistd.bi"
19
#INCLUDE
"crt/netinet/in.bi"
20
#INCLUDE
"crt/sys/select.bi"
21
#INCLUDE
"crt/netdb.bi"
22
#INCLUDE
"crt/arpa/inet.bi"
23
'* The new line charater[s]
24
#DEFINE
NL !
"\n"
&
25
'* The target operation system
26
#DEFINE
TARGET_OS
"UNIX"
27
#ELSEIF DEFINED
(
__FB_DOS__
)
28
#ERROR
Operating
system not
supported
29
#ELSE
30
'&/* Doxygen shouldn't see this
31
#INCLUDE
"windows.bi"
32
#INCLUDE
"win/windef.bi"
33
#INCLUDE
"win/winsock2.bi"
34
#IFNDEF
opensocket
35
#DEFINE
opensocket socket
36
#ENDIF
37
#DEFINE
NL !
"\r\n"
&
38
#DEFINE
TARGET_OS
"windows"
39
'&*/
40
/'* \brief Startup WSA on non-LINUX systems
41
42
On non-UNIX systems we have to call WSAStartup to initialize the
43
network features. This gets done here. The `SUB` runs as a constructor,
44
adapt the priority (`9999`) when your code uses further constructors
45
and you need a custom order.
46
47
\since 0.0.0
48
'/
49
SUB
NetworkInit
()
CONSTRUCTOR 9999
50
DIM AS
WSAData wd
51
WSAStartup(WINSOCK_VERSION, @wd)
52
END SUB
53
54
/'* \brief Cleanup WSA on non-LINUX systems
55
56
On non-UNIX systems we have to call WSACleanup to finish the network
57
features. This gets done here. The `SUB` runs as a destructor, adapt
58
the priority (`9999`) when your code uses further destructors and you
59
need a custom order.
60
61
\since 0.0.0
62
'/
63
SUB
NetworkExit
()
DESTRUCTOR 9999
64
WSACleanup()
65
END SUB
66
#ENDIF
67
68
#IFNDEF
TCP_NODELAY
69
#DEFINE
TCP_NODELAY &h01
'*< Add missing symbol
70
#ENDIF
71
72
'* The version message
73
#DEFINE
MSG_VERS
"0.0.0"
74
75
'* The welcome message
76
#DEFINE
MSG_WELCOME _
77
" nettobac-"
& MSG_VERS &
", License LGPLv2.1"
& NL _
78
" Copyright (C) 2015-2018 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net"
79
80
'* Compiler information
81
#DEFINE
MSG_COMPILE _
82
" Compiled: "
&
__DATE__
&
", "
&
__TIME__
&
" with "
&
__FB_SIGNATURE__
&
" for "
& TARGET_OS
83
84
'* The info text about the current version
85
#DEFINE
MSG_ALL _
86
MSG_WELCOME & NL MSG_COMPILE
87
src
bas
nettobac_system.bi
Generated on Wed Oct 10 2018 16:19:46 for nettobac by
1.8.11