forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsysimg.jl
400 lines (324 loc) · 9.48 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# This file is a part of Julia. License is MIT: http://julialang.org/license
baremodule Base
using Core.Intrinsics
ccall(:jl_set_istopmod, Void, (Bool,), true)
function include(path::AbstractString)
local result
if INCLUDE_STATE === 1
result = Core.include(path)
elseif INCLUDE_STATE === 2
result = _include(path)
elseif INCLUDE_STATE === 3
result = include_from_node1(path)
end
result
end
INCLUDE_STATE = 1 # include = Core.include
include("coreio.jl")
eval(x) = Core.eval(Base, x)
eval(m, x) = Core.eval(m, x)
(::Type{T}){T}(arg) = convert(T, arg)::T
(::Type{VecElement{T}}){T}(arg) = VecElement{T}(convert(T, arg))
convert{T<:VecElement}(::Type{T}, arg) = T(arg)
convert{T<:VecElement}(::Type{T}, arg::T) = arg
# init core docsystem
import Core: @doc, @__doc__, @doc_str
if isdefined(Core, :Inference)
import Core.Inference.CoreDocs
Core.atdoc!(CoreDocs.docm)
end
include("exports.jl")
if false
# simple print definitions for debugging. enable these if something
# goes wrong during bootstrap before printing code is available.
# otherwise, they just just eventually get (noisily) overwritten later
global show, print, println
show(io::IO, x::ANY) = Core.show(io, x)
print(io::IO, a::ANY...) = Core.print(io, a...)
println(io::IO, x::ANY...) = Core.println(io, x...)
end
## Load essential files and libraries
include("essentials.jl")
include("ctypes.jl")
include("base.jl")
include("generator.jl")
include("reflection.jl")
include("options.jl")
# core operations & types
include("promotion.jl")
include("tuple.jl")
include("traits.jl")
include("range.jl")
include("twiceprecision.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("refpointer.jl")
include("checked.jl")
importall .Checked
# vararg Symbol constructor
Symbol(x...) = Symbol(string(x...))
# Define the broadcast function, which is mostly implemented in
# broadcast.jl, so that we can overload broadcast methods for
# specific array types etc.
# --Here, just define fallback routines for broadcasting with no arguments
broadcast(f) = f()
broadcast!(f, X::AbstractArray) = (@inbounds for I in eachindex(X); X[I] = f(); end; X)
# array structures
include("array.jl")
include("abstractarray.jl")
include("subarray.jl")
# Array convenience converting constructors
(::Type{Array{T}}){T}(m::Integer) = Array{T,1}(Int(m))
(::Type{Array{T}}){T}(m::Integer, n::Integer) = Array{T,2}(Int(m), Int(n))
(::Type{Array{T}}){T}(m::Integer, n::Integer, o::Integer) = Array{T,3}(Int(m), Int(n), Int(o))
(::Type{Array{T}}){T}(d::Integer...) = Array{T}(convert(Tuple{Vararg{Int}}, d))
(::Type{Vector})() = Array{Any,1}(0)
(::Type{Vector{T}}){T}(m::Integer) = Array{T,1}(Int(m))
(::Type{Vector})(m::Integer) = Array{Any,1}(Int(m))
(::Type{Matrix{T}}){T}(m::Integer, n::Integer) = Matrix{T}(Int(m), Int(n))
(::Type{Matrix})(m::Integer, n::Integer) = Matrix{Any}(Int(m), Int(n))
# numeric operations
include("hashing.jl")
include("rounding.jl")
importall .Rounding
include("float.jl")
include("complex.jl")
include("rational.jl")
include("multinverses.jl")
using .MultiplicativeInverses
include("abstractarraymath.jl")
include("arraymath.jl")
# define MIME"foo/bar" early so that we can overload 3-arg show
struct MIME{mime} end
macro MIME_str(s)
:(MIME{$(Expr(:quote, Symbol(s)))})
end
include("char.jl")
include("strings/string.jl")
# SIMD loops
include("simdloop.jl")
importall .SimdLoop
# map-reduce operators
include("reduce.jl")
## core structures
include("reshapedarray.jl")
include("bitarray.jl")
include("intset.jl")
include("associative.jl")
include("dict.jl")
include("set.jl")
include("iterators.jl")
using .Iterators: zip, enumerate
using .Iterators: Flatten, product # for generators
# Definition of StridedArray
typealias StridedReshapedArray{T,N,A<:DenseArray} ReshapedArray{T,N,A}
typealias StridedArray{T,N,A<:Union{DenseArray,StridedReshapedArray},I<:Tuple{Vararg{Union{RangeIndex, AbstractCartesianIndex}}}} Union{DenseArray{T,N}, SubArray{T,N,A,I}, StridedReshapedArray{T,N}}
typealias StridedVector{T,A<:Union{DenseArray,StridedReshapedArray},I<:Tuple{Vararg{Union{RangeIndex, AbstractCartesianIndex}}}} Union{DenseArray{T,1}, SubArray{T,1,A,I}, StridedReshapedArray{T,1}}
typealias StridedMatrix{T,A<:Union{DenseArray,StridedReshapedArray},I<:Tuple{Vararg{Union{RangeIndex, AbstractCartesianIndex}}}} Union{DenseArray{T,2}, SubArray{T,2,A,I}, StridedReshapedArray{T,2}}
typealias StridedVecOrMat{T} Union{StridedVector{T}, StridedMatrix{T}}
# For OS specific stuff
include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl)
include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl)
include("osutils.jl")
include("c.jl")
include("sysinfo.jl")
if !isdefined(Core, :Inference)
include("docs/core.jl")
Core.atdoc!(CoreDocs.docm)
end
# Core I/O
include("io.jl")
include("iostream.jl")
include("iobuffer.jl")
# strings & printing
include("intfuncs.jl")
include("strings/strings.jl")
include("parse.jl")
include("shell.jl")
include("regex.jl")
include("show.jl")
# multidimensional arrays
include("cartesian.jl")
using .Cartesian
include("multidimensional.jl")
include("permuteddimsarray.jl")
using .PermutedDimsArrays
# nullable types
include("nullable.jl")
include("broadcast.jl")
importall .Broadcast
# base64 conversions (need broadcast)
include("base64.jl")
importall .Base64
# version
include("version.jl")
# system & environment
include("libc.jl")
using .Libc: getpid, gethostname, time
include("libdl.jl")
using .Libdl: DL_LOAD_PATH
include("env.jl")
# Scheduling
include("libuv.jl")
include("event.jl")
include("task.jl")
include("lock.jl")
include("threads.jl")
include("weakkeydict.jl")
# I/O
include("stream.jl")
include("socket.jl")
include("filesystem.jl")
importall .Filesystem
include("process.jl")
include("multimedia.jl")
importall .Multimedia
include("grisu/grisu.jl")
import .Grisu.print_shortest
include("methodshow.jl")
# core math functions
include("floatfuncs.jl")
include("math.jl")
importall .Math
const (√)=sqrt
const (∛)=cbrt
let SOURCE_PATH = ""
global function _include(path)
prev = SOURCE_PATH
path = joinpath(dirname(prev),path)
SOURCE_PATH = path
Core.include(path)
SOURCE_PATH = prev
end
end
INCLUDE_STATE = 2 # include = _include (from lines above)
# reduction along dims
include("reducedim.jl") # macros in this file relies on string.jl
# basic data structures
include("ordering.jl")
importall .Order
# Combinatorics
include("sort.jl")
importall .Sort
function deepcopy_internal end
# BigInts and BigFloats
include("gmp.jl")
importall .GMP
include("mpfr.jl")
importall .MPFR
big(n::Integer) = convert(BigInt,n)
big(x::AbstractFloat) = convert(BigFloat,x)
big(q::Rational) = big(numerator(q))//big(denominator(q))
include("combinatorics.jl")
# more hashing definitions
include("hashing2.jl")
# random number generation
include("dSFMT.jl")
include("random.jl")
importall .Random
# (s)printf macros
include("printf.jl")
importall .Printf
# metaprogramming
include("meta.jl")
# enums
include("Enums.jl")
importall .Enums
# concurrency and parallelism
include("serialize.jl")
importall .Serializer
include("channels.jl")
# memory-mapped and shared arrays
include("mmap.jl")
import .Mmap
# utilities - timing, help, edit
include("datafmt.jl")
importall .DataFmt
include("deepcopy.jl")
include("interactiveutil.jl")
include("summarysize.jl")
include("replutil.jl")
include("test.jl")
include("i18n.jl")
using .I18n
# frontend
include("initdefs.jl")
include("Terminals.jl")
include("LineEdit.jl")
include("REPLCompletions.jl")
include("REPL.jl")
include("client.jl")
# Stack frames and traces
include("stacktraces.jl")
importall .StackTraces
# misc useful functions & macros
include("util.jl")
# dense linear algebra
include("linalg/linalg.jl")
importall .LinAlg
const ⋅ = dot
const × = cross
# statistics
include("statistics.jl")
# irrational mathematical constants
include("irrationals.jl")
# signal processing
include("dft.jl")
importall .DFT
include("dsp.jl")
importall .DSP
# Fast math
include("fastmath.jl")
importall .FastMath
# libgit2 support
include("libgit2/libgit2.jl")
# package manager
include("pkg/pkg.jl")
# profiler
include("profile.jl")
importall .Profile
# dates
include("dates/Dates.jl")
import .Dates: Date, DateTime, DateFormat, @dateformat_str, now
# sparse matrices, vectors, and sparse linear algebra
include("sparse/sparse.jl")
importall .SparseArrays
include("asyncmap.jl")
include("parallel/Parallel.jl")
importall .Parallel
include("sharedarray.jl")
# code loading
include("loading.jl")
# worker threads
include("threadcall.jl")
# deprecated functions
include("deprecated.jl")
# Some basic documentation
include("docs/helpdb.jl")
include("docs/basedocs.jl")
# Documentation -- should always be included last in sysimg.
include("markdown/Markdown.jl")
include("docs/Docs.jl")
using .Docs, .Markdown
isdefined(Core, :Inference) && Docs.loaddocs(Core.Inference.CoreDocs.DOCS)
function __init__()
# Base library init
reinit_stdio()
Multimedia.reinit_displays() # since Multimedia.displays uses STDOUT as fallback
early_init()
init_load_path()
Parallel.init_parallel()
init_threadcall()
end
INCLUDE_STATE = 3 # include = include_from_node1
include("precompile.jl")
end # baremodule Base
using Base
importall Base.Operators
Base.isfile("userimg.jl") && Base.include("userimg.jl")