/
sysimg.jl
271 lines (221 loc) · 5.85 KB
/
sysimg.jl
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
import Core.Intrinsics.ccall
ccall(:jl_new_main_module, Any, ())
baremodule Base
eval(x) = Core.eval(Base,x)
eval(m,x) = Core.eval(m,x)
include = Core.include
include("exports.jl")
if false
# simple print definitions for debugging. enable these if something
# goes wrong during bootstrap before printing code is available.
show(x::ANY) = ccall(:jl_static_show, Void, (Ptr{Void}, Any),
Intrinsics.pointerref(Intrinsics.cglobal(:jl_uv_stdout,Ptr{Void}),1), x)
print(x::ANY) = show(x)
println(x::ANY) = ccall(:jl_, Void, (Any,), x)
print(a::ANY...) = for x=a; print(x); end
end
## Load essential files and libraries
include("base.jl")
include("reflection.jl")
include("build_h.jl")
include("version_git.jl")
include("c.jl")
# core operations & types
include("promotion.jl")
include("tuple.jl")
include("range.jl")
include("cell.jl")
include("expr.jl")
include("error.jl")
# core numeric operations & types
include("bool.jl")
include("number.jl")
include("int.jl")
include("operators.jl")
include("pointer.jl")
include("float.jl")
include("complex.jl")
include("rational.jl")
# core data structures (used by type inference)
include("abstractarray.jl")
include("reduce.jl")
include("subarray.jl")
include("array.jl")
include("bitarray.jl")
include("intset.jl")
include("dict.jl")
include("set.jl")
include("iterator.jl")
# compiler
import Core.Undef # used internally by compiler
include("inference.jl")
# For OS specific stuff in I/O
include("osutils.jl")
const DL_LOAD_PATH = ByteString[]
@osx_only push!(DL_LOAD_PATH, "@executable_path/../lib/julia")
@osx_only push!(DL_LOAD_PATH, "@executable_path/../lib")
# strings & printing
include("char.jl")
include("ascii.jl")
include("utf8.jl")
include("utf16.jl")
include("iobuffer.jl")
include("string.jl")
include("utf8proc.jl")
importall .UTF8proc
include("regex.jl")
include("base64.jl")
importall .Base64
# system & environment
include("libc.jl")
include("env.jl")
include("errno.jl")
using .Errno
include("path.jl")
include("intfuncs.jl")
# I/O
include("task.jl")
include("io.jl")
include("show.jl")
include("stream.jl")
include("socket.jl")
include("stat.jl")
include("fs.jl")
importall .FS
include("process.jl")
include("multimedia.jl")
importall .Multimedia
# TODO: should put this in _init, but need to handle its boolean argument correctly
ccall(:jl_get_uv_hooks, Void, (Cint,), 0)
include("grisu.jl")
import .Grisu.print_shortest
include("printf.jl")
importall .Printf
include("file.jl")
include("methodshow.jl")
# multidimensional arrays
include("cartesian.jl")
using .Cartesian
include("multidimensional.jl")
# FIXME: #5885
colon{T<:FloatingPoint}(start::T, step::T, stop::T) =
step == 0 ? error("step cannot be zero in colon syntax") :
start == stop ? FloatRange{T}(start,step,1,1) :
(0 < step) != (start < stop) ? FloatRange{T}(start,step,1,0) :
FloatRange{T}(frange(start,step,stop)...)
# core math functions
include("floatfuncs.jl")
include("math.jl")
importall .Math
include("primes.jl")
include("float16.jl")
# concurrency and parallelism
include("serialize.jl")
include("multi.jl")
# Polling (requires multi.jl)
include("poll.jl")
# front end & code loading
include("repl.jl")
include("client.jl")
include("loading.jl")
begin
SOURCE_PATH = ""
include = function(path)
prev = SOURCE_PATH
path = joinpath(dirname(prev),path)
SOURCE_PATH = path
Core.include(path)
SOURCE_PATH = prev
end
end
# reduction along dims
include("reducedim.jl") # macros in this file relies on string.jl
# random number generation and statistics
include("statistics.jl")
include("librandom.jl")
include("random.jl")
importall .Random
# basic data structures
include("ordering.jl")
importall .Order
include("collections.jl")
# Combinatorics
include("sort.jl")
importall .Sort
include("combinatorics.jl")
# distributed arrays and memory-mapped arrays
include("darray.jl")
include("mmap.jl")
include("sharedarray.jl")
# utilities - version, timing, help, edit, metaprogramming
include("sysinfo.jl")
import .Sys.CPU_CORES
include("version.jl")
include("datafmt.jl")
include("deepcopy.jl")
include("util.jl")
include("test.jl")
include("meta.jl")
include("i18n.jl")
include("help.jl")
using .I18n
using .Help
push!(I18n.CALLBACKS, Help.clear_cache)
# sparse matrices and linear algebra
include("sparse.jl")
importall .SparseMatrix
include("linalg.jl")
importall .LinAlg
include("broadcast.jl")
importall .Broadcast
# signal processing
include("fftw.jl")
include("dsp.jl")
importall .DSP
# rounding utilities
include("rounding.jl")
importall .Rounding
# BigInts and BigFloats
include("gmp.jl")
importall .GMP
include("mpfr.jl")
importall .MPFR
big(n::Integer) = convert(BigInt,n)
big(x::FloatingPoint) = convert(BigFloat,x)
big(q::Rational) = big(num(q))//big(den(q))
big(z::Complex) = complex(big(real(z)),big(imag(z)))
@vectorize_1arg Number big
# mathematical constants
include("constants.jl")
# Numerical integration
include("quadgk.jl")
importall .QuadGK
# deprecated functions
include("deprecated.jl")
# package manager
include("pkg.jl")
const Git = Pkg.Git
# base graphics API
include("graphics.jl")
# profiler
include("profile.jl")
importall .Profile
function __init__()
# Base library init
reinit_stdio()
Multimedia.reinit_displays() # since Multimedia.displays uses STDOUT as fallback
fdwatcher_init()
end
include("precompile.jl")
include = include_from_node1
# invoke type inference, running the existing inference code on the new
# inference code to cache an optimized version of it.
begin
local atypes = (LambdaStaticData, Tuple, (), LambdaStaticData, Bool)
local minf = _methods(typeinf, atypes, -1)
typeinf_ext(minf[1][3].func.code, atypes, (), minf[1][3].func.code)
end
end # baremodule Base
using Base
importall Base.Operators
Base.isfile("userimg.jl") && Base.include("userimg.jl")