diff --git a/julia-0.6.2/LICENSE.md b/julia-0.6.2/LICENSE.md deleted file mode 100644 index 1d812d2..0000000 --- a/julia-0.6.2/LICENSE.md +++ /dev/null @@ -1,94 +0,0 @@ -The Julia language is licensed under the MIT License. The "language" consists -of the compiler (the contents of src/), most of the standard library (base/), -and some utilities (most of the rest of the files in this repository). See below -for exceptions. - -> Copyright (c) 2009-2016: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, -> and other contributors: -> -> https://github.com/JuliaLang/julia/contributors -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Julia includes code from the following projects, which have their own licenses: - -- [crc32c.c](http://stackoverflow.com/questions/17645167/implementing-sse-4-2s-crc32c-in-software) (CRC-32c checksum code by Mark Adler) [[ZLib](https://opensource.org/licenses/Zlib)]. -- [LDC](https://github.com/ldc-developers/ldc/blob/master/LICENSE) (for ccall/cfunction ABI definitions) [BSD-3]. The portion of code that Julia uses from LDC is [BSD-3] licensed. -- [LLVM](http://releases.llvm.org/3.9.0/LICENSE.TXT) (for parts of src/jitlayers.cpp and src/disasm.cpp) [BSD-3, effectively] -- [MUSL](http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT) (for getopt implementation on Windows) [MIT] -- [MINGW](https://sourceforge.net/p/mingw/mingw-org-wsl/ci/legacy/tree/mingwrt/mingwex/dirname.c) (for dirname implementation on Windows) [MIT] -- [NetBSD](http://www.netbsd.org/about/redistribution.html) (for setjmp, longjmp, and strptime implementations on Windows) [BSD-3] -- [Python](https://docs.python.org/2/license.html) (for strtod implementation on Windows) [BSD-3, effectively] -- [randmtzig.c](https://github.com/JuliaLang/julia/blob/master/test/perf/micro/randmtzig.c) for Gaussian random number generation (for C benchmarks only) [BSD-3] - -The Julia language links to the following external libraries, which have their -own licenses: - -- [FEMTOLISP](https://github.com/JeffBezanson/femtolisp) [BSD-3] -- [LIBUNWIND](http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob_plain;f=LICENSE;hb=master) [MIT] -- [LIBUV](https://github.com/joyent/libuv/blob/master/LICENSE) [MIT] -- [LLVM](http://releases.llvm.org/3.9.0/LICENSE.TXT) [BSD-3, effectively] -- [UTF8PROC](https://github.com/JuliaLang/utf8proc) [MIT] - - -Julia's standard library uses the following external libraries, which have -their own licenses: - -- [ARPACK](http://www.caam.rice.edu/software/ARPACK/RiceBSD.txt#LICENSE) [BSD-3] -- [DSFMT](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/LICENSE.txt) [BSD-3] -- [OPENLIBM](https://github.com/JuliaLang/openlibm/blob/master/LICENSE.md) [MIT, BSD-2, ISC] -- [OPENSPECFUN](https://github.com/JuliaLang/openspecfun) [MIT, public domain] -- [FADDEEVA](http://ab-initio.mit.edu/Faddeeva) [MIT] -- [FFTW](http://fftw.org/doc/License-and-Copyright.html) [GPL2+] -- [GMP](http://gmplib.org/manual/Copying.html#Copying) [LGPL3+ or GPL2+] -- [LIBGIT2](https://github.com/libgit2/libgit2/blob/development/COPYING) [GPL2+ with unlimited linking exception] -- [CURL](https://curl.haxx.se/docs/copyright.html) [MIT/X derivative] -- [LIBSSH2](https://github.com/libssh2/libssh2/blob/master/COPYING) [BSD-3] -- [MBEDTLS](https://tls.mbed.org/how-to-get) [either GPLv2 or Apache 2.0] -- [MPFR](http://www.mpfr.org/mpfr-current/mpfr.html#Copying) [LGPL3+] -- [OPENBLAS](https://raw.github.com/xianyi/OpenBLAS/master/LICENSE) [BSD-3] -- [LAPACK](http://netlib.org/lapack/LICENSE.txt) [BSD-3] -- [PCRE](http://www.pcre.org/licence.txt) [BSD-3] -- [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html) [mix of LGPL2+ and GPL2+; see individual module licenses] - - -The following components of Julia's standard library have separate licenses: - -- base/grisu/* (see [double-conversion](https://github.com/google/double-conversion/blob/master/LICENSE)) -- base/sparse/umfpack.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html)) -- base/sparse/cholmod.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html)) -- base/special/exp.jl (see [FREEBSD MSUN](https://github.com/freebsd/freebsd) [FreeBSD/2-clause BSD/Simplified BSD License]) - - -Julia's build process uses the following external tools: - -- [PATCHELF](http://hydra.nixos.org/build/1524660/download/1/README) -- [OBJCONV](http://www.agner.org/optimize/#objconv) - - -Julia bundles the following external programs and libraries on some platforms: - -- [7-Zip](http://www.7-zip.org/license.txt) -- [BUSYBOX](https://github.com/rmyorston/busybox-w32/blob/master/LICENSE) -- [ZLIB](http://zlib.net/zlib_license.html) -- [LIBEXPAT](http://expat.cvs.sourceforge.net/viewvc/expat/expat/README) - -On some platforms, distributions of Julia contain SSL certificate authority certificates, -released under the [Mozilla Public License](https://en.wikipedia.org/wiki/Mozilla_Public_License). diff --git a/julia-0.6.2/bin/julia b/julia-0.6.2/bin/julia deleted file mode 100755 index 4a06323..0000000 Binary files a/julia-0.6.2/bin/julia and /dev/null differ diff --git a/julia-0.6.2/bin/julia-debug b/julia-0.6.2/bin/julia-debug deleted file mode 100755 index 0d15b1b..0000000 Binary files a/julia-0.6.2/bin/julia-debug and /dev/null differ diff --git a/julia-0.6.2/etc/julia/juliarc.jl b/julia-0.6.2/etc/julia/juliarc.jl deleted file mode 100644 index 3993e62..0000000 --- a/julia-0.6.2/etc/julia/juliarc.jl +++ /dev/null @@ -1,3 +0,0 @@ -# This file should contain site-specific commands to be executed on Julia startup -# Users may store their own personal commands in the user home directory `homedir()`, in a file named `.juliarc.jl` - diff --git a/julia-0.6.2/include/julia/END.h b/julia-0.6.2/include/julia/END.h deleted file mode 100644 index 3f551ac..0000000 --- a/julia-0.6.2/include/julia/END.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 - * $FreeBSD: src/sys/i386/include/asm.h,v 1.14 2007/08/22 04:26:07 jkoshy Exp $ - */ - -#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__) -.size CNAME, . - CNAME -#else -#ifndef _MSC_VER -.end -#else -CNAME endp -end -#endif -#endif - -#undef CNAME -#undef HIDENAME -#undef STR -#undef XSTR -#undef _START_ENTRY -#ifndef __APPLE__ -#undef EXT_ -#undef EXT -#endif diff --git a/julia-0.6.2/include/julia/ENTRY.amd64.h b/julia-0.6.2/include/julia/ENTRY.amd64.h deleted file mode 100644 index 4ad13fc..0000000 --- a/julia-0.6.2/include/julia/ENTRY.amd64.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 - * $FreeBSD: src/sys/amd64/include/asm.h,v 1.18 2007/08/22 04:26:07 jkoshy Exp $ - */ - -#define _START_ENTRY .p2align 4,0x90 -#define STR(csym) #csym -#define XSTR(csym) STR(csym) -#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__) -#ifndef __APPLE__ -#define EXT_(csym) csym -#define EXT(csym) EXT_(csym) -#endif -#define HIDENAME(asmsym) .asmsym -.text -_START_ENTRY -.globl EXT(CNAME) -.type EXT(CNAME),@function -EXT(CNAME): - -#elif defined(_WIN32) -#define EXT_(csym) csym -#define EXT(csym) EXT_(csym) -#define HIDENAME(asmsym) .asmsym - -#ifndef _MSC_VER -.intel_syntax noprefix -.text -_START_ENTRY -.globl EXT(CNAME) -.section .drectve -.ascii " -export:" -.ascii XSTR(CNAME) -.section .text -.def EXT(CNAME) -.scl 2 -.type 32 -.endef -EXT(CNAME): -#else -.code -CNAME proc -#endif - -#endif diff --git a/julia-0.6.2/include/julia/ENTRY.i387.h b/julia-0.6.2/include/julia/ENTRY.i387.h deleted file mode 100644 index d800386..0000000 --- a/julia-0.6.2/include/julia/ENTRY.i387.h +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90 - * $FreeBSD: src/sys/i386/include/asm.h,v 1.14 2007/08/22 04:26:07 jkoshy Exp $ - */ - -#define _START_ENTRY .p2align 2,0x90 -#define STR(csym) #csym -#define XSTR(csym) STR(csym) -#if defined(__linux__) || defined(__FreeBSD__) || defined(__ELF__) -#ifndef __APPLE__ -#define EXT_(csym) csym -#define EXT(csym) EXT_(csym) -#endif -#define HIDENAME(asmsym) .asmsym -.text -_START_ENTRY -.globl EXT(CNAME) -.type EXT(CNAME),@function -EXT(CNAME): - -#elif defined(_WIN32) -#define EXT_(csym) _##csym -#define EXT(csym) EXT_(csym) -#define HIDENAME(asmsym) .asmsym - -#ifndef _MSC_VER -.intel_syntax -.text -_START_ENTRY -.globl EXT(CNAME) -.section .drectve -.ascii " -export:", XSTR(CNAME) -.section .text -.def EXT(CNAME) -.scl 2 -.type 32 -.endef -EXT(CNAME): -#else -.586 -.model small,C -.code -CNAME proc -#endif - -#endif diff --git a/julia-0.6.2/include/julia/MurmurHash3.h b/julia-0.6.2/include/julia/MurmurHash3.h deleted file mode 100644 index 7f29e4d..0000000 --- a/julia-0.6.2/include/julia/MurmurHash3.h +++ /dev/null @@ -1,22 +0,0 @@ -//----------------------------------------------------------------------------- -// MurmurHash3 was written by Austin Appleby, and is placed in the public -// domain. The author hereby disclaims copyright to this source code. - -#ifndef MURMURHASH3_H -#define MURMURHASH3_H - -//----------------------------------------------------------------------------- -// Platform-specific functions and macros -#include - -//----------------------------------------------------------------------------- - -void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); - -void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); - -void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); - -//----------------------------------------------------------------------------- - -#endif // MURMURHASH3_H diff --git a/julia-0.6.2/include/julia/arraylist.h b/julia-0.6.2/include/julia/arraylist.h deleted file mode 100644 index 61ffba1..0000000 --- a/julia-0.6.2/include/julia/arraylist.h +++ /dev/null @@ -1,30 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef ARRAYLIST_H -#define ARRAYLIST_H - -#define AL_N_INLINE 29 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - size_t len; - size_t max; - void **items; - void *_space[AL_N_INLINE]; -} arraylist_t; - -arraylist_t *arraylist_new(arraylist_t *a, size_t size); -void arraylist_free(arraylist_t *a); - -void arraylist_push(arraylist_t *a, void *elt); -void *arraylist_pop(arraylist_t *a); -void arraylist_grow(arraylist_t *a, size_t n); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/bitvector.h b/julia-0.6.2/include/julia/bitvector.h deleted file mode 100644 index 76c4bde..0000000 --- a/julia-0.6.2/include/julia/bitvector.h +++ /dev/null @@ -1,22 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef BITVECTOR_H -#define BITVECTOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT uint32_t *bitvector_new(uint64_t n, int initzero); -JL_DLLEXPORT -uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz, - int initzero); -size_t bitvector_nwords(uint64_t nbits); -JL_DLLEXPORT void bitvector_set(uint32_t *b, uint64_t n, uint32_t c); -JL_DLLEXPORT uint32_t bitvector_get(uint32_t *b, uint64_t n); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/crc32c.h b/julia-0.6.2/include/julia/crc32c.h deleted file mode 100644 index 9dbf41c..0000000 --- a/julia-0.6.2/include/julia/crc32c.h +++ /dev/null @@ -1,19 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef CRC32C_H -#define CRC32C_H 1 - -#include "dtypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT void jl_crc32c_init(int force_sw); -JL_DLLEXPORT uint32_t jl_crc32c(uint32_t crc, const void *buf, size_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* CRC32C_H */ diff --git a/julia-0.6.2/include/julia/dirpath.h b/julia-0.6.2/include/julia/dirpath.h deleted file mode 100644 index ec31dbe..0000000 --- a/julia-0.6.2/include/julia/dirpath.h +++ /dev/null @@ -1,20 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef DIRPATH_H -#define DIRPATH_H - -#ifdef _OS_WINDOWS_ -#define PATHSEPSTRING "\\" -#define PATHLISTSEPSTRING ";" -#if defined(_MSC_VER) || defined(_COMPILER_CLANG_) -#define PATH_MAX MAX_PATH -#endif -#else -#define PATHSEPSTRING "/" -#define PATHLISTSEPSTRING ":" -#ifndef PATH_MAX // many platforms don't have a max path, we define one anyways -#define PATH_MAX 1024 -#endif -#endif - -#endif diff --git a/julia-0.6.2/include/julia/dtypes.h b/julia-0.6.2/include/julia/dtypes.h deleted file mode 100644 index a3aa489..0000000 --- a/julia-0.6.2/include/julia/dtypes.h +++ /dev/null @@ -1,217 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef DTYPES_H -#define DTYPES_H - -#include -#include // double include of stddef.h fixes #3421 -#include -#if defined(_COMPILER_INTEL_) -#include -#else -#include -#endif - -#include "platform.h" - -#if !defined(_OS_WINDOWS_) -#include -#endif - -#if defined(_OS_WINDOWS_) - -#include -#include -#include - -#if !defined(_COMPILER_MINGW_) - -#define strtoull _strtoui64 -#define strtoll _strtoi64 -#define strcasecmp _stricmp -#define strncasecmp _strnicmp -#define snprintf _snprintf -#define stat _stat - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#endif /* !_COMPILER_MINGW_ */ - -#endif /* _OS_WINDOWS_ */ - - -/* - This file defines sane integer types for our target platforms. This - library only runs on machines with the following characteristics: - - - supports integer word sizes of 8, 16, 32, and 64 bits - - uses unsigned and signed 2's complement representations - - all pointer types are the same size - - there is an integer type with the same size as a pointer - - Some features require: - - IEEE 754 single- and double-precision floating point - - We assume the LP64 convention for 64-bit platforms. -*/ - -#ifdef _OS_WINDOWS_ -#define STDCALL __stdcall -# ifdef LIBRARY_EXPORTS -# define JL_DLLEXPORT __declspec(dllexport) -# else -# define JL_DLLEXPORT __declspec(dllimport) -# endif -#else -#define STDCALL -#define JL_DLLEXPORT __attribute__ ((visibility("default"))) -#endif - -#ifdef _OS_LINUX_ -#include -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define PDP_ENDIAN __PDP_ENDIAN -#define BYTE_ORDER __BYTE_ORDER -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) -#include -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#define __BIG_ENDIAN BIG_ENDIAN -#define __PDP_ENDIAN PDP_ENDIAN -#define __BYTE_ORDER BYTE_ORDER -#endif - -#ifdef _OS_WINDOWS_ -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __PDP_ENDIAN 3412 -#define __BYTE_ORDER __LITTLE_ENDIAN -#define __FLOAT_WORD_ORDER __LITTLE_ENDIAN -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define PDP_ENDIAN __PDP_ENDIAN -#define BYTE_ORDER __BYTE_ORDER -#endif - -#define LLT_ALLOC(n) malloc(n) -#define LLT_REALLOC(p,n) realloc((p),(n)) -#define LLT_FREE(x) free(x) - -#if defined(_OS_WINDOWS_) && defined(_COMPILER_INTEL_) -# define STATIC_INLINE static -# define INLINE -#elif defined(_OS_WINDOWS_) && defined(_COMPILER_MICROSOFT_) -# define STATIC_INLINE static __inline -# define INLINE __inline -#else -# define STATIC_INLINE static inline -# define INLINE inline -#endif - -#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_) -# define NOINLINE __declspec(noinline) -# define NOINLINE_DECL(f) __declspec(noinline) f -#else -# define NOINLINE __attribute__((noinline)) -# define NOINLINE_DECL(f) f __attribute__((noinline)) -#endif - -#ifdef _COMPILER_MICROSOFT_ -# ifdef _P64 -# define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) __declspec(align(8)) x -# else -# define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) __declspec(align(4)) x -# endif -#elif defined(__GNUC__) -# define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) x __attribute__ ((aligned (sizeof(void*)))) -#else -# define JL_ATTRIBUTE_ALIGN_PTRSIZE(x) -#endif - -typedef int bool_t; -typedef unsigned char byte_t; /* 1 byte */ - -#ifdef _P64 -#define TOP_BIT 0x8000000000000000 -#define NBITS 64 -typedef uint64_t uint_t; // preferred int type on platform -typedef int64_t int_t; -#else -#define TOP_BIT 0x80000000 -#define NBITS 32 -typedef uint32_t uint_t; -typedef int32_t int_t; -#endif - -STATIC_INLINE unsigned int next_power_of_two(unsigned int val) -{ - /* this function taken from libuv src/unix/core.c */ - val -= 1; - val |= val >> 1; - val |= val >> 2; - val |= val >> 4; - val |= val >> 8; - val |= val >> 16; - val += 1; - return val; -} - -#define LLT_ALIGN(x, sz) (((x) + (sz)-1) & -(sz)) - -// branch prediction annotations -#ifdef __GNUC__ -#define __unlikely(x) __builtin_expect(!!(x), 0) -#define __likely(x) __builtin_expect(!!(x), 1) -#else -#define __unlikely(x) (x) -#define __likely(x) (x) -#endif - -#define DBL_MAXINT 9007199254740992LL -#define FLT_MAXINT 16777216 -#define U64_MAX 18446744073709551615ULL -#define S64_MAX 9223372036854775807LL -#define S64_MIN (-S64_MAX - 1LL) -#define BIT63 0x8000000000000000LL -#define U32_MAX 4294967295L -#define S32_MAX 2147483647L -#define S32_MIN (-S32_MAX - 1L) -#define BIT31 0x80000000 - -#define D_PNAN ((double)+NAN) -#define D_NNAN ((double)-NAN) -#define D_PINF ((double)+INFINITY) -#define D_NINF ((double)-INFINITY) -#define F_PNAN ((float)+NAN) -#define F_NNAN ((float)-NAN) -#define F_PINF ((float)+INFINITY) -#define F_NINF ((float)-INFINITY) - -typedef enum { T_INT8, T_UINT8, T_INT16, T_UINT16, T_INT32, T_UINT32, - T_INT64, T_UINT64, T_FLOAT, T_DOUBLE } numerictype_t; - -#define N_NUMTYPES ((int)T_DOUBLE+1) - -#ifdef _P64 -# define T_PTRDIFF T_INT64 -# define T_SIZE T_UINT64 -#else -# define T_PTRDIFF T_INT32 -# define T_SIZE T_UINT32 -#endif - -#if defined(__GNUC__) && __GNUC__ >= 7 -#define JL_FALLTHROUGH __attribute__((fallthrough)) -#elif defined(__cplusplus) && defined(__clang_major__) && \ - defined(__clang_minor__) && (__clang_major__ > 4 || __clang_minor__ >= 5) -// We require at least clang 3.x -#define JL_FALLTHROUGH [[clang::fallthrough]] -#else -#define JL_FALLTHROUGH -#endif - -#endif /* DTYPES_H */ diff --git a/julia-0.6.2/include/julia/hashing.h b/julia-0.6.2/include/julia/hashing.h deleted file mode 100644 index 9532a35..0000000 --- a/julia-0.6.2/include/julia/hashing.h +++ /dev/null @@ -1,44 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef HASHING_H -#define HASHING_H - -#include "utils.h" -#include "dtypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -uint_t nextipow2(uint_t i); -JL_DLLEXPORT uint32_t int32hash(uint32_t a); -JL_DLLEXPORT uint64_t int64hash(uint64_t key); -JL_DLLEXPORT uint32_t int64to32hash(uint64_t key); -#ifdef _P64 -#define inthash int64hash -#else -#define inthash int32hash -#endif -JL_DLLEXPORT uint64_t memhash(const char *buf, size_t n); -JL_DLLEXPORT uint64_t memhash_seed(const char *buf, size_t n, uint32_t seed); -JL_DLLEXPORT uint32_t memhash32(const char *buf, size_t n); -JL_DLLEXPORT uint32_t memhash32_seed(const char *buf, size_t n, uint32_t seed); - -#ifdef _P64 -STATIC_INLINE uint64_t bitmix(uint64_t a, uint64_t b) -{ - return int64hash(a^bswap_64(b)); -} -#else -STATIC_INLINE uint32_t bitmix(uint32_t a, uint32_t b) -{ - return int64to32hash((((uint64_t)a) << 32) | (uint64_t)b); -} -#endif -#define bitmix(a, b) (bitmix)((uintptr_t)(a), (uintptr_t)(b)) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/htable.h b/julia-0.6.2/include/julia/htable.h deleted file mode 100644 index 968ffb2..0000000 --- a/julia-0.6.2/include/julia/htable.h +++ /dev/null @@ -1,48 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef HTABLE_H -#define HTABLE_H - -#define HT_N_INLINE 32 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - size_t size; - void **table; - void *_space[HT_N_INLINE]; -} htable_t; - -// define this to be an invalid key/value -#define HT_NOTFOUND ((void*)1) - -// initialize and free -htable_t *htable_new(htable_t *h, size_t size); -void htable_free(htable_t *h); - -// clear and (possibly) change size -void htable_reset(htable_t *h, size_t sz); - -#define HTPROT(HTNAME) \ -void *HTNAME##_get(htable_t *h, void *key); \ -void HTNAME##_put(htable_t *h, void *key, void *val); \ -void HTNAME##_adjoin(htable_t *h, void *key, void *val); \ -int HTNAME##_has(htable_t *h, void *key); \ -int HTNAME##_remove(htable_t *h, void *key); \ -void **HTNAME##_bp(htable_t *h, void *key); - -#define HTPROT_R(HTNAME) \ -void *HTNAME##_get_r(htable_t *h, void *key, void *ctx); \ -void HTNAME##_put_r(htable_t *h, void *key, void *val, void *ctx); \ -void HTNAME##_adjoin_r(htable_t *h, void *key, void *val, void *ctx); \ -int HTNAME##_has_r(htable_t *h, void *key, void *ctx); \ -int HTNAME##_remove_r(htable_t *h, void *key, void *ctx); \ -void **HTNAME##_bp_r(htable_t *h, void *key, void *ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/ios.h b/julia-0.6.2/include/julia/ios.h deleted file mode 100644 index be14701..0000000 --- a/julia-0.6.2/include/julia/ios.h +++ /dev/null @@ -1,214 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef IOS_H -#define IOS_H - -#include -#include "uv.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// this flag controls when data actually moves out to the underlying I/O -// channel. memory streams are a special case of this where the data -// never moves out. - -//make it compatible with UV Handles -typedef enum { bm_none=UV_HANDLE_TYPE_MAX+1, bm_line, bm_block, bm_mem } bufmode_t; -typedef enum { bst_none, bst_rd, bst_wr } bufstate_t; - -#define IOS_INLSIZE 54 -#define IOS_BUFSIZE 131072 - -typedef struct { - // the state only indicates where the underlying file position is relative - // to the buffer. reading: at the end. writing: at the beginning. - // in general, you can do any operation in any state. - char *buf; // start of buffer - - int errcode; - -#ifdef _P64 - int _pad_bm; // put bm at same offset as type field of uv_stream_s -#endif - bufmode_t bm; // - bufstate_t state; - - int64_t maxsize; // space allocated to buffer - int64_t size; // length of valid data in buf, >=ndirty - int64_t bpos; // current position in buffer - int64_t ndirty; // # bytes at &buf[0] that need to be written - - int64_t fpos; // cached file pos - size_t lineno; // current line number - - // pointer-size integer to support platforms where it might have - // to be a pointer - long fd; - - unsigned char readable:1; - unsigned char writable:1; - unsigned char ownbuf:1; - unsigned char ownfd:1; - unsigned char _eof:1; - - // this means you can read, seek back, then read the same data - // again any number of times. usually only true for files and strings. - unsigned char rereadable:1; - - // this enables "stenciled writes". you can alternately write and - // seek without flushing in between. this performs read-before-write - // to populate the buffer, so "rereadable" capability is required. - // this is off by default. - //unsigned char stenciled:1; - - // request durable writes (fsync) - // unsigned char durable:1; - - int64_t userdata; - char local[IOS_INLSIZE]; -} ios_t; - -extern void (*ios_set_io_wait_func)(int); -/* low-level interface functions */ -JL_DLLEXPORT size_t ios_read(ios_t *s, char *dest, size_t n); -JL_DLLEXPORT size_t ios_readall(ios_t *s, char *dest, size_t n); -JL_DLLEXPORT size_t ios_write(ios_t *s, const char *data, size_t n); -JL_DLLEXPORT int64_t ios_seek(ios_t *s, int64_t pos); // absolute seek -JL_DLLEXPORT int64_t ios_seek_end(ios_t *s); -JL_DLLEXPORT int64_t ios_skip(ios_t *s, int64_t offs); // relative seek -JL_DLLEXPORT int64_t ios_pos(ios_t *s); // get current position -JL_DLLEXPORT int ios_trunc(ios_t *s, size_t size); -JL_DLLEXPORT int ios_eof(ios_t *s); -JL_DLLEXPORT int ios_eof_blocking(ios_t *s); -JL_DLLEXPORT int ios_flush(ios_t *s); -JL_DLLEXPORT void ios_close(ios_t *s); -JL_DLLEXPORT int ios_isopen(ios_t *s); -JL_DLLEXPORT char *ios_take_buffer(ios_t *s, size_t *psize); // release buffer to caller -// set buffer space to use -JL_DLLEXPORT int ios_setbuf(ios_t *s, char *buf, size_t size, int own); -JL_DLLEXPORT int ios_bufmode(ios_t *s, bufmode_t mode); -JL_DLLEXPORT int ios_get_readable(ios_t *s); -JL_DLLEXPORT int ios_get_writable(ios_t *s); -JL_DLLEXPORT void ios_set_readonly(ios_t *s); -JL_DLLEXPORT size_t ios_copy(ios_t *to, ios_t *from, size_t nbytes); -JL_DLLEXPORT size_t ios_copyall(ios_t *to, ios_t *from); -JL_DLLEXPORT size_t ios_copyuntil(ios_t *to, ios_t *from, char delim); -JL_DLLEXPORT size_t ios_nchomp(ios_t *from, size_t ntowrite); -// ensure at least n bytes are buffered if possible. returns # available. -JL_DLLEXPORT size_t ios_readprep(ios_t *from, size_t n); - -/* stream creation */ -JL_DLLEXPORT -ios_t *ios_file(ios_t *s, const char *fname, int rd, int wr, int create, int trunc); -JL_DLLEXPORT ios_t *ios_mkstemp(ios_t *f, char *fname); -JL_DLLEXPORT ios_t *ios_mem(ios_t *s, size_t initsize); -ios_t *ios_str(ios_t *s, char *str); -ios_t *ios_static_buffer(ios_t *s, char *buf, size_t sz); -JL_DLLEXPORT ios_t *ios_fd(ios_t *s, long fd, int isfile, int own); -// todo: ios_socket -extern JL_DLLEXPORT ios_t *ios_stdin; -extern JL_DLLEXPORT ios_t *ios_stdout; -extern JL_DLLEXPORT ios_t *ios_stderr; -void ios_init_stdstreams(void); - -/* high-level functions - output */ -JL_DLLEXPORT int ios_pututf8(ios_t *s, uint32_t wc); -JL_DLLEXPORT int ios_printf(ios_t *s, const char *format, ...); -JL_DLLEXPORT int ios_vprintf(ios_t *s, const char *format, va_list args); - -/* high-level stream functions - input */ -JL_DLLEXPORT int ios_getutf8(ios_t *s, uint32_t *pwc); -JL_DLLEXPORT int ios_peekutf8(ios_t *s, uint32_t *pwc); -JL_DLLEXPORT char *ios_readline(ios_t *s); - -// discard data buffered for reading -JL_DLLEXPORT void ios_purge(ios_t *s); - -/* stdio-style functions */ -#define IOS_EOF (-1) -JL_DLLEXPORT int ios_putc(int c, ios_t *s); -//wint_t ios_putwc(ios_t *s, wchar_t wc); -JL_DLLEXPORT int ios_getc(ios_t *s); -JL_DLLEXPORT int ios_peekc(ios_t *s); -//wint_t ios_getwc(ios_t *s); -int ios_ungetc(int c, ios_t *s); -//wint_t ios_ungetwc(ios_t *s, wint_t wc); -#define ios_puts(str, s) ios_write(s, str, strlen(str)) - -/* - With memory streams, mixed reads and writes are equivalent to performing - sequences of *p++, as either an lvalue or rvalue. File streams behave - similarly, but other streams might not support this. Using unbuffered - mode makes this more predictable. - - Note on "unget" functions: - There are two kinds of functions here: those that operate on sized - blocks of bytes and those that operate on logical units like "character" - or "integer". The "unget" functions only work on logical units. There - is no "unget n bytes". You can only do an unget after a matching get. - However, data pushed back by an unget is available to all read operations. - The reason for this is that unget is defined in terms of its effect on - the underlying buffer (namely, it rebuffers data as if it had been - buffered but not read yet). IOS reserves the right to perform large block - operations directly, bypassing the buffer. In such a case data was - never buffered, so "rebuffering" has no meaning (i.e. there is no - correspondence between the buffer and the physical stream). - - Single-bit I/O is able to write partial bytes ONLY IF the stream supports - seeking. Also, line buffering is not well-defined in the context of - single-bit I/O, so it might not do what you expect. - - implementation notes: - in order to know where we are in a file, we must ensure the buffer - is only populated from the underlying stream starting with p==buf. - - to switch from writing to reading: flush, set p=buf, cnt=0 - to switch from reading to writing: seek backwards cnt bytes, p=buf, cnt=0 - - when writing: buf starts at curr. physical stream pos, p - buf is how - many bytes we've written logically. cnt==0 - - dirty == (bitpos>0 && state==iost_wr), EXCEPT right after switching from - reading to writing, where we might be in the middle of a byte without - having changed it. - - to write a bit: if !dirty, read up to maxsize-(p-buf) into buffer, then - seek back by the same amount (undo it). write onto those bits. now set - the dirty bit. in this state, we can bit-read up to the end of the byte, - then formally switch to the read state using flush. - - design points: - - data-source independence, including memory streams - - expose buffer to user, allow user-owned buffers - - allow direct I/O, don't always go through buffer - - buffer-internal seeking. makes seeking back 1-2 bytes very fast, - and makes it possible for sockets where it otherwise wouldn't be - - tries to allow switching between reading and writing - - support 64-bit and large files - - efficient, low-latency buffering - - special support for utf8 - - type-aware functions with byte-order swapping service - - position counter for meaningful data offsets with sockets - - theory of operation: - - the buffer is a view of part of a file/stream. you can seek, read, and - write around in it as much as you like, as if it were just a string. - - we keep track of the part of the buffer that's invalid (written to). - we remember whether the position of the underlying stream is aligned - with the end of the buffer (reading mode) or the beginning (writing mode). - - based on this info, we might have to seek back before doing a flush. - - as optimizations, we do no writing if the buffer isn't "dirty", and we - do no reading if the data will only be overwritten. -*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/julia.h b/julia-0.6.2/include/julia/julia.h deleted file mode 100644 index 7b9c2e7..0000000 --- a/julia-0.6.2/include/julia/julia.h +++ /dev/null @@ -1,1844 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef JULIA_H -#define JULIA_H - -//** Configuration options that affect the Julia ABI **// -// if this is not defined, only individual dimension sizes are -// stored and not total length, to save space. -#define STORE_ARRAY_LEN -//** End Configuration options **// - -#include "libsupport.h" -#include -#include - -#include "htable.h" -#include "arraylist.h" - -#include -#ifndef _OS_WINDOWS_ -# define jl_jmp_buf sigjmp_buf -# if defined(_CPU_ARM_) || defined(_CPU_PPC_) -# define MAX_ALIGN 8 -# elif defined(_CPU_AARCH64_) -// int128 is 16 bytes aligned on aarch64 -# define MAX_ALIGN 16 -# else -# define MAX_ALIGN sizeof(void*) -# endif -#else -# define jl_jmp_buf jmp_buf -# include //for _resetstkoflw -# define MAX_ALIGN 8 -#endif - -#ifdef _P64 -#define NWORDS(sz) (((sz)+7)>>3) -#else -#define NWORDS(sz) (((sz)+3)>>2) -#endif - -#if defined(__GNUC__) -# define JL_NORETURN __attribute__ ((noreturn)) -# define JL_CONST_FUNC __attribute__((const)) -#elif defined(_COMPILER_MICROSOFT_) -# define JL_NORETURN __declspec(noreturn) -// This is the closest I can find for __attribute__((const)) -# define JL_CONST_FUNC __declspec(noalias) -#else -# define JL_NORETURN -# define JL_CONST_FUNC -#endif - -#define container_of(ptr, type, member) \ - ((type *) ((char *)(ptr) - offsetof(type, member))) - -typedef struct _jl_taggedvalue_t jl_taggedvalue_t; - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// core data types ------------------------------------------------------------ - -// the common fields are hidden before the pointer, but the following macro is -// used to indicate which types below are subtypes of jl_value_t -#define JL_DATA_TYPE - -typedef struct _jl_value_t jl_value_t; - -struct _jl_taggedvalue_bits { - uintptr_t gc:2; -}; - -struct _jl_taggedvalue_t { - union { - uintptr_t header; - jl_taggedvalue_t *next; - jl_value_t *type; // 16-byte aligned - struct _jl_taggedvalue_bits bits; - }; - // jl_value_t value; -}; - -#define jl_astaggedvalue(v) \ - ((jl_taggedvalue_t*)((char*)(v) - sizeof(jl_taggedvalue_t))) -#define jl_valueof(v) \ - ((jl_value_t*)((char*)(v) + sizeof(jl_taggedvalue_t))) -#define jl_typeof(v) \ - ((jl_value_t*)(jl_astaggedvalue(v)->header & ~(uintptr_t)15)) -static inline void jl_set_typeof(void *v, void *t) -{ - // Do not call this on a value that is already initialized. - jl_taggedvalue_t *tag = jl_astaggedvalue(v); - tag->type = (jl_value_t*)t; -} -#define jl_typeis(v,t) (jl_typeof(v)==(jl_value_t*)(t)) - -// Symbols are interned strings (hash-consed) stored as an invasive binary tree. -// The string data is nul-terminated and hangs off the end of the struct. -typedef struct _jl_sym_t { - JL_DATA_TYPE - struct _jl_sym_t *left; - struct _jl_sym_t *right; - uintptr_t hash; // precomputed hash value - // JL_ATTRIBUTE_ALIGN_PTRSIZE(char name[]); -} jl_sym_t; - -// A numbered SSA value, for optimized code analysis and generation -// the `id` is a unique, small number -typedef struct _jl_ssavalue_t { - JL_DATA_TYPE - ssize_t id; -} jl_ssavalue_t; - -// A SimpleVector is an immutable pointer array -// Data is stored at the end of this variable-length struct. -typedef struct { - JL_DATA_TYPE - size_t length; - // pointer size aligned - // jl_value_t *data[]; -} jl_svec_t; - -typedef struct { - /* - how - allocation style - 0 = data is inlined, or a foreign pointer we don't manage - 1 = julia-allocated buffer that needs to be marked - 2 = malloc-allocated pointer this array object manages - 3 = has a pointer to the object that owns the data - */ - uint16_t how:2; - uint16_t ndims:10; - uint16_t pooled:1; - uint16_t ptrarray:1; // representation is pointer array - uint16_t isshared:1; // data is shared by multiple Arrays - uint16_t isaligned:1; // data allocated with memalign -} jl_array_flags_t; - -typedef struct { - JL_DATA_TYPE - void *data; -#ifdef STORE_ARRAY_LEN - size_t length; -#endif - jl_array_flags_t flags; - uint16_t elsize; - uint32_t offset; // for 1-d only. does not need to get big. - size_t nrows; - union { - // 1d - size_t maxsize; - // Nd - size_t ncols; - }; - // other dim sizes go here for ndims > 2 - - // followed by alignment padding and inline data, or owner pointer -} jl_array_t; - -// compute # of extra words needed to store dimensions -STATIC_INLINE int jl_array_ndimwords(uint32_t ndims) -{ - return (ndims < 3 ? 0 : ndims-2); -} - -typedef struct _jl_datatype_t jl_tupletype_t; -struct _jl_method_instance_t; - -// TypeMap is an implicitly defined type -// that can consist of any of the following nodes: -// typedef TypeMap Union{TypeMapLevel, TypeMapEntry, Void} -// it forms a roughly tree-shaped structure, consisting of nodes of TypeMapLevels -// which split the tree when possible, for example based on the key into the tuple type at `offs` -// when key is a leaftype, (but only when the tree has enough entries for this to be -// more efficient than storing them sorted linearly) -// otherwise the leaf entries are stored sorted, linearly -union jl_typemap_t { - struct _jl_typemap_level_t *node; - struct _jl_typemap_entry_t *leaf; - struct _jl_value_t *unknown; // nothing -}; - -// "jlcall" calling convention signatures. -// This defines the default ABI used by compiled julia functions. -typedef jl_value_t *(*jl_fptr_t)(jl_value_t*, jl_value_t**, uint32_t); -typedef jl_value_t *(*jl_fptr_sparam_t)(jl_svec_t*, jl_value_t*, jl_value_t**, uint32_t); -typedef jl_value_t *(*jl_fptr_linfo_t)(struct _jl_method_instance_t*, jl_value_t**, uint32_t, jl_svec_t*); - -typedef struct { - union { - jl_fptr_t fptr; - jl_fptr_t fptr1; - // constant fptr2; - jl_fptr_sparam_t fptr3; - jl_fptr_linfo_t fptr4; - }; - uint8_t jlcall_api; -} jl_generic_fptr_t; - -typedef struct _jl_llvm_functions_t { - void *functionObject; // jlcall llvm Function - void *specFunctionObject; // specialized llvm Function -} jl_llvm_functions_t; - -// This type describes a single function body -typedef struct _jl_code_info_t { - jl_array_t *code; // Any array of statements - jl_value_t *slottypes; // types of variable slots (or `nothing`) - jl_value_t *ssavaluetypes; // types of ssa values (or count of them) - jl_array_t *slotflags; // local var bit flags - jl_array_t *slotnames; // names of local variables - uint8_t inferred; - uint8_t inlineable; - uint8_t propagate_inbounds; - uint8_t pure; -} jl_code_info_t; - -// This type describes a single method definition, and stores data -// shared by the specializations of a function. -typedef struct _jl_method_t { - JL_DATA_TYPE - jl_sym_t *name; // for error reporting - struct _jl_module_t *module; - jl_sym_t *file; - int32_t line; - - // method's type signature. redundant with TypeMapEntry->specTypes - jl_value_t *sig; - size_t min_world; - - // list of potentially-ambiguous methods (nothing = none, Vector{Any} of Methods otherwise) - jl_value_t *ambig; - - // table of all argument types for which we've inferred or compiled this code - union jl_typemap_t specializations; - - jl_svec_t *sparam_syms; // symbols giving static parameter names - jl_value_t *source; // original code template (jl_code_info_t, but may be compressed), null for builtins - struct _jl_method_instance_t *unspecialized; // unspecialized executable method instance, or null - struct _jl_method_instance_t *generator; // executable code-generating function if isstaged - jl_array_t *roots; // pointers in generated code (shared to reduce memory), or null - - // cache of specializations of this method for invoke(), i.e. - // cases where this method was called even though it was not necessarily - // the most specific for the argument types. - union jl_typemap_t invokes; - - int32_t nargs; - int32_t called; // bit flags: whether each of the first 8 arguments is called - uint8_t isva; - uint8_t isstaged; - uint8_t pure; - -// hidden fields: - uint8_t traced; - // lock for modifications to the method - jl_mutex_t writelock; -} jl_method_t; - -// This type caches the data for a specType signature specialization of a Method -typedef struct _jl_method_instance_t { - JL_DATA_TYPE - jl_value_t *specTypes; // argument types this was specialized for - jl_value_t *rettype; // return type for fptr - jl_svec_t *sparam_vals; // static parameter values, indexed by def->sparam_syms - jl_array_t *backedges; - jl_value_t *inferred; // inferred jl_code_info_t, or value of the function if jlcall_api == 2, or null - jl_value_t *inferred_const; // inferred constant return value, or null - jl_method_t *def; // method this is specialized from, null if this is a toplevel thunk - size_t min_world; - size_t max_world; - uint8_t inInference; // flags to tell if inference is running on this function - uint8_t jlcall_api; // the c-abi for fptr; 0 = jl_fptr_t, 1 = jl_fptr_sparam_t, 2 = constval - uint8_t compile_traced; // if set will notify callback if this linfo is compiled - jl_fptr_t fptr; // jlcall entry point with api specified by jlcall_api - jl_fptr_t unspecialized_ducttape; // if template can't be compiled due to intrinsics, an un-inferred fptr may get stored here, jlcall_api = 1 - - // On the old JIT, handles to all Functions generated for this linfo - // For the new JITs, handles to declarations in the shadow module - // with the same name as the generated functions for this linfo, suitable - // for referencing in LLVM IR - jl_llvm_functions_t functionObjectsDecls; -} jl_method_instance_t; - -// all values are callable as Functions -typedef jl_value_t jl_function_t; - -typedef struct { - JL_DATA_TYPE - jl_sym_t *name; - jl_value_t *lb; // lower bound - jl_value_t *ub; // upper bound -} jl_tvar_t; - -// UnionAll type (iterated union over all values of a variable in certain bounds) -// written `body where lb<:var<:ub` -typedef struct { - JL_DATA_TYPE - jl_tvar_t *var; - jl_value_t *body; -} jl_unionall_t; - -// represents the "name" part of a DataType, describing the syntactic structure -// of a type and storing all data common to different instantiations of the type, -// including a cache for hash-consed allocation of DataType objects. -typedef struct { - JL_DATA_TYPE - jl_sym_t *name; - struct _jl_module_t *module; - jl_svec_t *names; // field names - // `wrapper` is either the only instantiation of the type (if no parameters) - // or a UnionAll accepting parameters to make an instantiation. - jl_value_t *wrapper; - jl_svec_t *cache; // sorted array - jl_svec_t *linearcache; // unsorted array - intptr_t hash; - struct _jl_methtable_t *mt; -} jl_typename_t; - -typedef struct { - JL_DATA_TYPE - jl_value_t *a; - jl_value_t *b; -} jl_uniontype_t; - -// in little-endian, isptr is always the first bit, avoiding the need for a branch in computing isptr -typedef struct { - uint8_t isptr:1; - uint8_t size:7; - uint8_t offset; // offset relative to data start, excluding type tag -} jl_fielddesc8_t; - -typedef struct { - uint16_t isptr:1; - uint16_t size:15; - uint16_t offset; // offset relative to data start, excluding type tag -} jl_fielddesc16_t; - -typedef struct { - uint32_t isptr:1; - uint32_t size:31; - uint32_t offset; // offset relative to data start, excluding type tag -} jl_fielddesc32_t; - -typedef struct { - uint32_t nfields; - uint32_t alignment : 9; // strictest alignment over all fields - uint32_t haspadding : 1; // has internal undefined bytes - uint32_t npointers : 20; // number of pointer fields, top 4 bits are exponent (under-approximation) - uint32_t fielddesc_type : 2; // 0 -> 8, 1 -> 16, 2 -> 32 - // union { - // jl_fielddesc8_t field8[]; - // jl_fielddesc16_t field16[]; - // jl_fielddesc32_t field32[]; - // }; -} jl_datatype_layout_t; - -typedef struct _jl_datatype_t { - JL_DATA_TYPE - jl_typename_t *name; - struct _jl_datatype_t *super; - jl_svec_t *parameters; - jl_svec_t *types; - jl_value_t *instance; // for singletons - const jl_datatype_layout_t *layout; - int32_t size; // TODO: move to _jl_datatype_layout_t - int32_t ninitialized; - uint32_t uid; - uint8_t abstract; - uint8_t mutabl; - // memoized properties - void *struct_decl; //llvm::Type* - void *ditype; // llvm::MDNode* to be used as llvm::DIType(ditype) - int32_t depth; - int8_t hasfreetypevars; - int8_t isleaftype; -} jl_datatype_t; - -typedef struct { - JL_DATA_TYPE - jl_value_t *value; -} jl_weakref_t; - -typedef struct { - // not first-class - jl_sym_t *name; - jl_value_t *value; - jl_value_t *globalref; // cached GlobalRef for this binding - struct _jl_module_t *owner; // for individual imported bindings - unsigned constp:1; - unsigned exportp:1; - unsigned imported:1; - unsigned deprecated:1; -} jl_binding_t; - -typedef struct _jl_module_t { - JL_DATA_TYPE - jl_sym_t *name; - struct _jl_module_t *parent; - htable_t bindings; - arraylist_t usings; // modules with all bindings potentially imported - uint8_t istopmod; - uint64_t uuid; - size_t primary_world; - uint32_t counter; -} jl_module_t; - -// one Type-to-Value entry -typedef struct _jl_typemap_entry_t { - JL_DATA_TYPE - struct _jl_typemap_entry_t *next; // invasive linked list - jl_tupletype_t *sig; // the type signature for this entry - jl_tupletype_t *simplesig; // a simple signature for fast rejection - jl_svec_t *guardsigs; - size_t min_world; - size_t max_world; - union { - jl_value_t *value; - jl_method_instance_t *linfo; // [nullable] for guard entries - jl_method_t *method; - } func; - // memoized properties of sig: - int8_t isleafsig; // isleaftype(sig) & !any(isType, sig) : unsorted and very fast - int8_t issimplesig; // all(isleaftype | isAny | isType | isVararg, sig) : sorted and fast - int8_t va; // isVararg(sig) -} jl_typemap_entry_t; - -// one level in a TypeMap tree -// indexed by key if it is a sublevel in an array -struct jl_ordereddict_t { - jl_array_t *indexes; // Array{Int{8,16,32}} - jl_array_t *values; // Array{union jl_typemap_t} -}; -typedef struct _jl_typemap_level_t { - JL_DATA_TYPE - struct jl_ordereddict_t arg1; - struct jl_ordereddict_t targ; - jl_typemap_entry_t *linear; // union jl_typemap_t (but no more levels) - union jl_typemap_t any; // type at offs is Any - jl_value_t *key; // [nullable] -} jl_typemap_level_t; - -// contains the TypeMap for one Type -typedef struct _jl_methtable_t { - JL_DATA_TYPE - jl_sym_t *name; - union jl_typemap_t defs; - union jl_typemap_t cache; - intptr_t max_args; // max # of non-vararg arguments in a signature - jl_value_t *kwsorter; // keyword argument sorter function - jl_module_t *module; // used for incremental serialization to locate original binding - jl_array_t *backedges; - jl_mutex_t writelock; -} jl_methtable_t; - -typedef struct { - JL_DATA_TYPE - jl_sym_t *head; - jl_array_t *args; - jl_value_t *etype; -} jl_expr_t; - -// constants and type objects ------------------------------------------------- - -// kinds -extern JL_DLLEXPORT jl_datatype_t *jl_typeofbottom_type; -extern JL_DLLEXPORT jl_datatype_t *jl_datatype_type; -extern JL_DLLEXPORT jl_datatype_t *jl_uniontype_type; -extern JL_DLLEXPORT jl_datatype_t *jl_unionall_type; -extern JL_DLLEXPORT jl_datatype_t *jl_tvar_type; - -extern JL_DLLEXPORT jl_datatype_t *jl_any_type; -extern JL_DLLEXPORT jl_unionall_t *jl_type_type; -extern JL_DLLEXPORT jl_unionall_t *jl_typetype_type; -extern JL_DLLEXPORT jl_value_t *jl_ANY_flag; -extern JL_DLLEXPORT jl_datatype_t *jl_typename_type; -extern JL_DLLEXPORT jl_typename_t *jl_type_typename; -extern JL_DLLEXPORT jl_datatype_t *jl_sym_type; -extern JL_DLLEXPORT jl_datatype_t *jl_symbol_type; -extern JL_DLLEXPORT jl_datatype_t *jl_ssavalue_type; -extern JL_DLLEXPORT jl_datatype_t *jl_abstractslot_type; -extern JL_DLLEXPORT jl_datatype_t *jl_slotnumber_type; -extern JL_DLLEXPORT jl_datatype_t *jl_typedslot_type; -extern JL_DLLEXPORT jl_datatype_t *jl_simplevector_type; -extern JL_DLLEXPORT jl_typename_t *jl_tuple_typename; -extern JL_DLLEXPORT jl_typename_t *jl_vecelement_typename; -extern JL_DLLEXPORT jl_datatype_t *jl_anytuple_type; -extern JL_DLLEXPORT jl_datatype_t *jl_emptytuple_type; -#define jl_tuple_type jl_anytuple_type -extern JL_DLLEXPORT jl_unionall_t *jl_anytuple_type_type; -extern JL_DLLEXPORT jl_unionall_t *jl_vararg_type; -extern JL_DLLEXPORT jl_typename_t *jl_vararg_typename; -extern JL_DLLEXPORT jl_datatype_t *jl_task_type; -extern JL_DLLEXPORT jl_datatype_t *jl_function_type; -extern JL_DLLEXPORT jl_datatype_t *jl_builtin_type; - -extern JL_DLLEXPORT jl_value_t *jl_bottom_type; -extern JL_DLLEXPORT jl_datatype_t *jl_method_instance_type; -extern JL_DLLEXPORT jl_datatype_t *jl_code_info_type; -extern JL_DLLEXPORT jl_datatype_t *jl_method_type; -extern JL_DLLEXPORT jl_datatype_t *jl_module_type; -extern JL_DLLEXPORT jl_unionall_t *jl_abstractarray_type; -extern JL_DLLEXPORT jl_unionall_t *jl_densearray_type; -extern JL_DLLEXPORT jl_unionall_t *jl_array_type; -extern JL_DLLEXPORT jl_typename_t *jl_array_typename; -extern JL_DLLEXPORT jl_datatype_t *jl_weakref_type; -extern JL_DLLEXPORT jl_datatype_t *jl_abstractstring_type; -extern JL_DLLEXPORT jl_datatype_t *jl_string_type; -extern JL_DLLEXPORT jl_datatype_t *jl_errorexception_type; -extern JL_DLLEXPORT jl_datatype_t *jl_argumenterror_type; -extern JL_DLLEXPORT jl_datatype_t *jl_loaderror_type; -extern JL_DLLEXPORT jl_datatype_t *jl_initerror_type; -extern JL_DLLEXPORT jl_datatype_t *jl_typeerror_type; -extern JL_DLLEXPORT jl_datatype_t *jl_methoderror_type; -extern JL_DLLEXPORT jl_datatype_t *jl_undefvarerror_type; -extern JL_DLLEXPORT jl_value_t *jl_stackovf_exception; -extern JL_DLLEXPORT jl_value_t *jl_memory_exception; -extern JL_DLLEXPORT jl_value_t *jl_readonlymemory_exception; -extern JL_DLLEXPORT jl_value_t *jl_diverror_exception; -extern JL_DLLEXPORT jl_value_t *jl_domain_exception; -extern JL_DLLEXPORT jl_value_t *jl_overflow_exception; -extern JL_DLLEXPORT jl_value_t *jl_inexact_exception; -extern JL_DLLEXPORT jl_value_t *jl_undefref_exception; -extern JL_DLLEXPORT jl_value_t *jl_interrupt_exception; -extern JL_DLLEXPORT jl_datatype_t *jl_boundserror_type; -extern JL_DLLEXPORT jl_value_t *jl_an_empty_vec_any; - -extern JL_DLLEXPORT jl_datatype_t *jl_bool_type; -extern JL_DLLEXPORT jl_datatype_t *jl_char_type; -extern JL_DLLEXPORT jl_datatype_t *jl_int8_type; -extern JL_DLLEXPORT jl_datatype_t *jl_uint8_type; -extern JL_DLLEXPORT jl_datatype_t *jl_int16_type; -extern JL_DLLEXPORT jl_datatype_t *jl_uint16_type; -extern JL_DLLEXPORT jl_datatype_t *jl_int32_type; -extern JL_DLLEXPORT jl_datatype_t *jl_uint32_type; -extern JL_DLLEXPORT jl_datatype_t *jl_int64_type; -extern JL_DLLEXPORT jl_datatype_t *jl_uint64_type; -extern JL_DLLEXPORT jl_datatype_t *jl_float16_type; -extern JL_DLLEXPORT jl_datatype_t *jl_float32_type; -extern JL_DLLEXPORT jl_datatype_t *jl_float64_type; -extern JL_DLLEXPORT jl_datatype_t *jl_floatingpoint_type; -extern JL_DLLEXPORT jl_datatype_t *jl_number_type; -extern JL_DLLEXPORT jl_datatype_t *jl_void_type; -extern JL_DLLEXPORT jl_unionall_t *jl_complex_type; -extern JL_DLLEXPORT jl_datatype_t *jl_signed_type; -extern JL_DLLEXPORT jl_datatype_t *jl_voidpointer_type; -extern JL_DLLEXPORT jl_unionall_t *jl_pointer_type; -extern JL_DLLEXPORT jl_unionall_t *jl_ref_type; -extern JL_DLLEXPORT jl_typename_t *jl_pointer_typename; - -extern JL_DLLEXPORT jl_value_t *jl_array_uint8_type; -extern JL_DLLEXPORT jl_value_t *jl_array_any_type; -extern JL_DLLEXPORT jl_value_t *jl_array_symbol_type; -extern JL_DLLEXPORT jl_datatype_t *jl_expr_type; -extern JL_DLLEXPORT jl_datatype_t *jl_globalref_type; -extern JL_DLLEXPORT jl_datatype_t *jl_linenumbernode_type; -extern JL_DLLEXPORT jl_datatype_t *jl_labelnode_type; -extern JL_DLLEXPORT jl_datatype_t *jl_gotonode_type; -extern JL_DLLEXPORT jl_datatype_t *jl_quotenode_type; -extern JL_DLLEXPORT jl_datatype_t *jl_newvarnode_type; -extern JL_DLLEXPORT jl_datatype_t *jl_intrinsic_type; -extern JL_DLLEXPORT jl_datatype_t *jl_methtable_type; -extern JL_DLLEXPORT jl_datatype_t *jl_typemap_level_type; -extern JL_DLLEXPORT jl_datatype_t *jl_typemap_entry_type; - -extern JL_DLLEXPORT jl_svec_t *jl_emptysvec; -extern JL_DLLEXPORT jl_value_t *jl_emptytuple; -extern JL_DLLEXPORT jl_value_t *jl_true; -extern JL_DLLEXPORT jl_value_t *jl_false; -extern JL_DLLEXPORT jl_value_t *jl_nothing; - -// some important symbols -extern JL_DLLEXPORT jl_sym_t *jl_incomplete_sym; - -// gc ------------------------------------------------------------------------- - -typedef struct _jl_gcframe_t { - size_t nroots; - struct _jl_gcframe_t *prev; - // actual roots go here -} jl_gcframe_t; - -// NOTE: it is the caller's responsibility to make sure arguments are -// rooted such that the gc can see them on the stack. -// `foo(f(), g())` is not safe, -// since the result of `f()` is not rooted during the call to `g()`, -// and the arguments to foo are not gc-protected during the call to foo. -// foo can't do anything about it, so the caller must do: -// jl_value_t *x=NULL, *y=NULL; JL_GC_PUSH2(&x, &y); -// x = f(); y = g(); foo(x, y) - -#define jl_pgcstack (jl_get_ptls_states()->pgcstack) - -#define JL_GC_PUSH1(arg1) \ - void *__gc_stkf[] = {(void*)3, jl_pgcstack, arg1}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSH2(arg1, arg2) \ - void *__gc_stkf[] = {(void*)5, jl_pgcstack, arg1, arg2}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSH3(arg1, arg2, arg3) \ - void *__gc_stkf[] = {(void*)7, jl_pgcstack, arg1, arg2, arg3}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSH4(arg1, arg2, arg3, arg4) \ - void *__gc_stkf[] = {(void*)9, jl_pgcstack, arg1, arg2, arg3, arg4}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSH5(arg1, arg2, arg3, arg4, arg5) \ - void *__gc_stkf[] = {(void*)11, jl_pgcstack, arg1, arg2, arg3, arg4, arg5}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSH6(arg1, arg2, arg3, arg4, arg5, arg6) \ - void *__gc_stkf[] = {(void*)13, jl_pgcstack, arg1, arg2, arg3, arg4, arg5, arg6}; \ - jl_pgcstack = (jl_gcframe_t*)__gc_stkf; - -#define JL_GC_PUSHARGS(rts_var,n) \ - rts_var = ((jl_value_t**)alloca(((n)+2)*sizeof(jl_value_t*)))+2; \ - ((void**)rts_var)[-2] = (void*)(((size_t)(n))<<1); \ - ((void**)rts_var)[-1] = jl_pgcstack; \ - memset((void*)rts_var, 0, (n)*sizeof(jl_value_t*)); \ - jl_pgcstack = (jl_gcframe_t*)&(((void**)rts_var)[-2]) - -#define JL_GC_POP() (jl_pgcstack = jl_pgcstack->prev) - -JL_DLLEXPORT int jl_gc_enable(int on); -JL_DLLEXPORT int jl_gc_is_enabled(void); -JL_DLLEXPORT int64_t jl_gc_total_bytes(void); -JL_DLLEXPORT uint64_t jl_gc_total_hrtime(void); -JL_DLLEXPORT int64_t jl_gc_diff_total_bytes(void); - -JL_DLLEXPORT void jl_gc_collect(int); - -JL_DLLEXPORT void jl_gc_add_finalizer(jl_value_t *v, jl_function_t *f); -JL_DLLEXPORT void jl_finalize(jl_value_t *o); -JL_DLLEXPORT jl_weakref_t *jl_gc_new_weakref(jl_value_t *value); -JL_DLLEXPORT jl_value_t *jl_gc_alloc_0w(void); -JL_DLLEXPORT jl_value_t *jl_gc_alloc_1w(void); -JL_DLLEXPORT jl_value_t *jl_gc_alloc_2w(void); -JL_DLLEXPORT jl_value_t *jl_gc_alloc_3w(void); -JL_DLLEXPORT jl_value_t *jl_gc_allocobj(size_t sz); - -JL_DLLEXPORT void jl_clear_malloc_data(void); - -// GC write barriers -JL_DLLEXPORT void jl_gc_queue_root(jl_value_t *root); // root isa jl_value_t* - -// Do NOT put a safepoint here -STATIC_INLINE void jl_gc_wb(void *parent, void *ptr) -{ - // parent and ptr isa jl_value_t* - if (__unlikely(jl_astaggedvalue(parent)->bits.gc == 3 && - (jl_astaggedvalue(ptr)->bits.gc & 1) == 0)) - jl_gc_queue_root((jl_value_t*)parent); -} - -STATIC_INLINE void jl_gc_wb_back(void *ptr) // ptr isa jl_value_t* -{ - // if ptr is old - if (__unlikely(jl_astaggedvalue(ptr)->bits.gc == 3)) { - jl_gc_queue_root((jl_value_t*)ptr); - } -} - -JL_DLLEXPORT void *jl_gc_managed_malloc(size_t sz); -JL_DLLEXPORT void *jl_gc_managed_realloc(void *d, size_t sz, size_t oldsz, - int isaligned, jl_value_t *owner); - -// object accessors ----------------------------------------------------------- - -#define jl_svec_len(t) (((jl_svec_t*)(t))->length) -#define jl_svec_set_len_unsafe(t,n) (((jl_svec_t*)(t))->length=(n)) -#define jl_svec_data(t) ((jl_value_t**)((char*)(t) + sizeof(jl_svec_t))) - -STATIC_INLINE jl_value_t *jl_svecref(void *t, size_t i) -{ - assert(jl_typeis(t,jl_simplevector_type)); - assert(i < jl_svec_len(t)); - return jl_svec_data(t)[i]; -} -STATIC_INLINE jl_value_t *jl_svecset(void *t, size_t i, void *x) -{ - assert(jl_typeis(t,jl_simplevector_type)); - assert(i < jl_svec_len(t)); - jl_svec_data(t)[i] = (jl_value_t*)x; - if (x) jl_gc_wb(t, x); - return (jl_value_t*)x; -} - -#ifdef STORE_ARRAY_LEN -#define jl_array_len(a) (((jl_array_t*)(a))->length) -#else -JL_DLLEXPORT size_t jl_array_len_(jl_array_t *a); -#define jl_array_len(a) jl_array_len_((jl_array_t*)(a)) -#endif -#define jl_array_data(a) ((void*)((jl_array_t*)(a))->data) -#define jl_array_dim(a,i) ((&((jl_array_t*)(a))->nrows)[i]) -#define jl_array_dim0(a) (((jl_array_t*)(a))->nrows) -#define jl_array_nrows(a) (((jl_array_t*)(a))->nrows) -#define jl_array_ndims(a) ((int32_t)(((jl_array_t*)a)->flags.ndims)) -#define jl_array_data_owner_offset(ndims) (offsetof(jl_array_t,ncols) + sizeof(size_t)*(1+jl_array_ndimwords(ndims))) // in bytes -#define jl_array_data_owner(a) (*((jl_value_t**)((char*)a + jl_array_data_owner_offset(jl_array_ndims(a))))) - -STATIC_INLINE jl_value_t *jl_array_ptr_ref(void *a, size_t i) -{ - assert(i < jl_array_len(a)); - return ((jl_value_t**)(jl_array_data(a)))[i]; -} -STATIC_INLINE jl_value_t *jl_array_ptr_set(void *a, size_t i, void *x) -{ - assert(i < jl_array_len(a)); - ((jl_value_t**)(jl_array_data(a)))[i] = (jl_value_t*)x; - if (x) { - if (((jl_array_t*)a)->flags.how == 3) { - a = jl_array_data_owner(a); - } - jl_gc_wb(a, x); - } - return (jl_value_t*)x; -} - -STATIC_INLINE uint8_t jl_array_uint8_ref(void *a, size_t i) -{ - assert(i < jl_array_len(a)); - assert(jl_typeis(a, jl_array_uint8_type)); - return ((uint8_t*)(jl_array_data(a)))[i]; -} -STATIC_INLINE void jl_array_uint8_set(void *a, size_t i, uint8_t x) -{ - assert(i < jl_array_len(a)); - assert(jl_typeis(a, jl_array_uint8_type)); - ((uint8_t*)(jl_array_data(a)))[i] = x; -} - -#define jl_exprarg(e,n) (((jl_value_t**)jl_array_data(((jl_expr_t*)(e))->args))[n]) -#define jl_exprargset(e, n, v) jl_array_ptr_set(((jl_expr_t*)(e))->args, n, v) -#define jl_expr_nargs(e) jl_array_len(((jl_expr_t*)(e))->args) - -#define jl_fieldref(s,i) jl_get_nth_field(((jl_value_t*)s),i) -#define jl_nfields(v) jl_datatype_nfields(jl_typeof(v)) - -// Not using jl_fieldref to avoid allocations -#define jl_linenode_line(x) (((intptr_t*)x)[0]) -#define jl_labelnode_label(x) (((intptr_t*)x)[0]) -#define jl_slot_number(x) (((intptr_t*)x)[0]) -#define jl_typedslot_get_type(x) (((jl_value_t**)x)[1]) -#define jl_gotonode_label(x) (((intptr_t*)x)[0]) -#define jl_globalref_mod(s) (*(jl_module_t**)s) -#define jl_globalref_name(s) (((jl_sym_t**)s)[1]) - -#define jl_nparams(t) jl_svec_len(((jl_datatype_t*)(t))->parameters) -#define jl_tparam0(t) jl_svecref(((jl_datatype_t*)(t))->parameters, 0) -#define jl_tparam1(t) jl_svecref(((jl_datatype_t*)(t))->parameters, 1) -#define jl_tparam(t,i) jl_svecref(((jl_datatype_t*)(t))->parameters, i) - -// get a pointer to the data in a datatype -#define jl_data_ptr(v) ((jl_value_t**)v) - -#define jl_array_ptr_data(a) ((jl_value_t**)((jl_array_t*)a)->data) -#define jl_string_data(s) ((char*)s + sizeof(void*)) -#define jl_string_len(s) (*(size_t*)s) - -#define jl_gf_mtable(f) (((jl_datatype_t*)jl_typeof(f))->name->mt) -#define jl_gf_name(f) (jl_gf_mtable(f)->name) - -// struct type info -#define jl_field_name(st,i) (jl_sym_t*)jl_svecref(((jl_datatype_t*)st)->name->names, (i)) -#define jl_field_type(st,i) jl_svecref(((jl_datatype_t*)st)->types, (i)) -#define jl_field_count(st) jl_svec_len(((jl_datatype_t*)st)->types) -#define jl_datatype_size(t) (((jl_datatype_t*)t)->size) -#define jl_datatype_align(t) (((jl_datatype_t*)t)->layout->alignment) -#define jl_datatype_nbits(t) ((((jl_datatype_t*)t)->size)*8) -#define jl_datatype_nfields(t) (((jl_datatype_t*)(t))->layout->nfields) - -// inline version with strong type check to detect typos in a `->name` chain -STATIC_INLINE char *jl_symbol_name_(jl_sym_t *s) -{ - return (char*)s + LLT_ALIGN(sizeof(jl_sym_t), sizeof(void*)); -} -#define jl_symbol_name(s) jl_symbol_name_(s) - -#define jl_dt_layout_fields(d) ((const char*)(d) + sizeof(jl_datatype_layout_t)) - -#define DEFINE_FIELD_ACCESSORS(f) \ - static inline uint32_t jl_field_##f(jl_datatype_t *st, int i) \ - { \ - const jl_datatype_layout_t *ly = st->layout; \ - assert(i >= 0 && (size_t)i < ly->nfields); \ - if (ly->fielddesc_type == 0) { \ - return ((const jl_fielddesc8_t*)jl_dt_layout_fields(ly))[i].f; \ - } \ - else if (ly->fielddesc_type == 1) { \ - return ((const jl_fielddesc16_t*)jl_dt_layout_fields(ly))[i].f; \ - } \ - else { \ - return ((const jl_fielddesc32_t*)jl_dt_layout_fields(ly))[i].f; \ - } \ - } \ - -DEFINE_FIELD_ACCESSORS(offset) -DEFINE_FIELD_ACCESSORS(size) -static inline int jl_field_isptr(jl_datatype_t *st, int i) -{ - const jl_datatype_layout_t *ly = st->layout; - assert(i >= 0 && (size_t)i < ly->nfields); - return ((const jl_fielddesc8_t*)(jl_dt_layout_fields(ly) + (i << (ly->fielddesc_type + 1))))->isptr; -} - -static inline uint32_t jl_fielddesc_size(int8_t fielddesc_type) -{ - if (fielddesc_type == 0) { - return sizeof(jl_fielddesc8_t); - } - else if (fielddesc_type == 1) { - return sizeof(jl_fielddesc16_t); - } - else { - return sizeof(jl_fielddesc32_t); - } -} - -#undef DEFINE_FIELD_ACCESSORS - -// basic predicates ----------------------------------------------------------- -#define jl_is_nothing(v) (((jl_value_t*)(v)) == ((jl_value_t*)jl_nothing)) -#define jl_is_tuple(v) (((jl_datatype_t*)jl_typeof(v))->name == jl_tuple_typename) -#define jl_is_svec(v) jl_typeis(v,jl_simplevector_type) -#define jl_is_simplevector(v) jl_is_svec(v) -#define jl_is_datatype(v) jl_typeis(v,jl_datatype_type) -#define jl_is_mutable(t) (((jl_datatype_t*)t)->mutabl) -#define jl_is_mutable_datatype(t) (jl_is_datatype(t) && (((jl_datatype_t*)t)->mutabl)) -#define jl_is_immutable(t) (!((jl_datatype_t*)t)->mutabl) -#define jl_is_immutable_datatype(t) (jl_is_datatype(t) && (!((jl_datatype_t*)t)->mutabl)) -#define jl_is_uniontype(v) jl_typeis(v,jl_uniontype_type) -#define jl_is_typevar(v) jl_typeis(v,jl_tvar_type) -#define jl_is_unionall(v) jl_typeis(v,jl_unionall_type) -#define jl_is_typename(v) jl_typeis(v,jl_typename_type) -#define jl_is_int8(v) jl_typeis(v,jl_int8_type) -#define jl_is_int16(v) jl_typeis(v,jl_int16_type) -#define jl_is_int32(v) jl_typeis(v,jl_int32_type) -#define jl_is_int64(v) jl_typeis(v,jl_int64_type) -#define jl_is_uint8(v) jl_typeis(v,jl_uint8_type) -#define jl_is_uint16(v) jl_typeis(v,jl_uint16_type) -#define jl_is_uint32(v) jl_typeis(v,jl_uint32_type) -#define jl_is_uint64(v) jl_typeis(v,jl_uint64_type) -#define jl_is_bool(v) jl_typeis(v,jl_bool_type) -#define jl_is_symbol(v) jl_typeis(v,jl_sym_type) -#define jl_is_ssavalue(v) jl_typeis(v,jl_ssavalue_type) -#define jl_is_slot(v) (jl_typeis(v,jl_slotnumber_type) || jl_typeis(v,jl_typedslot_type)) -#define jl_is_expr(v) jl_typeis(v,jl_expr_type) -#define jl_is_globalref(v) jl_typeis(v,jl_globalref_type) -#define jl_is_labelnode(v) jl_typeis(v,jl_labelnode_type) -#define jl_is_gotonode(v) jl_typeis(v,jl_gotonode_type) -#define jl_is_quotenode(v) jl_typeis(v,jl_quotenode_type) -#define jl_is_newvarnode(v) jl_typeis(v,jl_newvarnode_type) -#define jl_is_linenode(v) jl_typeis(v,jl_linenumbernode_type) -#define jl_is_method_instance(v) jl_typeis(v,jl_method_instance_type) -#define jl_is_code_info(v) jl_typeis(v,jl_code_info_type) -#define jl_is_method(v) jl_typeis(v,jl_method_type) -#define jl_is_module(v) jl_typeis(v,jl_module_type) -#define jl_is_mtable(v) jl_typeis(v,jl_methtable_type) -#define jl_is_task(v) jl_typeis(v,jl_task_type) -#define jl_is_string(v) jl_typeis(v,jl_string_type) -#define jl_is_cpointer(v) jl_is_cpointer_type(jl_typeof(v)) -#define jl_is_pointer(v) jl_is_cpointer_type(jl_typeof(v)) -#define jl_is_intrinsic(v) jl_typeis(v,jl_intrinsic_type) - -JL_DLLEXPORT int jl_subtype(jl_value_t *a, jl_value_t *b); - -STATIC_INLINE int jl_is_kind(jl_value_t *v) -{ - return (v==(jl_value_t*)jl_uniontype_type || v==(jl_value_t*)jl_datatype_type || - v==(jl_value_t*)jl_unionall_type || v==(jl_value_t*)jl_typeofbottom_type); -} - -STATIC_INLINE int jl_is_type(jl_value_t *v) -{ - return jl_is_kind(jl_typeof(v)); -} - -STATIC_INLINE int jl_is_primitivetype(void *v) -{ - return (jl_is_datatype(v) && jl_is_immutable(v) && - ((jl_datatype_t*)(v))->layout && - jl_datatype_nfields(v) == 0 && - jl_datatype_size(v) > 0); -} - -STATIC_INLINE int jl_is_structtype(void *v) -{ - return (jl_is_datatype(v) && - (jl_field_count(v) > 0 || - jl_datatype_size(v) == 0) && - !((jl_datatype_t*)(v))->abstract); -} - -STATIC_INLINE int jl_isbits(void *t) // corresponding to isbits() in julia -{ - return (jl_is_datatype(t) && ((jl_datatype_t*)t)->layout && - !((jl_datatype_t*)t)->mutabl && - ((jl_datatype_t*)t)->layout->npointers == 0); -} - -STATIC_INLINE int jl_is_datatype_singleton(jl_datatype_t *d) -{ - return (d->instance != NULL); -} - -STATIC_INLINE int jl_is_datatype_make_singleton(jl_datatype_t *d) -{ - return (!d->abstract && jl_datatype_size(d) == 0 && d != jl_sym_type && d->name != jl_array_typename && - d->uid != 0 && (d->name->names == jl_emptysvec || !d->mutabl)); -} - -STATIC_INLINE int jl_is_abstracttype(void *v) -{ - return (jl_is_datatype(v) && ((jl_datatype_t*)(v))->abstract); -} - -STATIC_INLINE int jl_is_array_type(void *t) -{ - return (jl_is_datatype(t) && - ((jl_datatype_t*)(t))->name == jl_array_typename); -} - -STATIC_INLINE int jl_is_array(void *v) -{ - jl_value_t *t = jl_typeof(v); - return jl_is_array_type(t); -} - -STATIC_INLINE int jl_is_cpointer_type(jl_value_t *t) -{ - return (jl_is_datatype(t) && - ((jl_datatype_t*)(t))->name == ((jl_datatype_t*)jl_pointer_type->body)->name); -} - -STATIC_INLINE int jl_is_abstract_ref_type(jl_value_t *t) -{ - return (jl_is_datatype(t) && - ((jl_datatype_t*)(t))->name == ((jl_datatype_t*)jl_ref_type->body)->name); -} - -STATIC_INLINE int jl_is_tuple_type(void *t) -{ - return (jl_is_datatype(t) && - ((jl_datatype_t*)(t))->name == jl_tuple_typename); -} - -STATIC_INLINE int jl_is_vecelement_type(jl_value_t* t) -{ - return (jl_is_datatype(t) && - ((jl_datatype_t*)(t))->name == jl_vecelement_typename); -} - -STATIC_INLINE int jl_is_type_type(jl_value_t *v) -{ - return (jl_is_datatype(v) && - ((jl_datatype_t*)(v))->name == ((jl_datatype_t*)jl_type_type->body)->name); -} - -// object identity -JL_DLLEXPORT int jl_egal(jl_value_t *a, jl_value_t *b); -JL_DLLEXPORT uintptr_t jl_object_id(jl_value_t *v); - -// type predicates and basic operations -JL_DLLEXPORT int jl_is_leaf_type(jl_value_t *v); -JL_DLLEXPORT int jl_has_free_typevars(jl_value_t *v); -JL_DLLEXPORT int jl_has_typevar(jl_value_t *t, jl_tvar_t *v); -JL_DLLEXPORT int jl_has_typevar_from_unionall(jl_value_t *t, jl_unionall_t *ua); -JL_DLLEXPORT int jl_subtype_env_size(jl_value_t *t); -JL_DLLEXPORT int jl_subtype_env(jl_value_t *x, jl_value_t *y, jl_value_t **env, int envsz); -JL_DLLEXPORT int jl_isa(jl_value_t *a, jl_value_t *t); -JL_DLLEXPORT int jl_types_equal(jl_value_t *a, jl_value_t *b); -JL_DLLEXPORT jl_value_t *jl_type_union(jl_value_t **ts, size_t n); -JL_DLLEXPORT jl_value_t *jl_type_intersection(jl_value_t *a, jl_value_t *b); -JL_DLLEXPORT int jl_has_empty_intersection(jl_value_t *x, jl_value_t *y); -JL_DLLEXPORT jl_value_t *jl_type_unionall(jl_tvar_t *v, jl_value_t *body); -JL_DLLEXPORT const char *jl_typename_str(jl_value_t *v); -JL_DLLEXPORT const char *jl_typeof_str(jl_value_t *v); -JL_DLLEXPORT int jl_type_morespecific(jl_value_t *a, jl_value_t *b); -jl_value_t *jl_unwrap_unionall(jl_value_t *v); -jl_value_t *jl_rewrap_unionall(jl_value_t *t, jl_value_t *u); - -#if defined(NDEBUG) && defined(JL_NDEBUG) -STATIC_INLINE int jl_is_leaf_type_(jl_value_t *v) -{ - return jl_is_datatype(v) && ((jl_datatype_t*)v)->isleaftype; -} -#define jl_is_leaf_type(v) jl_is_leaf_type_(v) -#endif - -// type constructors -JL_DLLEXPORT jl_typename_t *jl_new_typename(jl_sym_t *name); -JL_DLLEXPORT jl_tvar_t *jl_new_typevar(jl_sym_t *name, jl_value_t *lb, jl_value_t *ub); -JL_DLLEXPORT jl_value_t *jl_instantiate_unionall(jl_unionall_t *u, jl_value_t *p); -JL_DLLEXPORT jl_value_t *jl_apply_type(jl_value_t *tc, jl_value_t **params, size_t n); -JL_DLLEXPORT jl_value_t *jl_apply_type1(jl_value_t *tc, jl_value_t *p1); -JL_DLLEXPORT jl_value_t *jl_apply_type2(jl_value_t *tc, jl_value_t *p1, jl_value_t *p2); -JL_DLLEXPORT jl_tupletype_t *jl_apply_tuple_type(jl_svec_t *params); -JL_DLLEXPORT jl_tupletype_t *jl_apply_tuple_type_v(jl_value_t **p, size_t np); -JL_DLLEXPORT jl_datatype_t *jl_new_datatype(jl_sym_t *name, jl_datatype_t *super, - jl_svec_t *parameters, - jl_svec_t *fnames, jl_svec_t *ftypes, - int abstract, int mutabl, - int ninitialized); -JL_DLLEXPORT jl_datatype_t *jl_new_primitivetype(jl_value_t *name, - jl_datatype_t *super, - jl_svec_t *parameters, size_t nbits); - -// constructors -JL_DLLEXPORT jl_value_t *jl_new_bits(jl_value_t *bt, void *data); -JL_DLLEXPORT jl_value_t *jl_new_struct(jl_datatype_t *type, ...); -JL_DLLEXPORT jl_value_t *jl_new_structv(jl_datatype_t *type, jl_value_t **args, - uint32_t na); -JL_DLLEXPORT jl_value_t *jl_new_struct_uninit(jl_datatype_t *type); -JL_DLLEXPORT jl_method_instance_t *jl_new_method_instance_uninit(void); -JL_DLLEXPORT jl_svec_t *jl_svec(size_t n, ...); -JL_DLLEXPORT jl_svec_t *jl_svec1(void *a); -JL_DLLEXPORT jl_svec_t *jl_svec2(void *a, void *b); -JL_DLLEXPORT jl_svec_t *jl_alloc_svec(size_t n); -JL_DLLEXPORT jl_svec_t *jl_alloc_svec_uninit(size_t n); -JL_DLLEXPORT jl_svec_t *jl_svec_copy(jl_svec_t *a); -JL_DLLEXPORT jl_svec_t *jl_svec_fill(size_t n, jl_value_t *x); -JL_DLLEXPORT jl_value_t *jl_tupletype_fill(size_t n, jl_value_t *v); -JL_DLLEXPORT jl_sym_t *jl_symbol(const char *str); -JL_DLLEXPORT jl_sym_t *jl_symbol_lookup(const char *str); -JL_DLLEXPORT jl_sym_t *jl_symbol_n(const char *str, size_t len); -JL_DLLEXPORT jl_sym_t *jl_gensym(void); -JL_DLLEXPORT jl_sym_t *jl_tagged_gensym(const char *str, int32_t len); -JL_DLLEXPORT jl_sym_t *jl_get_root_symbol(void); -JL_DLLEXPORT jl_value_t *jl_generic_function_def(jl_sym_t *name, jl_value_t **bp, - jl_value_t *bp_owner, - jl_binding_t *bnd); -JL_DLLEXPORT void jl_method_def(jl_svec_t *argdata, jl_code_info_t *f, jl_value_t *isstaged); -JL_DLLEXPORT jl_code_info_t *jl_code_for_staged(jl_method_instance_t *linfo); -JL_DLLEXPORT jl_code_info_t *jl_copy_code_info(jl_code_info_t *src); -JL_DLLEXPORT size_t jl_get_world_counter(void); -JL_DLLEXPORT jl_function_t *jl_get_kwsorter(jl_value_t *ty); -JL_DLLEXPORT jl_value_t *jl_box_bool(int8_t x); -JL_DLLEXPORT jl_value_t *jl_box_int8(int8_t x); -JL_DLLEXPORT jl_value_t *jl_box_uint8(uint8_t x); -JL_DLLEXPORT jl_value_t *jl_box_int16(int16_t x); -JL_DLLEXPORT jl_value_t *jl_box_uint16(uint16_t x); -JL_DLLEXPORT jl_value_t *jl_box_int32(int32_t x); -JL_DLLEXPORT jl_value_t *jl_box_uint32(uint32_t x); -JL_DLLEXPORT jl_value_t *jl_box_char(uint32_t x); -JL_DLLEXPORT jl_value_t *jl_box_int64(int64_t x); -JL_DLLEXPORT jl_value_t *jl_box_uint64(uint64_t x); -JL_DLLEXPORT jl_value_t *jl_box_float32(float x); -JL_DLLEXPORT jl_value_t *jl_box_float64(double x); -JL_DLLEXPORT jl_value_t *jl_box_voidpointer(void *x); -JL_DLLEXPORT jl_value_t *jl_box_ssavalue(size_t x); -JL_DLLEXPORT jl_value_t *jl_box_slotnumber(size_t x); -JL_DLLEXPORT jl_value_t *jl_box8 (jl_datatype_t *t, int8_t x); -JL_DLLEXPORT jl_value_t *jl_box16(jl_datatype_t *t, int16_t x); -JL_DLLEXPORT jl_value_t *jl_box32(jl_datatype_t *t, int32_t x); -JL_DLLEXPORT jl_value_t *jl_box64(jl_datatype_t *t, int64_t x); -JL_DLLEXPORT int8_t jl_unbox_bool(jl_value_t *v); -JL_DLLEXPORT int8_t jl_unbox_int8(jl_value_t *v); -JL_DLLEXPORT uint8_t jl_unbox_uint8(jl_value_t *v); -JL_DLLEXPORT int16_t jl_unbox_int16(jl_value_t *v); -JL_DLLEXPORT uint16_t jl_unbox_uint16(jl_value_t *v); -JL_DLLEXPORT int32_t jl_unbox_int32(jl_value_t *v); -JL_DLLEXPORT uint32_t jl_unbox_uint32(jl_value_t *v); -JL_DLLEXPORT int64_t jl_unbox_int64(jl_value_t *v); -JL_DLLEXPORT uint64_t jl_unbox_uint64(jl_value_t *v); -JL_DLLEXPORT float jl_unbox_float32(jl_value_t *v); -JL_DLLEXPORT double jl_unbox_float64(jl_value_t *v); -JL_DLLEXPORT void *jl_unbox_voidpointer(jl_value_t *v); - -JL_DLLEXPORT int jl_get_size(jl_value_t *val, size_t *pnt); - -#ifdef _P64 -#define jl_box_long(x) jl_box_int64(x) -#define jl_box_ulong(x) jl_box_uint64(x) -#define jl_unbox_long(x) jl_unbox_int64(x) -#define jl_is_long(x) jl_is_int64(x) -#define jl_long_type jl_int64_type -#define jl_ulong_type jl_uint64_type -#else -#define jl_box_long(x) jl_box_int32(x) -#define jl_box_ulong(x) jl_box_uint32(x) -#define jl_unbox_long(x) jl_unbox_int32(x) -#define jl_is_long(x) jl_is_int32(x) -#define jl_long_type jl_int32_type -#define jl_ulong_type jl_uint32_type -#endif - -// Each tuple can exist in one of 4 Vararg states: -// NONE: no vararg Tuple{Int,Float32} -// INT: vararg with integer length Tuple{Int,Vararg{Float32,2}} -// BOUND: vararg with bound TypeVar length Tuple{Int,Vararg{Float32,N}} -// UNBOUND: vararg with unbound length Tuple{Int,Vararg{Float32}} -typedef enum { - JL_VARARG_NONE = 0, - JL_VARARG_INT = 1, - JL_VARARG_BOUND = 2, - JL_VARARG_UNBOUND = 3 -} jl_vararg_kind_t; - -STATIC_INLINE int jl_is_vararg_type(jl_value_t *v) -{ - v = jl_unwrap_unionall(v); - return (jl_is_datatype(v) && - ((jl_datatype_t*)(v))->name == jl_vararg_typename); -} - -STATIC_INLINE jl_value_t *jl_unwrap_vararg(jl_value_t *v) -{ - return jl_tparam0(jl_unwrap_unionall(v)); -} - -STATIC_INLINE jl_vararg_kind_t jl_vararg_kind(jl_value_t *v) -{ - if (!jl_is_vararg_type(v)) - return JL_VARARG_NONE; - jl_tvar_t *v1=NULL, *v2=NULL; - if (jl_is_unionall(v)) { - v1 = ((jl_unionall_t*)v)->var; - v = ((jl_unionall_t*)v)->body; - if (jl_is_unionall(v)) { - v2 = ((jl_unionall_t*)v)->var; - v = ((jl_unionall_t*)v)->body; - } - } - assert(jl_is_datatype(v)); - jl_value_t *lenv = jl_tparam1(v); - if (jl_is_long(lenv)) - return JL_VARARG_INT; - if (jl_is_typevar(lenv) && lenv != (jl_value_t*)v1 && lenv != (jl_value_t*)v2) - return JL_VARARG_BOUND; - return JL_VARARG_UNBOUND; -} - -STATIC_INLINE int jl_is_va_tuple(jl_datatype_t *t) -{ - assert(jl_is_tuple_type(t)); - size_t l = jl_svec_len(t->parameters); - return (l>0 && jl_is_vararg_type(jl_tparam(t,l-1))); -} - -STATIC_INLINE jl_vararg_kind_t jl_va_tuple_kind(jl_datatype_t *t) -{ - t = (jl_datatype_t*)jl_unwrap_unionall((jl_value_t*)t); - assert(jl_is_tuple_type(t)); - size_t l = jl_svec_len(t->parameters); - if (l == 0) - return JL_VARARG_NONE; - return jl_vararg_kind(jl_tparam(t,l-1)); -} - -// structs -JL_DLLEXPORT int jl_field_index(jl_datatype_t *t, jl_sym_t *fld, int err); -JL_DLLEXPORT jl_value_t *jl_get_nth_field(jl_value_t *v, size_t i); -JL_DLLEXPORT jl_value_t *jl_get_nth_field_checked(jl_value_t *v, size_t i); -JL_DLLEXPORT void jl_set_nth_field(jl_value_t *v, size_t i, - jl_value_t *rhs); -JL_DLLEXPORT int jl_field_isdefined(jl_value_t *v, size_t i); -JL_DLLEXPORT jl_value_t *jl_get_field(jl_value_t *o, const char *fld); -JL_DLLEXPORT jl_value_t *jl_value_ptr(jl_value_t *a); - -// arrays -JL_DLLEXPORT jl_array_t *jl_new_array(jl_value_t *atype, jl_value_t *dims); -JL_DLLEXPORT jl_array_t *jl_reshape_array(jl_value_t *atype, jl_array_t *data, - jl_value_t *dims); -JL_DLLEXPORT jl_array_t *jl_ptr_to_array_1d(jl_value_t *atype, void *data, - size_t nel, int own_buffer); -JL_DLLEXPORT jl_array_t *jl_ptr_to_array(jl_value_t *atype, void *data, - jl_value_t *dims, int own_buffer); - -JL_DLLEXPORT jl_array_t *jl_alloc_array_1d(jl_value_t *atype, size_t nr); -JL_DLLEXPORT jl_array_t *jl_alloc_array_2d(jl_value_t *atype, size_t nr, - size_t nc); -JL_DLLEXPORT jl_array_t *jl_alloc_array_3d(jl_value_t *atype, size_t nr, - size_t nc, size_t z); -JL_DLLEXPORT jl_array_t *jl_pchar_to_array(const char *str, size_t len); -JL_DLLEXPORT jl_value_t *jl_pchar_to_string(const char *str, size_t len); -JL_DLLEXPORT jl_value_t *jl_cstr_to_string(const char *str); -JL_DLLEXPORT jl_value_t *jl_alloc_string(size_t len); -JL_DLLEXPORT jl_value_t *jl_array_to_string(jl_array_t *a); -JL_DLLEXPORT jl_array_t *jl_alloc_vec_any(size_t n); -JL_DLLEXPORT jl_value_t *jl_arrayref(jl_array_t *a, size_t i); // 0-indexed -JL_DLLEXPORT void jl_arrayset(jl_array_t *a, jl_value_t *v, size_t i); // 0-indexed -JL_DLLEXPORT void jl_arrayunset(jl_array_t *a, size_t i); // 0-indexed -JL_DLLEXPORT void jl_array_grow_end(jl_array_t *a, size_t inc); -JL_DLLEXPORT void jl_array_del_end(jl_array_t *a, size_t dec); -JL_DLLEXPORT void jl_array_grow_beg(jl_array_t *a, size_t inc); -JL_DLLEXPORT void jl_array_del_beg(jl_array_t *a, size_t dec); -JL_DLLEXPORT void jl_array_sizehint(jl_array_t *a, size_t sz); -JL_DLLEXPORT void jl_array_ptr_1d_push(jl_array_t *a, jl_value_t *item); -JL_DLLEXPORT void jl_array_ptr_1d_push2(jl_array_t *a, jl_value_t *b, jl_value_t *c); -JL_DLLEXPORT void jl_array_ptr_1d_append(jl_array_t *a, jl_array_t *a2); -JL_DLLEXPORT jl_value_t *jl_apply_array_type(jl_value_t *type, size_t dim); -// property access -JL_DLLEXPORT void *jl_array_ptr(jl_array_t *a); -JL_DLLEXPORT void *jl_array_eltype(jl_value_t *a); -JL_DLLEXPORT int jl_array_rank(jl_value_t *a); -JL_DLLEXPORT size_t jl_array_size(jl_value_t *a, int d); - -// strings -JL_DLLEXPORT const char *jl_string_ptr(jl_value_t *s); - -// modules and global variables -extern JL_DLLEXPORT jl_module_t *jl_main_module; -extern JL_DLLEXPORT jl_module_t *jl_internal_main_module; -extern JL_DLLEXPORT jl_module_t *jl_core_module; -extern JL_DLLEXPORT jl_module_t *jl_base_module; -extern JL_DLLEXPORT jl_module_t *jl_top_module; -JL_DLLEXPORT jl_module_t *jl_new_module(jl_sym_t *name); -// get binding for reading -JL_DLLEXPORT jl_binding_t *jl_get_binding(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT jl_binding_t *jl_get_binding_or_error(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT jl_value_t *jl_module_globalref(jl_module_t *m, jl_sym_t *var); -// get binding for assignment -JL_DLLEXPORT jl_binding_t *jl_get_binding_wr(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT jl_binding_t *jl_get_binding_for_method_def(jl_module_t *m, - jl_sym_t *var); -JL_DLLEXPORT int jl_boundp(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT int jl_defines_or_exports_p(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT int jl_binding_resolved_p(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT int jl_is_const(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT jl_value_t *jl_get_global(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT void jl_set_global(jl_module_t *m, jl_sym_t *var, jl_value_t *val); -JL_DLLEXPORT void jl_set_const(jl_module_t *m, jl_sym_t *var, jl_value_t *val); -JL_DLLEXPORT void jl_checked_assignment(jl_binding_t *b, jl_value_t *rhs); -JL_DLLEXPORT void jl_declare_constant(jl_binding_t *b); -JL_DLLEXPORT void jl_module_using(jl_module_t *to, jl_module_t *from); -JL_DLLEXPORT void jl_module_use(jl_module_t *to, jl_module_t *from, jl_sym_t *s); -JL_DLLEXPORT void jl_module_import(jl_module_t *to, jl_module_t *from, - jl_sym_t *s); -JL_DLLEXPORT void jl_module_importall(jl_module_t *to, jl_module_t *from); -JL_DLLEXPORT void jl_module_export(jl_module_t *from, jl_sym_t *s); -JL_DLLEXPORT int jl_is_imported(jl_module_t *m, jl_sym_t *s); -JL_DLLEXPORT int jl_module_exports_p(jl_module_t *m, jl_sym_t *var); -JL_DLLEXPORT jl_module_t *jl_new_main_module(void); -JL_DLLEXPORT void jl_add_standard_imports(jl_module_t *m); -STATIC_INLINE jl_function_t *jl_get_function(jl_module_t *m, const char *name) -{ - return (jl_function_t*)jl_get_global(m, jl_symbol(name)); -} -int jl_is_submodule(jl_module_t *child, jl_module_t *parent); - -// eq hash tables -JL_DLLEXPORT jl_array_t *jl_eqtable_put(jl_array_t *h, void *key, void *val); -JL_DLLEXPORT jl_value_t *jl_eqtable_get(jl_array_t *h, void *key, - jl_value_t *deflt); - -// system information -JL_DLLEXPORT int jl_errno(void); -JL_DLLEXPORT void jl_set_errno(int e); -JL_DLLEXPORT int32_t jl_stat(const char *path, char *statbuf); -JL_DLLEXPORT int jl_cpu_cores(void); -JL_DLLEXPORT long jl_getpagesize(void); -JL_DLLEXPORT long jl_getallocationgranularity(void); -JL_DLLEXPORT int jl_is_debugbuild(void); -JL_DLLEXPORT jl_sym_t *jl_get_UNAME(void); -JL_DLLEXPORT jl_sym_t *jl_get_ARCH(void); -JL_DLLEXPORT uint64_t jl_cpuid_tag(void); -JL_DLLEXPORT int jl_uses_cpuid_tag(void); - -// environment entries -JL_DLLEXPORT jl_value_t *jl_environ(int i); - -// throwing common exceptions -JL_DLLEXPORT void JL_NORETURN jl_error(const char *str); -JL_DLLEXPORT void JL_NORETURN jl_errorf(const char *fmt, ...); -JL_DLLEXPORT void JL_NORETURN jl_exceptionf(jl_datatype_t *ty, - const char *fmt, ...); -JL_DLLEXPORT void JL_NORETURN jl_too_few_args(const char *fname, int min); -JL_DLLEXPORT void JL_NORETURN jl_too_many_args(const char *fname, int max); -JL_DLLEXPORT void JL_NORETURN jl_type_error(const char *fname, - jl_value_t *expected, - jl_value_t *got); -JL_DLLEXPORT void JL_NORETURN jl_type_error_rt(const char *fname, - const char *context, - jl_value_t *ty, jl_value_t *got); -JL_DLLEXPORT void JL_NORETURN jl_undefined_var_error(jl_sym_t *var); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error(jl_value_t *v, jl_value_t *t); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error_v(jl_value_t *v, - jl_value_t **idxs, size_t nidxs); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error_int(jl_value_t *v, size_t i); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error_tuple_int(jl_value_t **v, - size_t nv, size_t i); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error_unboxed_int(void *v, jl_value_t *vt, size_t i); -JL_DLLEXPORT void JL_NORETURN jl_bounds_error_ints(jl_value_t *v, size_t *idxs, size_t nidxs); -JL_DLLEXPORT void JL_NORETURN jl_eof_error(void); -JL_DLLEXPORT jl_value_t *jl_exception_occurred(void); -JL_DLLEXPORT void jl_exception_clear(void); - -#define JL_NARGS(fname, min, max) \ - if (nargs < min) jl_too_few_args(#fname, min); \ - else if (nargs > max) jl_too_many_args(#fname, max); - -#define JL_NARGSV(fname, min) \ - if (nargs < min) jl_too_few_args(#fname, min); - -#define JL_TYPECHK(fname, type, v) \ - if (!jl_is_##type(v)) { \ - jl_type_error(#fname, (jl_value_t*)jl_##type##_type, (v)); \ - } -#define JL_TYPECHKS(fname, type, v) \ - if (!jl_is_##type(v)) { \ - jl_type_error(fname, (jl_value_t*)jl_##type##_type, (v)); \ - } - -// initialization functions -typedef enum { - JL_IMAGE_CWD = 0, - JL_IMAGE_JULIA_HOME = 1, - //JL_IMAGE_LIBJULIA = 2, -} JL_IMAGE_SEARCH; -JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel); -JL_DLLEXPORT void jl_init(void); -JL_DLLEXPORT void jl_init_with_image(const char *julia_home_dir, - const char *image_relative_path); -JL_DLLEXPORT const char *jl_get_default_sysimg_path(void); -JL_DLLEXPORT int jl_is_initialized(void); -JL_DLLEXPORT void jl_atexit_hook(int status); -JL_DLLEXPORT void JL_NORETURN jl_exit(int status); -JL_DLLEXPORT const char *jl_pathname_for_handle(void *handle); - -JL_DLLEXPORT int jl_deserialize_verify_header(ios_t *s); -JL_DLLEXPORT void jl_preload_sysimg_so(const char *fname); -JL_DLLEXPORT void jl_set_sysimg_so(void *handle); -JL_DLLEXPORT ios_t *jl_create_system_image(void); -JL_DLLEXPORT void jl_save_system_image(const char *fname); -JL_DLLEXPORT void jl_restore_system_image(const char *fname); -JL_DLLEXPORT void jl_restore_system_image_data(const char *buf, size_t len); -JL_DLLEXPORT int jl_save_incremental(const char *fname, jl_array_t *worklist); -JL_DLLEXPORT jl_value_t *jl_restore_incremental(const char *fname); -JL_DLLEXPORT jl_value_t *jl_restore_incremental_from_buf(const char *buf, size_t sz); - -// front end interface -JL_DLLEXPORT jl_value_t *jl_parse_input_line(const char *str, size_t len, - const char *filename, size_t filename_len); -JL_DLLEXPORT jl_value_t *jl_parse_string(const char *str, size_t len, - int pos0, int greedy); -JL_DLLEXPORT int jl_parse_depwarn(int warn); -JL_DLLEXPORT jl_value_t *jl_load_file_string(const char *text, size_t len, - char *filename); -JL_DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr); -JL_DLLEXPORT jl_value_t *jl_eval_string(const char *str); - -// external libraries -enum JL_RTLD_CONSTANT { - JL_RTLD_LOCAL=1U, - JL_RTLD_GLOBAL=2U, - JL_RTLD_LAZY=4U, - JL_RTLD_NOW=8U, - /* Linux/glibc and MacOS X: */ - JL_RTLD_NODELETE=16U, - JL_RTLD_NOLOAD=32U, - /* Linux/glibc: */ - JL_RTLD_DEEPBIND=64U, - /* MacOS X 10.5+: */ - JL_RTLD_FIRST=128U -}; -#define JL_RTLD_DEFAULT (JL_RTLD_LAZY | JL_RTLD_DEEPBIND) - -typedef void *jl_uv_libhandle; // compatible with dlopen (void*) / LoadLibrary (HMODULE) -JL_DLLEXPORT jl_uv_libhandle jl_load_dynamic_library(const char *fname, unsigned flags); -JL_DLLEXPORT jl_uv_libhandle jl_load_dynamic_library_e(const char *fname, unsigned flags); -JL_DLLEXPORT jl_uv_libhandle jl_dlopen(const char *filename, unsigned flags); -JL_DLLEXPORT int jl_dlclose(jl_uv_libhandle handle); -JL_DLLEXPORT void *jl_dlsym_e(jl_uv_libhandle handle, const char *symbol); -JL_DLLEXPORT void *jl_dlsym(jl_uv_libhandle handle, const char *symbol); - -#if defined(__linux__) || defined(__FreeBSD__) -JL_DLLEXPORT const char *jl_lookup_soname(const char *pfx, size_t n); -#endif - -// compiler -JL_DLLEXPORT jl_value_t *jl_toplevel_eval(jl_value_t *v); -JL_DLLEXPORT jl_value_t *jl_toplevel_eval_in(jl_module_t *m, jl_value_t *ex); -JL_DLLEXPORT jl_value_t *jl_load(const char *fname); -JL_DLLEXPORT jl_module_t *jl_base_relative_to(jl_module_t *m); - -// tracing -JL_DLLEXPORT void jl_trace_method(jl_method_t *m); -JL_DLLEXPORT void jl_untrace_method(jl_method_t *m); -JL_DLLEXPORT void jl_trace_linfo(jl_method_instance_t *linfo); -JL_DLLEXPORT void jl_untrace_linfo(jl_method_instance_t *linfo); -JL_DLLEXPORT void jl_register_linfo_tracer(void (*callback)(jl_method_instance_t *tracee)); -JL_DLLEXPORT void jl_register_method_tracer(void (*callback)(jl_method_instance_t *tracee)); -JL_DLLEXPORT void jl_register_newmeth_tracer(void (*callback)(jl_method_t *tracee)); - -// AST access -JL_DLLEXPORT jl_value_t *jl_copy_ast(jl_value_t *expr); - -JL_DLLEXPORT jl_array_t *jl_compress_ast(jl_method_t *m, jl_code_info_t *code); -JL_DLLEXPORT jl_code_info_t *jl_uncompress_ast(jl_method_t *m, jl_array_t *data); -JL_DLLEXPORT uint8_t jl_ast_flag_inferred(jl_array_t *data); -JL_DLLEXPORT uint8_t jl_ast_flag_inlineable(jl_array_t *data); -JL_DLLEXPORT uint8_t jl_ast_flag_pure(jl_array_t *data); -JL_DLLEXPORT void jl_fill_argnames(jl_array_t *data, jl_array_t *names); - -JL_DLLEXPORT int jl_is_operator(char *sym); -JL_DLLEXPORT int jl_operator_precedence(char *sym); - -STATIC_INLINE int jl_vinfo_sa(uint8_t vi) -{ - return (vi&16)!=0; -} - -STATIC_INLINE int jl_vinfo_usedundef(uint8_t vi) -{ - return (vi&32)!=0; -} - -// calling into julia --------------------------------------------------------- - -JL_DLLEXPORT jl_value_t *jl_apply_generic(jl_value_t **args, uint32_t nargs); -JL_DLLEXPORT jl_value_t *jl_invoke(jl_method_instance_t *meth, jl_value_t **args, uint32_t nargs); - -STATIC_INLINE -jl_value_t *jl_apply(jl_value_t **args, uint32_t nargs) -{ - return jl_apply_generic(args, nargs); -} - -JL_DLLEXPORT jl_value_t *jl_call(jl_function_t *f, jl_value_t **args, int32_t nargs); -JL_DLLEXPORT jl_value_t *jl_call0(jl_function_t *f); -JL_DLLEXPORT jl_value_t *jl_call1(jl_function_t *f, jl_value_t *a); -JL_DLLEXPORT jl_value_t *jl_call2(jl_function_t *f, jl_value_t *a, jl_value_t *b); -JL_DLLEXPORT jl_value_t *jl_call3(jl_function_t *f, jl_value_t *a, - jl_value_t *b, jl_value_t *c); - -// interfacing with Task runtime -JL_DLLEXPORT void jl_yield(void); - -// async signal handling ------------------------------------------------------ - -JL_DLLEXPORT void jl_install_sigint_handler(void); -JL_DLLEXPORT void jl_sigatomic_begin(void); -JL_DLLEXPORT void jl_sigatomic_end(void); - -// tasks and exceptions ------------------------------------------------------- - -typedef struct _jl_timing_block_t jl_timing_block_t; -// info describing an exception handler -typedef struct _jl_handler_t { - jl_jmp_buf eh_ctx; - jl_gcframe_t *gcstack; - struct _jl_handler_t *prev; - int8_t gc_state; -#ifdef JULIA_ENABLE_THREADING - size_t locks_len; -#endif - sig_atomic_t defer_signal; - int finalizers_inhibited; - jl_timing_block_t *timing_stack; - size_t world_age; -} jl_handler_t; - -typedef struct _jl_task_t { - JL_DATA_TYPE - struct _jl_task_t *parent; - jl_value_t *tls; - jl_sym_t *state; - jl_value_t *consumers; - jl_value_t *donenotify; - jl_value_t *result; - jl_value_t *exception; - jl_value_t *backtrace; - jl_function_t *start; - jl_jmp_buf ctx; - size_t bufsz; - void *stkbuf; - -// hidden fields: - size_t ssize; - size_t started:1; - - // current exception handler - jl_handler_t *eh; - // saved gc stack top for context switches - jl_gcframe_t *gcstack; - // current module, or NULL if this task has not set one - jl_module_t *current_module; - // current world age - size_t world_age; - - // id of owning thread - // does not need to be defined until the task runs - int16_t tid; -#ifdef JULIA_ENABLE_THREADING - // This is statically initialized when the task is not holding any locks - arraylist_t locks; -#endif - jl_timing_block_t *timing_stack; -} jl_task_t; - -JL_DLLEXPORT jl_task_t *jl_new_task(jl_function_t *start, size_t ssize); -JL_DLLEXPORT void jl_switchto(jl_task_t *t); -JL_DLLEXPORT void JL_NORETURN jl_throw(jl_value_t *e); -JL_DLLEXPORT void JL_NORETURN jl_rethrow(void); -JL_DLLEXPORT void JL_NORETURN jl_rethrow_other(jl_value_t *e); -JL_DLLEXPORT void JL_NORETURN jl_no_exc_handler(jl_value_t *e); - -#ifdef JULIA_ENABLE_THREADING -static inline void jl_lock_frame_push(jl_mutex_t *lock) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - // For early bootstrap - if (__unlikely(!ptls->current_task)) - return; - arraylist_t *locks = &ptls->current_task->locks; - size_t len = locks->len; - if (__unlikely(len >= locks->max)) { - arraylist_grow(locks, 1); - } - else { - locks->len = len + 1; - } - locks->items[len] = (void*)lock; -} -static inline void jl_lock_frame_pop(void) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - if (__likely(ptls->current_task)) { - ptls->current_task->locks.len--; - } -} -#else -static inline void jl_lock_frame_push(jl_mutex_t *lock) -{ - (void)lock; -} -static inline void jl_lock_frame_pop(void) -{ -} -#endif // ifndef JULIA_ENABLE_THREADING - -STATIC_INLINE void jl_eh_restore_state(jl_handler_t *eh) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - jl_task_t *current_task = ptls->current_task; - // `eh` may not be `ptls->current_task->eh`. See `jl_pop_handler` - // This function should **NOT** have any safepoint before the ones at the - // end. - sig_atomic_t old_defer_signal = ptls->defer_signal; - int8_t old_gc_state = ptls->gc_state; - current_task->eh = eh->prev; - ptls->pgcstack = eh->gcstack; -#ifdef JULIA_ENABLE_THREADING - arraylist_t *locks = ¤t_task->locks; - if (locks->len > eh->locks_len) { - for (size_t i = locks->len;i > eh->locks_len;i--) - jl_mutex_unlock_nogc((jl_mutex_t*)locks->items[i - 1]); - locks->len = eh->locks_len; - } -#endif - ptls->world_age = eh->world_age; - ptls->defer_signal = eh->defer_signal; - ptls->gc_state = eh->gc_state; - ptls->finalizers_inhibited = eh->finalizers_inhibited; - if (old_gc_state && !eh->gc_state) { - jl_gc_safepoint_(ptls); - } - if (old_defer_signal && !eh->defer_signal) { - jl_sigint_safepoint(ptls); - } -} - -JL_DLLEXPORT void jl_enter_handler(jl_handler_t *eh); -JL_DLLEXPORT void jl_pop_handler(int n); - -#if defined(_OS_WINDOWS_) -#if defined(_COMPILER_MINGW_) -int __attribute__ ((__nothrow__,__returns_twice__)) (jl_setjmp)(jmp_buf _Buf); -__declspec(noreturn) __attribute__ ((__nothrow__)) void (jl_longjmp)(jmp_buf _Buf, int _Value); -#else -int (jl_setjmp)(jmp_buf _Buf); -void (jl_longjmp)(jmp_buf _Buf, int _Value); -#endif -#define jl_setjmp_f jl_setjmp -#define jl_setjmp_name "jl_setjmp" -#define jl_setjmp(a,b) jl_setjmp(a) -#define jl_longjmp(a,b) jl_longjmp(a,b) -#else -// determine actual entry point name -#if defined(sigsetjmp) -#define jl_setjmp_f __sigsetjmp -#define jl_setjmp_name "__sigsetjmp" -#else -#define jl_setjmp_f sigsetjmp -#define jl_setjmp_name "sigsetjmp" -#endif -#define jl_setjmp(a,b) sigsetjmp(a,b) -#define jl_longjmp(a,b) siglongjmp(a,b) -#endif - -#define JL_TRY \ - int i__tr, i__ca; jl_handler_t __eh; \ - jl_enter_handler(&__eh); \ - if (!jl_setjmp(__eh.eh_ctx,0)) \ - for (i__tr=1; i__tr; i__tr=0, jl_eh_restore_state(&__eh)) - -#define JL_EH_POP() jl_eh_restore_state(&__eh) - -#ifdef _OS_WINDOWS_ -#define JL_CATCH \ - else \ - for (i__ca=1, jl_eh_restore_state(&__eh); i__ca; i__ca=0) \ - if (((jl_get_ptls_states()->exception_in_transit==jl_stackovf_exception) && _resetstkoflw()) || 1) -#else -#define JL_CATCH \ - else \ - for (i__ca=1, jl_eh_restore_state(&__eh); i__ca; i__ca=0) -#endif - -// I/O system ----------------------------------------------------------------- - -#define JL_STREAM uv_stream_t -#define JL_STDOUT jl_uv_stdout -#define JL_STDERR jl_uv_stderr -#define JL_STDIN jl_uv_stdin - -JL_DLLEXPORT void jl_run_event_loop(uv_loop_t *loop); -JL_DLLEXPORT int jl_run_once(uv_loop_t *loop); -JL_DLLEXPORT int jl_process_events(uv_loop_t *loop); - -JL_DLLEXPORT uv_loop_t *jl_global_event_loop(void); - -JL_DLLEXPORT void jl_close_uv(uv_handle_t *handle); - -JL_DLLEXPORT int jl_tcp_bind(uv_tcp_t *handle, uint16_t port, uint32_t host, - unsigned int flags); - -JL_DLLEXPORT int jl_sizeof_ios_t(void); - -JL_DLLEXPORT jl_array_t *jl_take_buffer(ios_t *s); - -typedef struct { - void *data; - uv_loop_t *loop; - uv_handle_type type; - uv_file file; -} jl_uv_file_t; - -#ifdef __GNUC__ -#define _JL_FORMAT_ATTR(type, str, arg) \ - __attribute__((format(type, str, arg))) -#else -#define _JL_FORMAT_ATTR(type, str, arg) -#endif - -JL_DLLEXPORT void jl_uv_puts(uv_stream_t *stream, const char *str, size_t n); -JL_DLLEXPORT int jl_printf(uv_stream_t *s, const char *format, ...) - _JL_FORMAT_ATTR(printf, 2, 3); -JL_DLLEXPORT int jl_vprintf(uv_stream_t *s, const char *format, va_list args) - _JL_FORMAT_ATTR(printf, 2, 0); -JL_DLLEXPORT void jl_safe_printf(const char *str, ...) - _JL_FORMAT_ATTR(printf, 1, 2); - -extern JL_DLLEXPORT JL_STREAM *JL_STDIN; -extern JL_DLLEXPORT JL_STREAM *JL_STDOUT; -extern JL_DLLEXPORT JL_STREAM *JL_STDERR; - -JL_DLLEXPORT JL_STREAM *jl_stdout_stream(void); -JL_DLLEXPORT JL_STREAM *jl_stdin_stream(void); -JL_DLLEXPORT JL_STREAM *jl_stderr_stream(void); - -// showing and std streams -JL_DLLEXPORT void jl_flush_cstdio(void); -JL_DLLEXPORT jl_value_t *jl_stdout_obj(void); -JL_DLLEXPORT jl_value_t *jl_stderr_obj(void); -JL_DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v); -JL_DLLEXPORT size_t jl_static_show_func_sig(JL_STREAM *s, jl_value_t *type); -JL_DLLEXPORT void jlbacktrace(void); -// Mainly for debugging, use `void*` so that no type cast is needed in C++. -JL_DLLEXPORT void jl_(void *jl_value); - -// julia options ----------------------------------------------------------- -// NOTE: This struct needs to be kept in sync with JLOptions type in base/options.jl -typedef struct { - int8_t quiet; - const char *julia_home; - const char *julia_bin; - const char *eval; - const char *print; - const char *load; - const char *image_file; - const char *cpu_target; - int32_t nprocs; - const char *machinefile; - int8_t isinteractive; - int8_t color; - int8_t historyfile; - int8_t startupfile; - int8_t compile_enabled; - int8_t code_coverage; - int8_t malloc_log; - int8_t opt_level; - int8_t debug_level; - int8_t check_bounds; - int8_t depwarn; - int8_t can_inline; - int8_t polly; - int8_t fast_math; - const char *worker; - int8_t handle_signals; - int8_t use_precompiled; - int8_t use_compilecache; - const char *bindto; - const char *outputbc; - const char *outputo; - const char *outputji; - int8_t incremental; - int8_t image_file_specified; -} jl_options_t; - -extern JL_DLLEXPORT jl_options_t jl_options; - -// Parse an argc/argv pair to extract general julia options, passing back out -// any arguments that should be passed on to the script. -JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp); - -// Set julia-level ARGS array according to the arguments provided in -// argc/argv -JL_DLLEXPORT void jl_set_ARGS(int argc, char **argv); - -JL_DLLEXPORT int jl_generating_output(void); - -// Settings for code_coverage and malloc_log -// NOTE: if these numbers change, test/cmdlineargs.jl will have to be updated -#define JL_LOG_NONE 0 -#define JL_LOG_USER 1 -#define JL_LOG_ALL 2 - -#define JL_OPTIONS_CHECK_BOUNDS_DEFAULT 0 -#define JL_OPTIONS_CHECK_BOUNDS_ON 1 -#define JL_OPTIONS_CHECK_BOUNDS_OFF 2 - -#define JL_OPTIONS_COMPILE_DEFAULT 1 -#define JL_OPTIONS_COMPILE_OFF 0 -#define JL_OPTIONS_COMPILE_ON 1 -#define JL_OPTIONS_COMPILE_ALL 2 -#define JL_OPTIONS_COMPILE_MIN 3 - -#define JL_OPTIONS_COLOR_ON 1 -#define JL_OPTIONS_COLOR_OFF 2 - -#define JL_OPTIONS_HISTORYFILE_ON 1 -#define JL_OPTIONS_HISTORYFILE_OFF 0 - -#define JL_OPTIONS_STARTUPFILE_ON 1 -#define JL_OPTIONS_STARTUPFILE_OFF 2 - -#define JL_OPTIONS_DEPWARN_OFF 0 -#define JL_OPTIONS_DEPWARN_ON 1 -#define JL_OPTIONS_DEPWARN_ERROR 2 - -#define JL_OPTIONS_POLLY_ON 1 -#define JL_OPTIONS_POLLY_OFF 0 - -#define JL_OPTIONS_FAST_MATH_ON 1 -#define JL_OPTIONS_FAST_MATH_OFF 2 -#define JL_OPTIONS_FAST_MATH_DEFAULT 0 - -#define JL_OPTIONS_HANDLE_SIGNALS_ON 1 -#define JL_OPTIONS_HANDLE_SIGNALS_OFF 0 - -#define JL_OPTIONS_USE_PRECOMPILED_YES 1 -#define JL_OPTIONS_USE_PRECOMPILED_NO 0 - -#define JL_OPTIONS_USE_COMPILECACHE_YES 1 -#define JL_OPTIONS_USE_COMPILECACHE_NO 0 - -// Version information -#include - -JL_DLLEXPORT extern int jl_ver_major(void); -JL_DLLEXPORT extern int jl_ver_minor(void); -JL_DLLEXPORT extern int jl_ver_patch(void); -JL_DLLEXPORT extern int jl_ver_is_release(void); -JL_DLLEXPORT extern const char *jl_ver_string(void); -JL_DLLEXPORT const char *jl_git_branch(void); -JL_DLLEXPORT const char *jl_git_commit(void); - -// nullable struct representations -typedef struct { - uint8_t hasvalue; - double value; -} jl_nullable_float64_t; - -typedef struct { - uint8_t hasvalue; - float value; -} jl_nullable_float32_t; - -#define jl_current_module (jl_get_ptls_states()->current_module) -#define jl_current_task (jl_get_ptls_states()->current_task) -#define jl_root_task (jl_get_ptls_states()->root_task) -#define jl_exception_in_transit (jl_get_ptls_states()->exception_in_transit) - - -// codegen interface ---------------------------------------------------------- - -typedef struct { - // to disable a hook: set to NULL or nothing - - // module setup: prepare a module for code emission (data layout, DWARF version, ...) - // parameters: LLVMModuleRef as Ptr{Void} - // return value: none - jl_value_t *module_setup; - - // module activation: registers debug info, adds module to JIT - // parameters: LLVMModuleRef as Ptr{Void} - // return value: none - jl_value_t *module_activation; - - // exception raising: emit LLVM instructions to raise an exception - // parameters: LLVMBasicBlockRef as Ptr{Void}, LLVMValueRef as Ptr{Void} - // return value: none - jl_value_t *raise_exception; -} jl_cghooks_t; - -typedef struct { - int cached; // can the compiler use/populate the compilation cache? - - // language features (C-style integer booleans) - int runtime; // can we call into the runtime? - int exceptions; // are exceptions supported (requires runtime)? - int track_allocations; // can we track allocations (don't if disallowed)? - int code_coverage; // can we measure coverage (don't if disallowed)? - int static_alloc; // is the compiler allowed to allocate statically? - int dynamic_alloc; // is the compiler allowed to allocate dynamically (requires runtime)? - - jl_cghooks_t hooks; -} jl_cgparams_t; -extern JL_DLLEXPORT jl_cgparams_t jl_default_cgparams; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/julia_threads.h b/julia-0.6.2/include/julia/julia_threads.h deleted file mode 100644 index bbb11d3..0000000 --- a/julia-0.6.2/include/julia/julia_threads.h +++ /dev/null @@ -1,637 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -// Meant to be included in -#ifndef JULIA_THREADS_H -#define JULIA_THREADS_H - -// threading ------------------------------------------------------------------ - -// WARNING: Threading support is incomplete and experimental -// Nonetheless, we define JL_THREAD and use it to give advanced notice to -// maintainers of what eventual threading support will change. - -// JULIA_ENABLE_THREADING is switched on in Make.inc if JULIA_THREADS is -// set (in Make.user) - -#if defined(__i386__) && defined(__GNUC__) && !defined(__SSE2__) -# error Julia can only be built for architectures above Pentium 4. Pass -march=pentium4, or set MARCH=pentium4 and ensure that -march is not passed separately with an older architecture. -#endif -#ifdef _COMPILER_MICROSOFT_ -# include -# include -#endif -#if defined(_CPU_X86_64_) || defined(_CPU_X86_) -# include -#endif -#ifndef _OS_WINDOWS_ -# include -#endif -#include - -typedef struct { - jl_taggedvalue_t *freelist; // root of list of free objects - jl_taggedvalue_t *newpages; // root of list of chunks of free objects - uint16_t osize; // size of objects in this pool -} jl_gc_pool_t; - -typedef struct { - // variable for tracking weak references - arraylist_t weak_refs; - - // variables for tracking malloc'd arrays - struct _mallocarray_t *mallocarrays; - struct _mallocarray_t *mafreelist; - - // variables for tracking big objects - struct _bigval_t *big_objects; - - // variables for tracking "remembered set" - arraylist_t rem_bindings; - arraylist_t _remset[2]; // contains jl_value_t* - // lower bound of the number of pointers inside remembered values - int remset_nptr; - arraylist_t *remset; - arraylist_t *last_remset; - - // variables for allocating objects from pools -#ifdef _P64 -# define JL_GC_N_POOLS 41 -#elif defined(_CPU_ARM_) || defined(_CPU_PPC_) || defined(_CPU_X86_) -# define JL_GC_N_POOLS 42 -#else -# define JL_GC_N_POOLS 43 -#endif - jl_gc_pool_t norm_pools[JL_GC_N_POOLS]; -} jl_thread_heap_t; - -// Cache of thread local change to global metadata during GC -// This is sync'd after marking. -typedef struct { - // thread local increment of `perm_scanned_bytes` - size_t perm_scanned_bytes; - // thread local increment of `scanned_bytes` - size_t scanned_bytes; - // Number of queued big objects (<= 1024) - size_t nbig_obj; - // Array of queued big objects to be moved between the young list - // and the old list. - // A set low bit means that the object should be moved from the old list - // to the young list (`mark_reset_age`). - // Objects can only be put into this list when the mark bit is flipped to - // `1` (atomically). Combining with the sync after marking, - // this makes sure that a single objects can only appear once in - // the lists (the mark bit cannot be flipped to `0` without sweeping) - void *big_obj[1024]; -} jl_gc_mark_cache_t; - -// This includes all the thread local states we care about for a thread. -#define JL_MAX_BT_SIZE 80000 -typedef struct _jl_tls_states_t { - struct _jl_gcframe_t *pgcstack; - size_t world_age; - struct _jl_value_t *exception_in_transit; - volatile size_t *safepoint; - // Whether it is safe to execute GC at the same time. -#define JL_GC_STATE_WAITING 1 - // gc_state = 1 means the thread is doing GC or is waiting for the GC to - // finish. -#define JL_GC_STATE_SAFE 2 - // gc_state = 2 means the thread is running unmanaged code that can be - // execute at the same time with the GC. - volatile int8_t gc_state; - volatile int8_t in_finalizer; - int8_t disable_gc; - volatile sig_atomic_t defer_signal; - struct _jl_module_t *current_module; - struct _jl_task_t *volatile current_task; - struct _jl_task_t *root_task; - void *stackbase; - char *stack_lo; - char *stack_hi; - jl_jmp_buf *volatile jmp_target; - jl_jmp_buf base_ctx; // base context of stack - jl_jmp_buf *safe_restore; - int16_t tid; - size_t bt_size; - // JL_MAX_BT_SIZE + 1 elements long - uintptr_t *bt_data; - // Atomically set by the sender, reset by the handler. - volatile sig_atomic_t signal_request; - // Allow the sigint to be raised asynchronously - // this is limited to the few places we do synchronous IO - // we can make this more general (similar to defer_signal) if necessary - volatile sig_atomic_t io_wait; - jl_thread_heap_t heap; -#ifndef _OS_WINDOWS_ - // These are only used on unix now - pthread_t system_id; - void *signal_stack; -#endif - // execution of certain certain impure - // statements is prohibited from certain - // callbacks (such as generated functions) - // as it may make compilation undecidable - int in_pure_callback; - // Counter to disable finalizer **on the current thread** - int finalizers_inhibited; - arraylist_t finalizers; - jl_gc_mark_cache_t gc_cache; -} jl_tls_states_t; -typedef jl_tls_states_t *jl_ptls_t; - -// Update codegen version in `ccall.cpp` after changing either `pause` or `wake` -#ifdef __MIC__ -# define jl_cpu_pause() _mm_delay_64(100) -# define jl_cpu_wake() ((void)0) -# define JL_CPU_WAKE_NOOP 1 -#elif defined(_CPU_X86_64_) || defined(_CPU_X86_) /* !__MIC__ */ -# define jl_cpu_pause() _mm_pause() -# define jl_cpu_wake() ((void)0) -# define JL_CPU_WAKE_NOOP 1 -#elif defined(_CPU_AARCH64_) || (defined(_CPU_ARM_) && __ARM_ARCH >= 7) -# define jl_cpu_pause() __asm__ volatile ("wfe" ::: "memory") -# define jl_cpu_wake() __asm__ volatile ("sev" ::: "memory") -# define JL_CPU_WAKE_NOOP 0 -#else -# define jl_cpu_pause() ((void)0) -# define jl_cpu_wake() ((void)0) -# define JL_CPU_WAKE_NOOP 1 -#endif - -// Copied from libuv. Add `JL_CONST_FUNC` so that the compiler -// can optimize this better. -static inline unsigned long JL_CONST_FUNC jl_thread_self(void) -{ -#ifdef _OS_WINDOWS_ - return (unsigned long)GetCurrentThreadId(); -#else - return (unsigned long)pthread_self(); -#endif -} - -/** - * Thread synchronization primitives: - * - * These roughly follows the c11/c++11 memory model and the act as memory - * barriers at both the compiler level and the hardware level. - * The only exception is the GC safepoint and GC state transitions for which - * we use only a compiler (signal) barrier and use the signal handler to do the - * synchronization in order to lower the mutator overhead as much as possible. - * - * We use the compiler intrinsics to implement a similar API to the c11/c++11 - * one instead of using it directly because, - * - * 1. We support GCC 4.7 and GCC add support for c11 atomics in 4.9. - * Luckily, the __atomic intrinsics were added in GCC 4.7. - * 2. (most importantly) we need interoperability between code written - * in different languages. - * The current c++ standard (c++14) does not allow using c11 atomic - * functions or types and there's currently no guarantee that the two - * types are compatible (although most of them probably are). - * We also need to access these atomic variables from the LLVM JIT code - * which is very hard unless the layout of the object is fully - * specified. - */ -#if defined(__GNUC__) -# define jl_signal_fence() __atomic_signal_fence(__ATOMIC_SEQ_CST) -# define jl_atomic_fetch_add_relaxed(obj, arg) \ - __atomic_fetch_add(obj, arg, __ATOMIC_RELAXED) -# define jl_atomic_fetch_add(obj, arg) \ - __atomic_fetch_add(obj, arg, __ATOMIC_SEQ_CST) -# define jl_atomic_fetch_and_relaxed(obj, arg) \ - __atomic_fetch_and(obj, arg, __ATOMIC_RELAXED) -# define jl_atomic_fetch_and(obj, arg) \ - __atomic_fetch_and(obj, arg, __ATOMIC_SEQ_CST) -# define jl_atomic_fetch_or_relaxed(obj, arg) \ - __atomic_fetch_or(obj, arg, __ATOMIC_RELAXED) -# define jl_atomic_fetch_or(obj, arg) \ - __atomic_fetch_or(obj, arg, __ATOMIC_SEQ_CST) -// Returns the original value of `obj` -// Use the legacy __sync builtins for now, this can also be written using -// the __atomic builtins or c11 atomics with GNU extension or c11 _Generic -# define jl_atomic_compare_exchange(obj, expected, desired) \ - __sync_val_compare_and_swap(obj, expected, desired) -# define jl_atomic_exchange(obj, desired) \ - __atomic_exchange_n(obj, desired, __ATOMIC_SEQ_CST) -# define jl_atomic_exchange_relaxed(obj, desired) \ - __atomic_exchange_n(obj, desired, __ATOMIC_RELAXED) -// TODO: Maybe add jl_atomic_compare_exchange_weak for spin lock -# define jl_atomic_store(obj, val) \ - __atomic_store_n(obj, val, __ATOMIC_SEQ_CST) -# if defined(__clang__) || defined(__ICC) || defined(__INTEL_COMPILER) || \ - !(defined(_CPU_X86_) || defined(_CPU_X86_64_)) -// ICC and Clang doesn't have this bug... -# define jl_atomic_store_release(obj, val) \ - __atomic_store_n(obj, val, __ATOMIC_RELEASE) -# else -// Workaround a GCC bug when using store with release order by using the -// stronger version instead. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67458 -# define jl_atomic_store_release(obj, val) do { \ - jl_signal_fence(); \ - __atomic_store_n(obj, val, __ATOMIC_RELEASE); \ - } while (0) -# endif -# define jl_atomic_load(obj) \ - __atomic_load_n(obj, __ATOMIC_SEQ_CST) -# define jl_atomic_load_acquire(obj) \ - __atomic_load_n(obj, __ATOMIC_ACQUIRE) -#elif defined(_COMPILER_MICROSOFT_) -# define jl_signal_fence() _ReadWriteBarrier() - -// add -template -static inline typename std::enable_if::type -jl_atomic_fetch_add(T *obj, T2 arg) -{ - return (T)_InterlockedExchangeAdd8((volatile char*)obj, (char)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_add(T *obj, T2 arg) -{ - return (T)_InterlockedExchangeAdd16((volatile short*)obj, (short)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_add(T *obj, T2 arg) -{ - return (T)_InterlockedExchangeAdd((volatile LONG*)obj, (LONG)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_add(T *obj, T2 arg) -{ - return (T)_InterlockedExchangeAdd64((volatile __int64*)obj, (__int64)arg); -} -#define jl_atomic_fetch_add_relaxed(obj, arg) jl_atomic_fetch_add(obj, arg) - -// and -template -static inline typename std::enable_if::type -jl_atomic_fetch_and(T *obj, T2 arg) -{ - return (T)_InterlockedAnd8((volatile char*)obj, (char)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_and(T *obj, T2 arg) -{ - return (T)_InterlockedAnd16((volatile short*)obj, (short)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_and(T *obj, T2 arg) -{ - return (T)_InterlockedAnd((volatile LONG*)obj, (LONG)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_and(T *obj, T2 arg) -{ - return (T)_InterlockedAnd64((volatile __int64*)obj, (__int64)arg); -} -#define jl_atomic_fetch_and_relaxed(obj, arg) jl_atomic_fetch_and(obj, arg) - -// or -template -static inline typename std::enable_if::type -jl_atomic_fetch_or(T *obj, T2 arg) -{ - return (T)_InterlockedOr8((volatile char*)obj, (char)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_or(T *obj, T2 arg) -{ - return (T)_InterlockedOr16((volatile short*)obj, (short)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_or(T *obj, T2 arg) -{ - return (T)_InterlockedOr((volatile LONG*)obj, (LONG)arg); -} -template -static inline typename std::enable_if::type -jl_atomic_fetch_or(T *obj, T2 arg) -{ - return (T)_InterlockedOr64((volatile __int64*)obj, (__int64)arg); -} -#define jl_atomic_fetch_or_relaxed(obj, arg) jl_atomic_fetch_or(obj, arg) - -// Returns the original value of `obj` -template -static inline typename std::enable_if::type -jl_atomic_compare_exchange(volatile T *obj, T2 expected, T3 desired) -{ - return (T)_InterlockedCompareExchange8((volatile char*)obj, - (char)desired, (char)expected); -} -template -static inline typename std::enable_if::type -jl_atomic_compare_exchange(volatile T *obj, T2 expected, T3 desired) -{ - return (T)_InterlockedCompareExchange16((volatile short*)obj, - (short)desired, (short)expected); -} -template -static inline typename std::enable_if::type -jl_atomic_compare_exchange(volatile T *obj, T2 expected, T3 desired) -{ - return (T)_InterlockedCompareExchange((volatile LONG*)obj, - (LONG)desired, (LONG)expected); -} -template -static inline typename std::enable_if::type -jl_atomic_compare_exchange(volatile T *obj, T2 expected, T3 desired) -{ - return (T)_InterlockedCompareExchange64((volatile __int64*)obj, - (__int64)desired, (__int64)expected); -} -// atomic exchange -template -static inline typename std::enable_if::type -jl_atomic_exchange(volatile T *obj, T2 val) -{ - return _InterlockedExchange8((volatile char*)obj, (char)val); -} -template -static inline typename std::enable_if::type -jl_atomic_exchange(volatile T *obj, T2 val) -{ - return _InterlockedExchange16((volatile short*)obj, (short)val); -} -template -static inline typename std::enable_if::type -jl_atomic_exchange(volatile T *obj, T2 val) -{ - return _InterlockedExchange((volatile LONG*)obj, (LONG)val); -} -template -static inline typename std::enable_if::type -jl_atomic_exchange(volatile T *obj, T2 val) -{ - return _InterlockedExchange64((volatile __int64*)obj, (__int64)val); -} -#define jl_atomic_exchange_relaxed(obj, val) jl_atomic_exchange(obj, val) -// atomic stores -template -static inline typename std::enable_if::type -jl_atomic_store(volatile T *obj, T2 val) -{ - _InterlockedExchange8((volatile char*)obj, (char)val); -} -template -static inline typename std::enable_if::type -jl_atomic_store(volatile T *obj, T2 val) -{ - _InterlockedExchange16((volatile short*)obj, (short)val); -} -template -static inline typename std::enable_if::type -jl_atomic_store(volatile T *obj, T2 val) -{ - _InterlockedExchange((volatile LONG*)obj, (LONG)val); -} -template -static inline typename std::enable_if::type -jl_atomic_store(volatile T *obj, T2 val) -{ - _InterlockedExchange64((volatile __int64*)obj, (__int64)val); -} -template -static inline void jl_atomic_store_release(volatile T *obj, T2 val) -{ - jl_signal_fence(); - *obj = (T)val; -} -// atomic loads -template -static inline T jl_atomic_load(volatile T *obj) -{ - // Trick to generate cheaper instructions compare to `_InterlockedOr` - // Note that we don't care whether the exchange succeeded or not... - return jl_atomic_compare_exchange(obj, T(0), T(0)); -} -template -static inline T jl_atomic_load_acquire(volatile T *obj) -{ - T val = *obj; - jl_signal_fence(); - return val; -} -#else -# error "No atomic operations supported." -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT int16_t jl_threadid(void); -JL_DLLEXPORT void *jl_threadgroup(void); -JL_DLLEXPORT void jl_threading_profile(void); -JL_DLLEXPORT void (jl_cpu_pause)(void); -JL_DLLEXPORT void (jl_cpu_wake)(void); - -// Accessing the tls variables, gc safepoint and gc states -JL_DLLEXPORT JL_CONST_FUNC jl_ptls_t (jl_get_ptls_states)(void); -// This triggers a SegFault when we are in GC -// Assign it to a variable to make sure the compiler emit the load -// and to avoid Clang warning for -Wunused-volatile-lvalue -#define jl_gc_safepoint_(ptls) do { \ - jl_signal_fence(); \ - size_t safepoint_load = *ptls->safepoint; \ - jl_signal_fence(); \ - (void)safepoint_load; \ - } while (0) -#define jl_sigint_safepoint(ptls) do { \ - jl_signal_fence(); \ - size_t safepoint_load = ptls->safepoint[-1]; \ - jl_signal_fence(); \ - (void)safepoint_load; \ - } while (0) -#ifndef JULIA_ENABLE_THREADING -extern JL_DLLEXPORT jl_tls_states_t jl_tls_states; -#define jl_get_ptls_states() (&jl_tls_states) -#define jl_gc_state(ptls) ((int8_t)0) -STATIC_INLINE int8_t jl_gc_state_set(jl_ptls_t ptls, int8_t state, - int8_t old_state) -{ - (void)ptls; - (void)state; - return old_state; -} -#else // ifndef JULIA_ENABLE_THREADING -typedef jl_ptls_t (*jl_get_ptls_states_func)(void); -#if !defined(_OS_DARWIN_) && !defined(_OS_WINDOWS_) -JL_DLLEXPORT void jl_set_ptls_states_getter(jl_get_ptls_states_func f); -#endif -// Make sure jl_gc_state() is always a rvalue -#define jl_gc_state(ptls) ((int8_t)ptls->gc_state) -STATIC_INLINE int8_t jl_gc_state_set(jl_ptls_t ptls, int8_t state, - int8_t old_state) -{ - ptls->gc_state = state; - // A safe point is required if we transition from GC-safe region to - // non GC-safe region. - if (old_state && !state) - jl_gc_safepoint_(ptls); - return old_state; -} -#endif // ifndef JULIA_ENABLE_THREADING -STATIC_INLINE int8_t jl_gc_state_save_and_set(jl_ptls_t ptls, - int8_t state) -{ - return jl_gc_state_set(ptls, state, jl_gc_state(ptls)); -} -#define jl_gc_unsafe_enter(ptls) jl_gc_state_save_and_set(ptls, 0) -#define jl_gc_unsafe_leave(ptls, state) ((void)jl_gc_state_set(ptls, (state), 0)) -#define jl_gc_safe_enter(ptls) jl_gc_state_save_and_set(ptls, JL_GC_STATE_SAFE) -#define jl_gc_safe_leave(ptls, state) ((void)jl_gc_state_set(ptls, (state), JL_GC_STATE_SAFE)) -JL_DLLEXPORT void (jl_gc_safepoint)(void); - -#define JL_SIGATOMIC_BEGIN() do { \ - jl_get_ptls_states()->defer_signal++; \ - jl_signal_fence(); \ - } while (0) -#define JL_SIGATOMIC_END() do { \ - jl_signal_fence(); \ - if (--jl_get_ptls_states()->defer_signal == 0) { \ - jl_sigint_safepoint(jl_get_ptls_states()); \ - } \ - } while (0) - -// Recursive spin lock -typedef struct { - volatile unsigned long owner; - uint32_t count; -} jl_mutex_t; - -JL_DLLEXPORT void jl_gc_enable_finalizers(jl_ptls_t ptls, int on); -static inline void jl_lock_frame_push(jl_mutex_t *lock); -static inline void jl_lock_frame_pop(void); - -// JL_LOCK and jl_mutex_lock are GC safe points while JL_LOCK_NOGC -// and jl_mutex_lock_nogc are not. -// Always use JL_LOCK unless no one holding the lock can trigger a GC or GC -// safepoint. JL_LOCK_NOGC should only be needed for GC internal locks. -// The JL_LOCK* and JL_UNLOCK* macros are no-op for non-threading build -// while the jl_mutex_* functions are always locking and unlocking the locks. - -static inline void jl_mutex_wait(jl_mutex_t *lock, int safepoint) -{ - unsigned long self = jl_thread_self(); - unsigned long owner = jl_atomic_load_acquire(&lock->owner); - if (owner == self) { - lock->count++; - return; - } - while (1) { - if (owner == 0 && - jl_atomic_compare_exchange(&lock->owner, 0, self) == 0) { - lock->count = 1; - return; - } - if (safepoint) { - jl_ptls_t ptls = jl_get_ptls_states(); - jl_gc_safepoint_(ptls); - } - jl_cpu_pause(); - owner = lock->owner; - } -} - -static inline void jl_mutex_lock_nogc(jl_mutex_t *lock) -{ - jl_mutex_wait(lock, 0); -} - -static inline void jl_mutex_lock(jl_mutex_t *lock) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - JL_SIGATOMIC_BEGIN(); - jl_mutex_wait(lock, 1); - jl_lock_frame_push(lock); - jl_gc_enable_finalizers(ptls, 0); -} - -/* Call this function for code that could be called from either a managed - or an unmanaged thread */ -static inline void jl_mutex_lock_maybe_nogc(jl_mutex_t *lock) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - if (ptls->safepoint) { - jl_mutex_lock(lock); - } else { - jl_mutex_lock_nogc(lock); - } -} - -static inline void jl_mutex_unlock_nogc(jl_mutex_t *lock) -{ - assert(lock->owner == jl_thread_self() && - "Unlocking a lock in a different thread."); - if (--lock->count == 0) { - jl_atomic_store_release(&lock->owner, 0); - jl_cpu_wake(); - } -} - -static inline void jl_mutex_unlock(jl_mutex_t *lock) -{ - jl_ptls_t ptls = jl_get_ptls_states(); - jl_mutex_unlock_nogc(lock); - jl_gc_enable_finalizers(ptls, 1); - jl_lock_frame_pop(); - JL_SIGATOMIC_END(); -} - -static inline void jl_mutex_unlock_maybe_nogc(jl_mutex_t *lock) { - jl_ptls_t ptls = jl_get_ptls_states(); - if (ptls->safepoint) { - jl_mutex_unlock(lock); - } else { - jl_mutex_unlock_nogc(lock); - } -} - -static inline void jl_mutex_init(jl_mutex_t *lock) -{ - lock->owner = 0; - lock->count = 0; -} - -// Locks -#ifdef JULIA_ENABLE_THREADING -#define JL_MUTEX_INIT(m) jl_mutex_init(m) -#define JL_LOCK(m) jl_mutex_lock(m) -#define JL_UNLOCK(m) jl_mutex_unlock(m) -#define JL_LOCK_NOGC(m) jl_mutex_lock_nogc(m) -#define JL_UNLOCK_NOGC(m) jl_mutex_unlock_nogc(m) -#else // JULIA_ENABLE_THREADING -static inline void jl_mutex_check_type(jl_mutex_t *m) -{ - (void)m; -} -#define JL_MUTEX_INIT(m) jl_mutex_check_type(m) -#define JL_LOCK(m) do { \ - JL_SIGATOMIC_BEGIN(); \ - jl_gc_enable_finalizers(jl_get_ptls_states(), 0); \ - jl_mutex_check_type(m); \ - } while (0) -#define JL_UNLOCK(m) do { \ - jl_gc_enable_finalizers(jl_get_ptls_states(), 1); \ - jl_mutex_check_type(m); \ - JL_SIGATOMIC_END(); \ - } while (0) -#define JL_LOCK_NOGC(m) jl_mutex_check_type(m) -#define JL_UNLOCK_NOGC(m) jl_mutex_check_type(m) -#endif // JULIA_ENABLE_THREADING - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/julia_version.h b/julia-0.6.2/include/julia/julia_version.h deleted file mode 100644 index ea1ed49..0000000 --- a/julia-0.6.2/include/julia/julia_version.h +++ /dev/null @@ -1,9 +0,0 @@ -// This is an autogenerated header file -#ifndef JULIA_VERSION_H -#define JULIA_VERSION_H -#define JULIA_VERSION_STRING "0.6.2" -#define JULIA_VERSION_MAJOR 0 -#define JULIA_VERSION_MINOR 6 -#define JULIA_VERSION_PATCH 2 -#define JULIA_VERSION_IS_RELEASE 1 -#endif diff --git a/julia-0.6.2/include/julia/libsupport.h b/julia-0.6.2/include/julia/libsupport.h deleted file mode 100644 index c93527a..0000000 --- a/julia-0.6.2/include/julia/libsupport.h +++ /dev/null @@ -1,33 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef LIBSUPPORT_H -#define LIBSUPPORT_H - -#include "platform.h" - -#include -#include -#include -#include "dtypes.h" -#include "utils.h" -#include "utf8.h" -#include "ios.h" -#include "timefuncs.h" -#include "hashing.h" -#include "ptrhash.h" -#include "bitvector.h" -#include "dirpath.h" -#include "strtod.h" -#include "crc32c.h" - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT void libsupport_init(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/platform.h b/julia-0.6.2/include/julia/platform.h deleted file mode 100644 index 3a4751a..0000000 --- a/julia-0.6.2/include/julia/platform.h +++ /dev/null @@ -1,113 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef PLATFORM_H -#define PLATFORM_H - -/* - * This file provides convenient macros to be used to identify the platform - * based of compiler-specific pre-defined macros. It is based on the - * information that can be found at the following address: - * - * http://sourceforge.net/p/predef/wiki/Home/ - * - * Possible values include: - * Compiler: - * _COMPILER_CLANG_ - * _COMPILER_GCC_ - * _COMPILER_INTEL_ - * _COMPILER_MICROSOFT_ - * _COMPILER_MINGW_ - * OS: - * _OS_FREEBSD_ - * _OS_LINUX_ - * _OS_WINDOWS_ - * _OS_DARWIN_ - * - * CPU/Architecture: - * _CPU_X86_ - * _CPU_X86_64_ - * _CPU_ARM_ - */ - -/******************************************************************************* -* Compiler * -*******************************************************************************/ - -/* - * Notes: - * - * 1. Checking for Intel's compiler should be done before checking for - * Microsoft's. On Windows Intel's compiler also defines _MSC_VER as the - * acknoledgement of the fact that it is integrated with Visual Studio. - * - * 2. Checking for MinGW should be done before checking for GCC as MinGW - * pretends to be GCC. - */ -#if defined(__clang__) -#define _COMPILER_CLANG_ -// Clang can also be used as a MinGW compiler -#if defined(__MINGW32__) -#define _COMPILER_MINGW_ -#endif -#elif defined(__INTEL_COMPILER) || defined(__ICC) -#define _COMPILER_INTEL_ -#elif defined(__MINGW32__) -#define _COMPILER_MINGW_ -#elif defined(_MSC_VER) -#define _COMPILER_MICROSOFT_ -#elif defined(__GNUC__) -#define _COMPILER_GCC_ -#endif - -/******************************************************************************* -* OS * -*******************************************************************************/ - -#if defined(__FreeBSD__) -#define _OS_FREEBSD_ -#elif defined(__linux__) -#define _OS_LINUX_ -#elif defined(_WIN32) || defined(_WIN64) -#define _OS_WINDOWS_ -#elif defined(__APPLE__) && defined(__MACH__) -#define _OS_DARWIN_ -#endif - -/******************************************************************************* -* Architecture * -*******************************************************************************/ - -#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) -#define _CPU_X86_64_ -#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(_X86_) -#define _CPU_X86_ -#elif defined(__aarch64__) -#define _CPU_AARCH64_ -#elif defined(__arm__) || defined(_M_ARM) -#define _CPU_ARM_ -#elif defined(__PPC64__) -#define _CPU_PPC64_ -#elif defined(_ARCH_PPC) -#define _CPU_PPC_ -#endif - -#if defined(_CPU_X86_64_) -# define _P64 -#elif defined(_CPU_X86_) -# define _P32 -#elif defined(_OS_WINDOWS_) -/* Not sure how to determine pointer size on Windows running ARM. */ -# if _WIN64 -# define _P64 -# else -# define _P32 -# endif -#elif __SIZEOF_POINTER__ == 8 -# define _P64 -#elif __SIZEOF_POINTER__ == 4 -# define _P32 -#else -# error pointer size not known for your platform / compiler -#endif - -#endif /* !PLATFORM_H */ diff --git a/julia-0.6.2/include/julia/ptrhash.h b/julia-0.6.2/include/julia/ptrhash.h deleted file mode 100644 index 062287e..0000000 --- a/julia-0.6.2/include/julia/ptrhash.h +++ /dev/null @@ -1,18 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef PTRHASH_H -#define PTRHASH_H - -#include "htable.h" - -#ifdef __cplusplus -extern "C" { -#endif - -HTPROT(ptrhash) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/strtod.h b/julia-0.6.2/include/julia/strtod.h deleted file mode 100644 index 1d4f08d..0000000 --- a/julia-0.6.2/include/julia/strtod.h +++ /dev/null @@ -1,17 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef STRTOD_H -#define STRTOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr); -JL_DLLEXPORT float jl_strtof_c(const char *nptr, char **endptr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/timefuncs.h b/julia-0.6.2/include/julia/timefuncs.h deleted file mode 100644 index 12533e3..0000000 --- a/julia-0.6.2/include/julia/timefuncs.h +++ /dev/null @@ -1,23 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef TIMEFUNCS_H -#define TIMEFUNCS_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct jl_timeval { - int64_t sec; /* seconds */ - int64_t usec; /* microseconds */ -}; - -JL_DLLEXPORT int jl_gettimeofday(struct jl_timeval *jtv); -JL_DLLEXPORT double jl_clock_now(void); -void sleep_ms(int ms); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/tzfile.h b/julia-0.6.2/include/julia/tzfile.h deleted file mode 100644 index b19046c..0000000 --- a/julia-0.6.2/include/julia/tzfile.h +++ /dev/null @@ -1,170 +0,0 @@ -/* $NetBSD: tzfile.h,v 1.8 2015/07/11 16:40:53 christos Exp $ */ - -#ifndef _TZFILE_H_ -#define _TZFILE_H_ - -/* -** This file is in the public domain, so clarified as of -** 1996-06-05 by Arthur David Olson. -*/ - -/* -** This header is for use ONLY with the time conversion code. -** There is no guarantee that it will remain unchanged, -** or that it will remain at all. -** Do NOT copy it to any system include directory. -** Thank you! -*/ - -/* -** Information about time zone files. -*/ - -#ifndef TZDIR /* Time zone object file directory */ -#define TZDIR "/usr/share/zoneinfo" -#endif /* !defined TZDIR */ - -#ifndef TZDEFAULT -#define TZDEFAULT "/etc/localtime" -#endif /* !defined TZDEFAULT */ - -#ifndef TZDEFRULES -#define TZDEFRULES "posixrules" -#endif /* !defined TZDEFRULES */ - -/* -** Each file begins with. . . -*/ - -#define TZ_MAGIC "TZif" - -struct tzhead { - char tzh_magic[4]; /* TZ_MAGIC */ - char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */ - char tzh_reserved[15]; /* reserved; must be zero */ - char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ - char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ - char tzh_leapcnt[4]; /* coded number of leap seconds */ - char tzh_timecnt[4]; /* coded number of transition times */ - char tzh_typecnt[4]; /* coded number of local time types */ - char tzh_charcnt[4]; /* coded number of abbr. chars */ -}; - -/* -** . . .followed by. . . -** -** tzh_timecnt (char [4])s coded transition times a la time(2) -** tzh_timecnt (unsigned char)s types of local time starting at above -** tzh_typecnt repetitions of -** one (char [4]) coded UT offset in seconds -** one (unsigned char) used to set tm_isdst -** one (unsigned char) that's an abbreviation list index -** tzh_charcnt (char)s '\0'-terminated zone abbreviations -** tzh_leapcnt repetitions of -** one (char [4]) coded leap second transition times -** one (char [4]) total correction after above -** tzh_ttisstdcnt (char)s indexed by type; if 1, transition -** time is standard time, if 0, -** transition time is wall clock time -** if absent, transition times are -** assumed to be wall clock time -** tzh_ttisgmtcnt (char)s indexed by type; if 1, transition -** time is UT, if 0, -** transition time is local time -** if absent, transition times are -** assumed to be local time -*/ - -/* -** If tzh_version is '2' or greater, the above is followed by a second instance -** of tzhead and a second instance of the data in which each coded transition -** time uses 8 rather than 4 chars, -** then a POSIX-TZ-environment-variable-style string for use in handling -** instants after the last transition time stored in the file -** (with nothing between the newlines if there is no POSIX representation for -** such instants). -** -** If tz_version is '3' or greater, the above is extended as follows. -** First, the POSIX TZ string's hour offset may range from -167 -** through 167 as compared to the POSIX-required 0 through 24. -** Second, its DST start time may be January 1 at 00:00 and its stop -** time December 31 at 24:00 plus the difference between DST and -** standard time, indicating DST all year. -*/ - -/* -** In the current implementation, "tzset()" refuses to deal with files that -** exceed any of the limits below. -*/ - -#ifndef TZ_MAX_TIMES -#define TZ_MAX_TIMES 2000 -#endif /* !defined TZ_MAX_TIMES */ - -#ifndef TZ_MAX_TYPES -/* This must be at least 17 for Europe/Samara and Europe/Vilnius. */ -#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ -#endif /* !defined TZ_MAX_TYPES */ - -#ifndef TZ_MAX_CHARS -#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ - /* (limited by what unsigned chars can hold) */ -#endif /* !defined TZ_MAX_CHARS */ - -#ifndef TZ_MAX_LEAPS -#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ -#endif /* !defined TZ_MAX_LEAPS */ - -#define SECSPERMIN 60 -#define MINSPERHOUR 60 -#define HOURSPERDAY 24 -#define DAYSPERWEEK 7 -#define DAYSPERNYEAR 365 -#define DAYSPERLYEAR 366 -#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) -#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY) -#define MONSPERYEAR 12 - -#define TM_SUNDAY 0 -#define TM_MONDAY 1 -#define TM_TUESDAY 2 -#define TM_WEDNESDAY 3 -#define TM_THURSDAY 4 -#define TM_FRIDAY 5 -#define TM_SATURDAY 6 - -#define TM_JANUARY 0 -#define TM_FEBRUARY 1 -#define TM_MARCH 2 -#define TM_APRIL 3 -#define TM_MAY 4 -#define TM_JUNE 5 -#define TM_JULY 6 -#define TM_AUGUST 7 -#define TM_SEPTEMBER 8 -#define TM_OCTOBER 9 -#define TM_NOVEMBER 10 -#define TM_DECEMBER 11 - -#define TM_YEAR_BASE 1900 - -#define EPOCH_YEAR 1970 -#define EPOCH_WDAY TM_THURSDAY - -#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) - -/* -** Since everything in isleap is modulo 400 (or a factor of 400), we know that -** isleap(y) == isleap(y % 400) -** and so -** isleap(a + b) == isleap((a + b) % 400) -** or -** isleap(a + b) == isleap(a % 400 + b % 400) -** This is true even if % means modulo rather than Fortran remainder -** (which is allowed by C89 but not C99). -** We use this to avoid addition overflow problems. -*/ - -#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) - -#endif /* !defined _TZFILE_H_ */ diff --git a/julia-0.6.2/include/julia/utf8.h b/julia-0.6.2/include/julia/utf8.h deleted file mode 100644 index 486243b..0000000 --- a/julia-0.6.2/include/julia/utf8.h +++ /dev/null @@ -1,104 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef UTF8_H -#define UTF8_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* is c the start of a utf8 sequence? */ -#define isutf(c) (((c)&0xC0)!=0x80) - -#define UEOF ((uint32_t)-1) - -/* convert UTF-8 data to wide character */ -size_t u8_toucs(uint32_t *dest, size_t sz, const char *src, size_t srcsz); - -/* the opposite conversion */ -size_t u8_toutf8(char *dest, size_t sz, const uint32_t *src, size_t srcsz); - -/* single character to UTF-8, returns # bytes written */ -size_t u8_wc_toutf8(char *dest, uint32_t ch); - -/* character number to byte offset */ -JL_DLLEXPORT size_t u8_offset(const char *str, size_t charnum); - -/* byte offset to character number */ -JL_DLLEXPORT size_t u8_charnum(const char *str, size_t offset); - -/* return next character, updating an index variable */ -uint32_t u8_nextchar(const char *s, size_t *i); - -/* next character without NUL character terminator */ -uint32_t u8_nextmemchar(const char *s, size_t *i); - -/* move to next character */ -void u8_inc(const char *s, size_t *i); - -/* move to previous character */ -void u8_dec(const char *s, size_t *i); - -/* returns length of next utf-8 sequence */ -size_t u8_seqlen(const char *s); - -/* returns the # of bytes needed to encode a certain character */ -size_t u8_charlen(uint32_t ch); - -char read_escape_control_char(char c); - -/* assuming src points to the character after a backslash, read an - escape sequence, storing the result in dest and returning the number of - input characters processed */ -size_t u8_read_escape_sequence(const char *src, size_t ssz, uint32_t *dest); - -/* given a wide character, convert it to an ASCII escape sequence stored in - buf, where buf is "sz" bytes. returns the number of characters output. - sz must be at least 3. */ -int u8_escape_wchar(char *buf, size_t sz, uint32_t ch); - -/* convert UTF-8 "src" to escape sequences. - - sz is buf size in bytes. must be at least 12. - - if escape_quotes is nonzero, quote characters will be escaped. - - if ascii is nonzero, the output is 7-bit ASCII, no UTF-8 survives. - - starts at src[*pi], updates *pi to point to the first unprocessed - byte of the input. - - end is one more than the last allowable value of *pi. - - returns number of bytes placed in buf, including a NUL terminator. -*/ -size_t u8_escape(char *buf, size_t sz, const char *src, size_t *pi, size_t end, - int escape_quotes, int ascii); - -/* utility predicates used by the above */ -int octal_digit(char c); -int hex_digit(char c); - -/* same as the above, but searches a buffer of a given size instead of - a NUL-terminated string. */ -char *u8_memchr(const char *s, uint32_t ch, size_t sz, size_t *charn); - -char *u8_memrchr(const char *s, uint32_t ch, size_t sz); - -/* number of columns occupied by a string */ -JL_DLLEXPORT size_t u8_strwidth(const char *s); - -/* printf where the format string and arguments may be in UTF-8. - you can avoid this function and just use ordinary printf() if the current - locale is UTF-8. */ -size_t u8_vprintf(const char *fmt, va_list ap); -size_t u8_printf(const char *fmt, ...); - -/* determine whether a sequence of bytes is valid UTF-8. length is in bytes */ -JL_DLLEXPORT int u8_isvalid(const char *str, size_t length); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/utils.h b/julia-0.6.2/include/julia/utils.h deleted file mode 100644 index 930f54f..0000000 --- a/julia-0.6.2/include/julia/utils.h +++ /dev/null @@ -1,63 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#ifndef UTILS_H -#define UTILS_H - -#ifdef __cplusplus -extern "C" { -#endif - -JL_DLLEXPORT char *uint2str(char *dest, size_t len, uint64_t num, uint32_t base); -int str2int(char *str, size_t len, int64_t *res, uint32_t base); -int isdigit_base(char c, int base); - -double conv_to_double(void *data, numerictype_t tag); -int64_t conv_to_int64(void *data, numerictype_t tag); -uint64_t conv_to_uint64(void *data, numerictype_t tag); -int32_t conv_to_int32(void *data, numerictype_t tag); -uint32_t conv_to_uint32(void *data, numerictype_t tag); -#ifdef _P64 -#define conv_to_ptrdiff conv_to_int64 -#define conv_to_size conv_to_uint64 -#else -#define conv_to_ptrdiff conv_to_int32 -#define conv_to_size conv_to_uint32 -#endif -int cmp_same_lt(void *a, void *b, numerictype_t tag); -int cmp_same_eq(void *a, void *b, numerictype_t tag); -int cmp_lt(void *a, numerictype_t atag, void *b, numerictype_t btag); -int cmp_eq(void *a, numerictype_t atag, void *b, numerictype_t btag, - int equalnans); - -#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 8)) -#define bswap_16(x) __builtin_bswap16(x) -#define bswap_32(x) __builtin_bswap32(x) -#define bswap_64(x) __builtin_bswap64(x) -#elif defined(_MSC_VER) -#define bswap_16(x) _byteswap_ushort(x) -#define bswap_32(x) _byteswap_ulong(x) -#define bswap_64(x) _byteswap_uint64(x) -#elif defined(__INTEL_COMPILER) -#define bswap_16(x) _bswap16(x) -#define bswap_32(x) _bswap(x) -#define bswap_64(x) _bswap64(x) -#else -#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8) -#define bswap_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) -STATIC_INLINE uint64_t ByteSwap64(uint64_t x) -{ - uint32_t high = (uint32_t) (x >> 32); - uint32_t low = (uint32_t) x; - return ((uint64_t) bswap_32 (high)) | - (((uint64_t) bswap_32 (low)) << 32); -} -#define bswap_64(x) ByteSwap64(x) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/julia-0.6.2/include/julia/uv-errno.h b/julia-0.6.2/include/julia/uv-errno.h deleted file mode 100644 index 53f3029..0000000 --- a/julia-0.6.2/include/julia/uv-errno.h +++ /dev/null @@ -1,418 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_ERRNO_H_ -#define UV_ERRNO_H_ - -#include - -#define UV__EOF (-4095) -#define UV__UNKNOWN (-4094) - -#define UV__EAI_ADDRFAMILY (-3000) -#define UV__EAI_AGAIN (-3001) -#define UV__EAI_BADFLAGS (-3002) -#define UV__EAI_CANCELED (-3003) -#define UV__EAI_FAIL (-3004) -#define UV__EAI_FAMILY (-3005) -#define UV__EAI_MEMORY (-3006) -#define UV__EAI_NODATA (-3007) -#define UV__EAI_NONAME (-3008) -#define UV__EAI_OVERFLOW (-3009) -#define UV__EAI_SERVICE (-3010) -#define UV__EAI_SOCKTYPE (-3011) -#define UV__EAI_BADHINTS (-3013) -#define UV__EAI_PROTOCOL (-3014) - -/* Only map to the system errno on non-Windows platforms. It's apparently - * a fairly common practice for Windows programmers to redefine errno codes. - */ -#if defined(E2BIG) && !defined(_WIN32) -# define UV__E2BIG (-E2BIG) -#else -# define UV__E2BIG (-4093) -#endif - -#if defined(EACCES) && !defined(_WIN32) -# define UV__EACCES (-EACCES) -#else -# define UV__EACCES (-4092) -#endif - -#if defined(EADDRINUSE) && !defined(_WIN32) -# define UV__EADDRINUSE (-EADDRINUSE) -#else -# define UV__EADDRINUSE (-4091) -#endif - -#if defined(EADDRNOTAVAIL) && !defined(_WIN32) -# define UV__EADDRNOTAVAIL (-EADDRNOTAVAIL) -#else -# define UV__EADDRNOTAVAIL (-4090) -#endif - -#if defined(EAFNOSUPPORT) && !defined(_WIN32) -# define UV__EAFNOSUPPORT (-EAFNOSUPPORT) -#else -# define UV__EAFNOSUPPORT (-4089) -#endif - -#if defined(EAGAIN) && !defined(_WIN32) -# define UV__EAGAIN (-EAGAIN) -#else -# define UV__EAGAIN (-4088) -#endif - -#if defined(EALREADY) && !defined(_WIN32) -# define UV__EALREADY (-EALREADY) -#else -# define UV__EALREADY (-4084) -#endif - -#if defined(EBADF) && !defined(_WIN32) -# define UV__EBADF (-EBADF) -#else -# define UV__EBADF (-4083) -#endif - -#if defined(EBUSY) && !defined(_WIN32) -# define UV__EBUSY (-EBUSY) -#else -# define UV__EBUSY (-4082) -#endif - -#if defined(ECANCELED) && !defined(_WIN32) -# define UV__ECANCELED (-ECANCELED) -#else -# define UV__ECANCELED (-4081) -#endif - -#if defined(ECHARSET) && !defined(_WIN32) -# define UV__ECHARSET (-ECHARSET) -#else -# define UV__ECHARSET (-4080) -#endif - -#if defined(ECONNABORTED) && !defined(_WIN32) -# define UV__ECONNABORTED (-ECONNABORTED) -#else -# define UV__ECONNABORTED (-4079) -#endif - -#if defined(ECONNREFUSED) && !defined(_WIN32) -# define UV__ECONNREFUSED (-ECONNREFUSED) -#else -# define UV__ECONNREFUSED (-4078) -#endif - -#if defined(ECONNRESET) && !defined(_WIN32) -# define UV__ECONNRESET (-ECONNRESET) -#else -# define UV__ECONNRESET (-4077) -#endif - -#if defined(EDESTADDRREQ) && !defined(_WIN32) -# define UV__EDESTADDRREQ (-EDESTADDRREQ) -#else -# define UV__EDESTADDRREQ (-4076) -#endif - -#if defined(EEXIST) && !defined(_WIN32) -# define UV__EEXIST (-EEXIST) -#else -# define UV__EEXIST (-4075) -#endif - -#if defined(EFAULT) && !defined(_WIN32) -# define UV__EFAULT (-EFAULT) -#else -# define UV__EFAULT (-4074) -#endif - -#if defined(EHOSTUNREACH) && !defined(_WIN32) -# define UV__EHOSTUNREACH (-EHOSTUNREACH) -#else -# define UV__EHOSTUNREACH (-4073) -#endif - -#if defined(EINTR) && !defined(_WIN32) -# define UV__EINTR (-EINTR) -#else -# define UV__EINTR (-4072) -#endif - -#if defined(EINVAL) && !defined(_WIN32) -# define UV__EINVAL (-EINVAL) -#else -# define UV__EINVAL (-4071) -#endif - -#if defined(EIO) && !defined(_WIN32) -# define UV__EIO (-EIO) -#else -# define UV__EIO (-4070) -#endif - -#if defined(EISCONN) && !defined(_WIN32) -# define UV__EISCONN (-EISCONN) -#else -# define UV__EISCONN (-4069) -#endif - -#if defined(EISDIR) && !defined(_WIN32) -# define UV__EISDIR (-EISDIR) -#else -# define UV__EISDIR (-4068) -#endif - -#if defined(ELOOP) && !defined(_WIN32) -# define UV__ELOOP (-ELOOP) -#else -# define UV__ELOOP (-4067) -#endif - -#if defined(EMFILE) && !defined(_WIN32) -# define UV__EMFILE (-EMFILE) -#else -# define UV__EMFILE (-4066) -#endif - -#if defined(EMSGSIZE) && !defined(_WIN32) -# define UV__EMSGSIZE (-EMSGSIZE) -#else -# define UV__EMSGSIZE (-4065) -#endif - -#if defined(ENAMETOOLONG) && !defined(_WIN32) -# define UV__ENAMETOOLONG (-ENAMETOOLONG) -#else -# define UV__ENAMETOOLONG (-4064) -#endif - -#if defined(ENETDOWN) && !defined(_WIN32) -# define UV__ENETDOWN (-ENETDOWN) -#else -# define UV__ENETDOWN (-4063) -#endif - -#if defined(ENETUNREACH) && !defined(_WIN32) -# define UV__ENETUNREACH (-ENETUNREACH) -#else -# define UV__ENETUNREACH (-4062) -#endif - -#if defined(ENFILE) && !defined(_WIN32) -# define UV__ENFILE (-ENFILE) -#else -# define UV__ENFILE (-4061) -#endif - -#if defined(ENOBUFS) && !defined(_WIN32) -# define UV__ENOBUFS (-ENOBUFS) -#else -# define UV__ENOBUFS (-4060) -#endif - -#if defined(ENODEV) && !defined(_WIN32) -# define UV__ENODEV (-ENODEV) -#else -# define UV__ENODEV (-4059) -#endif - -#if defined(ENOENT) && !defined(_WIN32) -# define UV__ENOENT (-ENOENT) -#else -# define UV__ENOENT (-4058) -#endif - -#if defined(ENOMEM) && !defined(_WIN32) -# define UV__ENOMEM (-ENOMEM) -#else -# define UV__ENOMEM (-4057) -#endif - -#if defined(ENONET) && !defined(_WIN32) -# define UV__ENONET (-ENONET) -#else -# define UV__ENONET (-4056) -#endif - -#if defined(ENOSPC) && !defined(_WIN32) -# define UV__ENOSPC (-ENOSPC) -#else -# define UV__ENOSPC (-4055) -#endif - -#if defined(ENOSYS) && !defined(_WIN32) -# define UV__ENOSYS (-ENOSYS) -#else -# define UV__ENOSYS (-4054) -#endif - -#if defined(ENOTCONN) && !defined(_WIN32) -# define UV__ENOTCONN (-ENOTCONN) -#else -# define UV__ENOTCONN (-4053) -#endif - -#if defined(ENOTDIR) && !defined(_WIN32) -# define UV__ENOTDIR (-ENOTDIR) -#else -# define UV__ENOTDIR (-4052) -#endif - -#if defined(ENOTEMPTY) && !defined(_WIN32) -# define UV__ENOTEMPTY (-ENOTEMPTY) -#else -# define UV__ENOTEMPTY (-4051) -#endif - -#if defined(ENOTSOCK) && !defined(_WIN32) -# define UV__ENOTSOCK (-ENOTSOCK) -#else -# define UV__ENOTSOCK (-4050) -#endif - -#if defined(ENOTSUP) && !defined(_WIN32) -# define UV__ENOTSUP (-ENOTSUP) -#else -# define UV__ENOTSUP (-4049) -#endif - -#if defined(EPERM) && !defined(_WIN32) -# define UV__EPERM (-EPERM) -#else -# define UV__EPERM (-4048) -#endif - -#if defined(EPIPE) && !defined(_WIN32) -# define UV__EPIPE (-EPIPE) -#else -# define UV__EPIPE (-4047) -#endif - -#if defined(EPROTO) && !defined(_WIN32) -# define UV__EPROTO (-EPROTO) -#else -# define UV__EPROTO (-4046) -#endif - -#if defined(EPROTONOSUPPORT) && !defined(_WIN32) -# define UV__EPROTONOSUPPORT (-EPROTONOSUPPORT) -#else -# define UV__EPROTONOSUPPORT (-4045) -#endif - -#if defined(EPROTOTYPE) && !defined(_WIN32) -# define UV__EPROTOTYPE (-EPROTOTYPE) -#else -# define UV__EPROTOTYPE (-4044) -#endif - -#if defined(EROFS) && !defined(_WIN32) -# define UV__EROFS (-EROFS) -#else -# define UV__EROFS (-4043) -#endif - -#if defined(ESHUTDOWN) && !defined(_WIN32) -# define UV__ESHUTDOWN (-ESHUTDOWN) -#else -# define UV__ESHUTDOWN (-4042) -#endif - -#if defined(ESPIPE) && !defined(_WIN32) -# define UV__ESPIPE (-ESPIPE) -#else -# define UV__ESPIPE (-4041) -#endif - -#if defined(ESRCH) && !defined(_WIN32) -# define UV__ESRCH (-ESRCH) -#else -# define UV__ESRCH (-4040) -#endif - -#if defined(ETIMEDOUT) && !defined(_WIN32) -# define UV__ETIMEDOUT (-ETIMEDOUT) -#else -# define UV__ETIMEDOUT (-4039) -#endif - -#if defined(ETXTBSY) && !defined(_WIN32) -# define UV__ETXTBSY (-ETXTBSY) -#else -# define UV__ETXTBSY (-4038) -#endif - -#if defined(EXDEV) && !defined(_WIN32) -# define UV__EXDEV (-EXDEV) -#else -# define UV__EXDEV (-4037) -#endif - -#if defined(EFBIG) && !defined(_WIN32) -# define UV__EFBIG (-EFBIG) -#else -# define UV__EFBIG (-4036) -#endif - -#if defined(ENOPROTOOPT) && !defined(_WIN32) -# define UV__ENOPROTOOPT (-ENOPROTOOPT) -#else -# define UV__ENOPROTOOPT (-4035) -#endif - -#if defined(ERANGE) && !defined(_WIN32) -# define UV__ERANGE (-ERANGE) -#else -# define UV__ERANGE (-4034) -#endif - -#if defined(ENXIO) && !defined(_WIN32) -# define UV__ENXIO (-ENXIO) -#else -# define UV__ENXIO (-4033) -#endif - -#if defined(EMLINK) && !defined(_WIN32) -# define UV__EMLINK (-EMLINK) -#else -# define UV__EMLINK (-4032) -#endif - -/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is - * defined. Fortunately, its value is always 64 so it's possible albeit - * icky to hard-code it. - */ -#if defined(EHOSTDOWN) && !defined(_WIN32) -# define UV__EHOSTDOWN (-EHOSTDOWN) -#elif defined(__APPLE__) || \ - defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) -# define UV__EHOSTDOWN (-64) -#else -# define UV__EHOSTDOWN (-4031) -#endif - -#endif /* UV_ERRNO_H_ */ diff --git a/julia-0.6.2/include/julia/uv-linux.h b/julia-0.6.2/include/julia/uv-linux.h deleted file mode 100644 index 9b38405..0000000 --- a/julia-0.6.2/include/julia/uv-linux.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_LINUX_H -#define UV_LINUX_H - -#define UV_PLATFORM_LOOP_FIELDS \ - uv__io_t inotify_read_watcher; \ - void* inotify_watchers; \ - int inotify_fd; \ - -#define UV_PLATFORM_FS_EVENT_FIELDS \ - void* watchers[2]; \ - int wd; \ - -#endif /* UV_LINUX_H */ diff --git a/julia-0.6.2/include/julia/uv-threadpool.h b/julia-0.6.2/include/julia/uv-threadpool.h deleted file mode 100644 index 9708ebd..0000000 --- a/julia-0.6.2/include/julia/uv-threadpool.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* - * This file is private to libuv. It provides common functionality to both - * Windows and Unix backends. - */ - -#ifndef UV_THREADPOOL_H_ -#define UV_THREADPOOL_H_ - -struct uv__work { - void (*work)(struct uv__work *w); - void (*done)(struct uv__work *w, int status); - struct uv_loop_s* loop; - void* wq[2]; -}; - -#endif /* UV_THREADPOOL_H_ */ diff --git a/julia-0.6.2/include/julia/uv-unix.h b/julia-0.6.2/include/julia/uv-unix.h deleted file mode 100644 index 99e8664..0000000 --- a/julia-0.6.2/include/julia/uv-unix.h +++ /dev/null @@ -1,384 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_UNIX_H -#define UV_UNIX_H - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#ifdef __ANDROID__ -#include "pthread-fixes.h" -#endif -#include - -#include "uv-threadpool.h" - -#if defined(__linux__) -# include "uv-linux.h" -#elif defined(_AIX) -# include "uv-aix.h" -#elif defined(__sun) -# include "uv-sunos.h" -#elif defined(__APPLE__) -# include "uv-darwin.h" -#elif defined(__DragonFly__) || \ - defined(__FreeBSD__) || \ - defined(__OpenBSD__) || \ - defined(__NetBSD__) -# include "uv-bsd.h" -#endif - -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif - -#ifndef UV_IO_PRIVATE_PLATFORM_FIELDS -# define UV_IO_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -struct uv__io_s; -struct uv__async; -struct uv_loop_s; - -typedef void (*uv__io_cb)(struct uv_loop_s* loop, - struct uv__io_s* w, - unsigned int events); -typedef struct uv__io_s uv__io_t; - -struct uv__io_s { - uv__io_cb cb; - void* pending_queue[2]; - void* watcher_queue[2]; - unsigned int pevents; /* Pending event mask i.e. mask at next tick. */ - unsigned int events; /* Current event mask. */ - int fd; - UV_IO_PRIVATE_PLATFORM_FIELDS -}; - -typedef void (*uv__async_cb)(struct uv_loop_s* loop, - struct uv__async* w, - unsigned int nevents); - -struct uv__async { - uv__async_cb cb; - uv__io_t io_watcher; - int wfd; -}; - -#ifndef UV_PLATFORM_SEM_T -# define UV_PLATFORM_SEM_T sem_t -#endif - -#ifndef UV_PLATFORM_LOOP_FIELDS -# define UV_PLATFORM_LOOP_FIELDS /* empty */ -#endif - -#ifndef UV_PLATFORM_FS_EVENT_FIELDS -# define UV_PLATFORM_FS_EVENT_FIELDS /* empty */ -#endif - -#ifndef UV_STREAM_PRIVATE_PLATFORM_FIELDS -# define UV_STREAM_PRIVATE_PLATFORM_FIELDS /* empty */ -#endif - -/* Note: May be cast to struct iovec. See writev(2). */ -typedef struct uv_buf_t { - char* base; - size_t len; -} uv_buf_t; - -typedef int uv_file; -typedef int uv_os_sock_t; -typedef int uv_os_fd_t; - -#define UV_ONCE_INIT PTHREAD_ONCE_INIT - -typedef pthread_once_t uv_once_t; -typedef pthread_t uv_thread_t; -typedef pthread_mutex_t uv_mutex_t; -typedef pthread_rwlock_t uv_rwlock_t; -typedef UV_PLATFORM_SEM_T uv_sem_t; -typedef pthread_cond_t uv_cond_t; -typedef pthread_key_t uv_key_t; - -#if defined(__APPLE__) && defined(__MACH__) - -typedef struct { - unsigned int n; - unsigned int count; - uv_mutex_t mutex; - uv_sem_t turnstile1; - uv_sem_t turnstile2; -} uv_barrier_t; - -#else /* defined(__APPLE__) && defined(__MACH__) */ - -typedef pthread_barrier_t uv_barrier_t; - -#endif /* defined(__APPLE__) && defined(__MACH__) */ - -/* Platform-specific definitions for uv_spawn support. */ -typedef gid_t uv_gid_t; -typedef uid_t uv_uid_t; - -typedef struct dirent uv__dirent_t; - -#if defined(DT_UNKNOWN) -# define HAVE_DIRENT_TYPES -# if defined(DT_REG) -# define UV__DT_FILE DT_REG -# else -# define UV__DT_FILE -1 -# endif -# if defined(DT_DIR) -# define UV__DT_DIR DT_DIR -# else -# define UV__DT_DIR -2 -# endif -# if defined(DT_LNK) -# define UV__DT_LINK DT_LNK -# else -# define UV__DT_LINK -3 -# endif -# if defined(DT_FIFO) -# define UV__DT_FIFO DT_FIFO -# else -# define UV__DT_FIFO -4 -# endif -# if defined(DT_SOCK) -# define UV__DT_SOCKET DT_SOCK -# else -# define UV__DT_SOCKET -5 -# endif -# if defined(DT_CHR) -# define UV__DT_CHAR DT_CHR -# else -# define UV__DT_CHAR -6 -# endif -# if defined(DT_BLK) -# define UV__DT_BLOCK DT_BLK -# else -# define UV__DT_BLOCK -7 -# endif -#endif - -/* Platform-specific definitions for uv_dlopen support. */ -#define UV_DYNAMIC /* empty */ - -typedef struct { - void* handle; - char* errmsg; -} uv_lib_t; - -#define UV_LOOP_PRIVATE_FIELDS \ - unsigned long flags; \ - int backend_fd; \ - void* pending_queue[2]; \ - void* watcher_queue[2]; \ - uv__io_t** watchers; \ - unsigned int nwatchers; \ - unsigned int nfds; \ - void* wq[2]; \ - uv_mutex_t wq_mutex; \ - uv_async_t wq_async; \ - uv_rwlock_t cloexec_lock; \ - uv_handle_t* closing_handles; \ - void* process_handles[2]; \ - void* prepare_handles[2]; \ - void* check_handles[2]; \ - void* idle_handles[2]; \ - void* async_handles[2]; \ - struct uv__async async_watcher; \ - struct { \ - void* min; \ - unsigned int nelts; \ - } timer_heap; \ - uint64_t timer_counter; \ - uint64_t time; \ - int signal_pipefd[2]; \ - uv__io_t signal_io_watcher; \ - uv_signal_t child_watcher; \ - int emfile_fd; \ - UV_PLATFORM_LOOP_FIELDS \ - -#define UV_REQ_TYPE_PRIVATE /* empty */ - -#define UV_REQ_PRIVATE_FIELDS /* empty */ - -#define UV_PRIVATE_REQ_TYPES /* empty */ - -#define UV_WRITE_PRIVATE_FIELDS \ - void* queue[2]; \ - unsigned int write_index; \ - uv_buf_t* bufs; \ - unsigned int nbufs; \ - int error; \ - uv_buf_t bufsml[4]; \ - -#define UV_CONNECT_PRIVATE_FIELDS \ - void* queue[2]; \ - -#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_SEND_PRIVATE_FIELDS \ - void* queue[2]; \ - struct sockaddr_storage addr; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - ssize_t status; \ - uv_udp_send_cb send_cb; \ - uv_buf_t bufsml[4]; \ - -#define UV_HANDLE_PRIVATE_FIELDS \ - uv_handle_t* next_closing; \ - unsigned int flags; \ - -#define UV_STREAM_PRIVATE_FIELDS \ - uv_connect_t *connect_req; \ - uv_shutdown_t *shutdown_req; \ - uv__io_t io_watcher; \ - void* write_queue[2]; \ - void* write_completed_queue[2]; \ - uv_connection_cb connection_cb; \ - int delayed_error; \ - int accepted_fd; \ - void* queued_fds; \ - UV_STREAM_PRIVATE_PLATFORM_FIELDS \ - -#define UV_TCP_PRIVATE_FIELDS /* empty */ - -#define UV_UDP_PRIVATE_FIELDS \ - uv_alloc_cb alloc_cb; \ - uv_udp_recv_cb recv_cb; \ - uv__io_t io_watcher; \ - void* write_queue[2]; \ - void* write_completed_queue[2]; \ - -#define UV_PIPE_PRIVATE_FIELDS \ - const char* pipe_fname; /* strdup'ed */ - -#define UV_POLL_PRIVATE_FIELDS \ - uv__io_t io_watcher; - -#define UV_PREPARE_PRIVATE_FIELDS \ - uv_prepare_cb prepare_cb; \ - void* queue[2]; \ - -#define UV_CHECK_PRIVATE_FIELDS \ - uv_check_cb check_cb; \ - void* queue[2]; \ - -#define UV_IDLE_PRIVATE_FIELDS \ - uv_idle_cb idle_cb; \ - void* queue[2]; \ - -#define UV_ASYNC_PRIVATE_FIELDS \ - uv_async_cb async_cb; \ - void* queue[2]; \ - int pending; \ - -#define UV_TIMER_PRIVATE_FIELDS \ - uv_timer_cb timer_cb; \ - void* heap_node[3]; \ - uint64_t timeout; \ - uint64_t repeat; \ - uint64_t start_id; - -#define UV_GETADDRINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getaddrinfo_cb cb; \ - struct addrinfo* hints; \ - char* hostname; \ - char* service; \ - struct addrinfo* addrinfo; \ - int retcode; - -#define UV_GETNAMEINFO_PRIVATE_FIELDS \ - struct uv__work work_req; \ - uv_getnameinfo_cb getnameinfo_cb; \ - struct sockaddr_storage storage; \ - int flags; \ - char host[NI_MAXHOST]; \ - char service[NI_MAXSERV]; \ - int retcode; - -#define UV_PROCESS_PRIVATE_FIELDS \ - void* queue[2]; \ - int status; \ - -#define UV_FS_PRIVATE_FIELDS \ - const char *new_path; \ - uv_file file; \ - int flags; \ - mode_t mode; \ - unsigned int nbufs; \ - uv_buf_t* bufs; \ - off_t off; \ - uv_uid_t uid; \ - uv_gid_t gid; \ - double atime; \ - double mtime; \ - struct uv__work work_req; \ - uv_buf_t bufsml[4]; \ - -#define UV_WORK_PRIVATE_FIELDS \ - struct uv__work work_req; - -#define UV_TTY_PRIVATE_FIELDS \ - struct termios orig_termios; \ - int mode; - -#define UV_SIGNAL_PRIVATE_FIELDS \ - /* RB_ENTRY(uv_signal_s) tree_entry; */ \ - struct { \ - struct uv_signal_s* rbe_left; \ - struct uv_signal_s* rbe_right; \ - struct uv_signal_s* rbe_parent; \ - int rbe_color; \ - } tree_entry; \ - /* Use two counters here so we don have to fiddle with atomics. */ \ - unsigned int caught_signals; \ - unsigned int dispatched_signals; - -#define UV_FS_EVENT_PRIVATE_FIELDS \ - uv_fs_event_cb cb; \ - UV_PLATFORM_FS_EVENT_FIELDS \ - -#endif /* UV_UNIX_H */ diff --git a/julia-0.6.2/include/julia/uv-version.h b/julia-0.6.2/include/julia/uv-version.h deleted file mode 100644 index cb66618..0000000 --- a/julia-0.6.2/include/julia/uv-version.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef UV_VERSION_H -#define UV_VERSION_H - - /* - * Versions with the same major number are ABI stable. API is allowed to - * evolve between minor releases, but only in a backwards compatible way. - * Make sure you update the -soname directives in configure.ac - * and uv.gyp whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but - * not UV_VERSION_PATCH.) - */ - -#define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 9 -#define UV_VERSION_PATCH 0 -#define UV_VERSION_IS_RELEASE 1 -#define UV_VERSION_SUFFIX "" - -#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) - -#endif /* UV_VERSION_H */ diff --git a/julia-0.6.2/include/julia/uv.h b/julia-0.6.2/include/julia/uv.h deleted file mode 100644 index 3bda090..0000000 --- a/julia-0.6.2/include/julia/uv.h +++ /dev/null @@ -1,1546 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -/* See https://github.com/libuv/libuv#documentation for documentation. */ - -#ifndef UV_H -#define UV_H -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN32 - /* Windows - set up dll import/export decorators. */ -# if defined(BUILDING_UV_SHARED) - /* Building shared library. */ -# define UV_EXTERN __declspec(dllexport) -# elif defined(USING_UV_SHARED) - /* Using shared library. */ -# define UV_EXTERN __declspec(dllimport) -# else - /* Building static library. */ -# define UV_EXTERN /* nothing */ -# endif -#elif __GNUC__ >= 4 -# define UV_EXTERN __attribute__((visibility("default"))) -# ifndef _GNU_SOURCE -# define _GNU_SOURCE -# endif -#else -# define UV_EXTERN /* nothing */ -#endif - -#include "uv-errno.h" -#include "uv-version.h" -#include -#include - -#if defined(_MSC_VER) && _MSC_VER < 1600 -# include "stdint-msvc2008.h" -#else -# include -#endif - -#if defined(_WIN32) -# include "uv-win.h" -#else -# include "uv-unix.h" -#endif - -/* Expand this list if necessary. */ -#define UV_ERRNO_MAP(XX) \ - XX(E2BIG, "argument list too long") \ - XX(EACCES, "permission denied") \ - XX(EADDRINUSE, "address already in use") \ - XX(EADDRNOTAVAIL, "address not available") \ - XX(EAFNOSUPPORT, "address family not supported") \ - XX(EAGAIN, "resource temporarily unavailable") \ - XX(EAI_ADDRFAMILY, "address family not supported") \ - XX(EAI_AGAIN, "temporary failure") \ - XX(EAI_BADFLAGS, "bad ai_flags value") \ - XX(EAI_BADHINTS, "invalid value for hints") \ - XX(EAI_CANCELED, "request canceled") \ - XX(EAI_FAIL, "permanent failure") \ - XX(EAI_FAMILY, "ai_family not supported") \ - XX(EAI_MEMORY, "out of memory") \ - XX(EAI_NODATA, "no address") \ - XX(EAI_NONAME, "unknown node or service") \ - XX(EAI_OVERFLOW, "argument buffer overflow") \ - XX(EAI_PROTOCOL, "resolved protocol is unknown") \ - XX(EAI_SERVICE, "service not available for socket type") \ - XX(EAI_SOCKTYPE, "socket type not supported") \ - XX(EALREADY, "connection already in progress") \ - XX(EBADF, "bad file descriptor") \ - XX(EBUSY, "resource busy or locked") \ - XX(ECANCELED, "operation canceled") \ - XX(ECHARSET, "invalid Unicode character") \ - XX(ECONNABORTED, "software caused connection abort") \ - XX(ECONNREFUSED, "connection refused") \ - XX(ECONNRESET, "connection reset by peer") \ - XX(EDESTADDRREQ, "destination address required") \ - XX(EEXIST, "file already exists") \ - XX(EFAULT, "bad address in system call argument") \ - XX(EFBIG, "file too large") \ - XX(EHOSTUNREACH, "host is unreachable") \ - XX(EINTR, "interrupted system call") \ - XX(EINVAL, "invalid argument") \ - XX(EIO, "i/o error") \ - XX(EISCONN, "socket is already connected") \ - XX(EISDIR, "illegal operation on a directory") \ - XX(ELOOP, "too many symbolic links encountered") \ - XX(EMFILE, "too many open files") \ - XX(EMSGSIZE, "message too long") \ - XX(ENAMETOOLONG, "name too long") \ - XX(ENETDOWN, "network is down") \ - XX(ENETUNREACH, "network is unreachable") \ - XX(ENFILE, "file table overflow") \ - XX(ENOBUFS, "no buffer space available") \ - XX(ENODEV, "no such device") \ - XX(ENOENT, "no such file or directory") \ - XX(ENOMEM, "not enough memory") \ - XX(ENONET, "machine is not on the network") \ - XX(ENOPROTOOPT, "protocol not available") \ - XX(ENOSPC, "no space left on device") \ - XX(ENOSYS, "function not implemented") \ - XX(ENOTCONN, "socket is not connected") \ - XX(ENOTDIR, "not a directory") \ - XX(ENOTEMPTY, "directory not empty") \ - XX(ENOTSOCK, "socket operation on non-socket") \ - XX(ENOTSUP, "operation not supported on socket") \ - XX(EPERM, "operation not permitted") \ - XX(EPIPE, "broken pipe") \ - XX(EPROTO, "protocol error") \ - XX(EPROTONOSUPPORT, "protocol not supported") \ - XX(EPROTOTYPE, "protocol wrong type for socket") \ - XX(ERANGE, "result too large") \ - XX(EROFS, "read-only file system") \ - XX(ESHUTDOWN, "cannot send after transport endpoint shutdown") \ - XX(ESPIPE, "invalid seek") \ - XX(ESRCH, "no such process") \ - XX(ETIMEDOUT, "connection timed out") \ - XX(ETXTBSY, "text file is busy") \ - XX(EXDEV, "cross-device link not permitted") \ - XX(UNKNOWN, "unknown error") \ - XX(EOF, "end of file") \ - XX(ENXIO, "no such device or address") \ - XX(EMLINK, "too many links") \ - XX(EHOSTDOWN, "host is down") \ - -#define UV_HANDLE_TYPE_MAP(XX) \ - XX(ASYNC, async) \ - XX(CHECK, check) \ - XX(FS_EVENT, fs_event) \ - XX(FS_POLL, fs_poll) \ - XX(HANDLE, handle) \ - XX(IDLE, idle) \ - XX(NAMED_PIPE, pipe) \ - XX(POLL, poll) \ - XX(PREPARE, prepare) \ - XX(PROCESS, process) \ - XX(STREAM, stream) \ - XX(TCP, tcp) \ - XX(TIMER, timer) \ - XX(TTY, tty) \ - XX(UDP, udp) \ - XX(SIGNAL, signal) \ - -#define UV_REQ_TYPE_MAP(XX) \ - XX(REQ, req) \ - XX(CONNECT, connect) \ - XX(WRITE, write) \ - XX(SHUTDOWN, shutdown) \ - XX(UDP_SEND, udp_send) \ - XX(FS, fs) \ - XX(WORK, work) \ - XX(GETADDRINFO, getaddrinfo) \ - XX(GETNAMEINFO, getnameinfo) \ - -typedef enum { -#define XX(code, _) UV_ ## code = UV__ ## code, - UV_ERRNO_MAP(XX) -#undef XX - UV_ERRNO_MAX = UV__EOF - 1 -} uv_errno_t; - -typedef enum { - UV_UNKNOWN_HANDLE = 0, -#define XX(uc, lc) UV_##uc, - UV_HANDLE_TYPE_MAP(XX) -#undef XX - UV_FILE, - UV_HANDLE_TYPE_MAX, - UV_RAW_FD, /* fd for both unix and windows */ - UV_RAW_HANDLE /* HANDLE on windows, same as UV_RAW_FD on unix */ -} uv_handle_type; - -typedef enum { - UV_UNKNOWN_REQ = 0, -#define XX(uc, lc) UV_##uc, - UV_REQ_TYPE_MAP(XX) -#undef XX - UV_REQ_TYPE_PRIVATE - UV_REQ_TYPE_MAX -} uv_req_type; - - -/* Handle types. */ -typedef struct uv_loop_s uv_loop_t; -typedef struct uv_handle_s uv_handle_t; -typedef struct uv_stream_s uv_stream_t; -typedef struct uv_tcp_s uv_tcp_t; -typedef struct uv_udp_s uv_udp_t; -typedef struct uv_pipe_s uv_pipe_t; -typedef struct uv_tty_s uv_tty_t; -typedef struct uv_poll_s uv_poll_t; -typedef struct uv_timer_s uv_timer_t; -typedef struct uv_prepare_s uv_prepare_t; -typedef struct uv_check_s uv_check_t; -typedef struct uv_idle_s uv_idle_t; -typedef struct uv_async_s uv_async_t; -typedef struct uv_process_s uv_process_t; -typedef struct uv_fs_event_s uv_fs_event_t; -typedef struct uv_fs_poll_s uv_fs_poll_t; -typedef struct uv_signal_s uv_signal_t; - -/* Request types. */ -typedef struct uv_req_s uv_req_t; -typedef struct uv_getaddrinfo_s uv_getaddrinfo_t; -typedef struct uv_getnameinfo_s uv_getnameinfo_t; -typedef struct uv_shutdown_s uv_shutdown_t; -typedef struct uv_write_s uv_write_t; -typedef struct uv_connect_s uv_connect_t; -typedef struct uv_udp_send_s uv_udp_send_t; -typedef struct uv_fs_s uv_fs_t; -typedef struct uv_work_s uv_work_t; - -/* None of the above. */ -typedef struct uv_cpu_info_s uv_cpu_info_t; -typedef struct uv_interface_address_s uv_interface_address_t; -typedef struct uv_dirent_s uv_dirent_t; -typedef struct uv_passwd_s uv_passwd_t; - -typedef enum { - UV_LOOP_BLOCK_SIGNAL -} uv_loop_option; - -typedef enum { - UV_RUN_DEFAULT = 0, - UV_RUN_ONCE, - UV_RUN_NOWAIT -} uv_run_mode; - - -UV_EXTERN unsigned int uv_version(void); -UV_EXTERN const char* uv_version_string(void); - -typedef void* (*uv_malloc_func)(size_t size); -typedef void* (*uv_realloc_func)(void* ptr, size_t size); -typedef void* (*uv_calloc_func)(size_t count, size_t size); -typedef void (*uv_free_func)(void* ptr); - -UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func, - uv_realloc_func realloc_func, - uv_calloc_func calloc_func, - uv_free_func free_func); - -UV_EXTERN uv_loop_t* uv_default_loop(void); -UV_EXTERN int uv_loop_init(uv_loop_t* loop); -UV_EXTERN int uv_loop_close(uv_loop_t* loop); -/* - * NOTE: - * This function is DEPRECATED (to be removed after 0.12), users should - * allocate the loop manually and use uv_loop_init instead. - */ -UV_EXTERN uv_loop_t* uv_loop_new(void); -/* - * NOTE: - * This function is DEPRECATED (to be removed after 0.12). Users should use - * uv_loop_close and free the memory manually instead. - */ -UV_EXTERN void uv_loop_delete(uv_loop_t*); -UV_EXTERN size_t uv_loop_size(void); -UV_EXTERN int uv_loop_alive(const uv_loop_t* loop); -UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...); - -UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode); -UV_EXTERN void uv_stop(uv_loop_t*); - -UV_EXTERN void uv_ref(uv_handle_t*); -UV_EXTERN void uv_unref(uv_handle_t*); -UV_EXTERN int uv_has_ref(const uv_handle_t*); - -UV_EXTERN void uv_update_time(uv_loop_t*); -UV_EXTERN uint64_t uv_now(const uv_loop_t*); - -UV_EXTERN int uv_backend_fd(const uv_loop_t*); -UV_EXTERN int uv_backend_timeout(const uv_loop_t*); - -typedef void (*uv_alloc_cb)(uv_handle_t* handle, - size_t suggested_size, - uv_buf_t* buf); -typedef void (*uv_read_cb)(uv_stream_t* stream, - ssize_t nread, - const uv_buf_t* buf); -typedef void (*uv_write_cb)(uv_write_t* req, int status); -typedef void (*uv_connect_cb)(uv_connect_t* req, int status); -typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status); -typedef void (*uv_connection_cb)(uv_stream_t* server, int status); -typedef void (*uv_close_cb)(uv_handle_t* handle); -typedef void (*uv_poll_cb)(uv_poll_t* handle, int status, int events); -typedef void (*uv_timer_cb)(uv_timer_t* handle); -typedef void (*uv_async_cb)(uv_async_t* handle); -typedef void (*uv_prepare_cb)(uv_prepare_t* handle); -typedef void (*uv_check_cb)(uv_check_t* handle); -typedef void (*uv_idle_cb)(uv_idle_t* handle); -typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal); -typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg); -typedef void (*uv_fs_cb)(uv_fs_t* req); -typedef void (*uv_work_cb)(uv_work_t* req); -typedef void (*uv_after_work_cb)(uv_work_t* req, int status); -typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* req, - int status, - struct addrinfo* res); -typedef void (*uv_getnameinfo_cb)(uv_getnameinfo_t* req, - int status, - const char* hostname, - const char* service); - -typedef struct { - long tv_sec; - long tv_nsec; -} uv_timespec_t; - - -typedef struct { - uint64_t st_dev; - uint64_t st_mode; - uint64_t st_nlink; - uint64_t st_uid; - uint64_t st_gid; - uint64_t st_rdev; - uint64_t st_ino; - uint64_t st_size; - uint64_t st_blksize; - uint64_t st_blocks; - uint64_t st_flags; - uint64_t st_gen; - uv_timespec_t st_atim; - uv_timespec_t st_mtim; - uv_timespec_t st_ctim; - uv_timespec_t st_birthtim; -} uv_stat_t; - - -typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, - const char* filename, - int events, - int status); - -typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle, - int status, - const uv_stat_t* prev, - const uv_stat_t* curr); - -typedef void (*uv_signal_cb)(uv_signal_t* handle, int signum); - - -typedef enum { - UV_LEAVE_GROUP = 0, - UV_JOIN_GROUP -} uv_membership; - - -UV_EXTERN const char* uv_strerror(int err); -UV_EXTERN const char* uv_err_name(int err); - - -#define UV_REQ_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_req_type type; \ - /* private */ \ - void* active_queue[2]; \ - void* reserved[4]; \ - UV_REQ_PRIVATE_FIELDS \ - -/* Abstract base class of all requests. */ -struct uv_req_s { - UV_REQ_FIELDS -}; - - -/* Platform-specific request types. */ -UV_PRIVATE_REQ_TYPES - - -UV_EXTERN int uv_shutdown(uv_shutdown_t* req, - uv_stream_t* handle, - uv_shutdown_cb cb); - -struct uv_shutdown_s { - UV_REQ_FIELDS - uv_stream_t* handle; - uv_shutdown_cb cb; - UV_SHUTDOWN_PRIVATE_FIELDS -}; - - -#define UV_HANDLE_FIELDS \ - /* public */ \ - void* data; \ - /* read-only */ \ - uv_loop_t* loop; \ - uv_handle_type type; \ - /* private */ \ - uv_close_cb close_cb; \ - void* handle_queue[2]; \ - union { \ - int fd; \ - void* reserved[4]; \ - } u; \ - UV_HANDLE_PRIVATE_FIELDS \ - -/* The abstract base class of all handles. */ -struct uv_handle_s { - UV_HANDLE_FIELDS -}; - -UV_EXTERN size_t uv_handle_size(uv_handle_type type); -UV_EXTERN size_t uv_req_size(uv_req_type type); - -UV_EXTERN int uv_is_active(const uv_handle_t* handle); - -UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg); - -/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */ -UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream); -UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream); - -UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb); - -UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value); -UV_EXTERN int uv_recv_buffer_size(uv_handle_t* handle, int* value); - -UV_EXTERN int uv_fileno(const uv_handle_t* handle, uv_os_fd_t* fd); - -UV_EXTERN uv_buf_t uv_buf_init(char* base, unsigned int len); - - -#define UV_STREAM_FIELDS \ - /* number of bytes queued for writing */ \ - size_t write_queue_size; \ - uv_alloc_cb alloc_cb; \ - uv_read_cb read_cb; \ - /* private */ \ - UV_STREAM_PRIVATE_FIELDS - -/* - * uv_stream_t is a subclass of uv_handle_t. - * - * uv_stream is an abstract class. - * - * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t and uv_tty_t. - */ -struct uv_stream_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS -}; - -UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb); -UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client); - -UV_EXTERN int uv_read_start(uv_stream_t*, - uv_alloc_cb alloc_cb, - uv_read_cb read_cb); -UV_EXTERN int uv_read_stop(uv_stream_t*); - -UV_EXTERN int uv_write(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_write_cb cb); -UV_EXTERN int uv_write2(uv_write_t* req, - uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - uv_stream_t* send_handle, - uv_write_cb cb); -UV_EXTERN int uv_try_write(uv_stream_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs); - -/* uv_write_t is a subclass of uv_req_t. */ -struct uv_write_s { - UV_REQ_FIELDS - uv_write_cb cb; - uv_stream_t* send_handle; - uv_stream_t* handle; - UV_WRITE_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_is_readable(const uv_stream_t* handle); -UV_EXTERN int uv_is_writable(const uv_stream_t* handle); - -UV_EXTERN int uv_stream_set_blocking(uv_stream_t* handle, int blocking); - -UV_EXTERN int uv_is_closing(const uv_handle_t* handle); - - -/* - * uv_tcp_t is a subclass of uv_stream_t. - * - * Represents a TCP stream or TCP server. - */ -struct uv_tcp_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TCP_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle); -UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags); -UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable); -UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, - int enable, - unsigned int delay); -UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); - -enum uv_tcp_flags { - /* Used with uv_tcp_bind, when an IPv6 address is used. */ - UV_TCP_IPV6ONLY = 1 -}; - -UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, - const struct sockaddr* addr, - unsigned int flags); -UV_EXTERN int uv_tcp_getsockname(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_getpeername(const uv_tcp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_tcp_connect(uv_connect_t* req, - uv_tcp_t* handle, - const struct sockaddr* addr, - uv_connect_cb cb); - -/* uv_connect_t is a subclass of uv_req_t. */ -struct uv_connect_s { - UV_REQ_FIELDS - uv_connect_cb cb; - uv_stream_t* handle; - UV_CONNECT_PRIVATE_FIELDS -}; - - -/* - * UDP support. - */ - -enum uv_udp_flags { - /* Disables dual stack mode. */ - UV_UDP_IPV6ONLY = 1, - /* - * Indicates message was truncated because read buffer was too small. The - * remainder was discarded by the OS. Used in uv_udp_recv_cb. - */ - UV_UDP_PARTIAL = 2, - /* - * Indicates if SO_REUSEADDR will be set when binding the handle. - * This sets the SO_REUSEPORT socket flag on the BSDs and OS X. On other - * Unix platforms, it sets the SO_REUSEADDR flag. What that means is that - * multiple threads or processes can bind to the same address without error - * (provided they all set the flag) but only the last one to bind will receive - * any traffic, in effect "stealing" the port from the previous listener. - */ - UV_UDP_REUSEADDR = 4 -}; - -typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); -typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, - ssize_t nread, - const uv_buf_t* buf, - const struct sockaddr* addr, - unsigned flags); - -/* uv_udp_t is a subclass of uv_handle_t. */ -struct uv_udp_s { - UV_HANDLE_FIELDS - /* read-only */ - /* - * Number of bytes queued for sending. This field strictly shows how much - * information is currently queued. - */ - size_t send_queue_size; - /* - * Number of send requests currently in the queue awaiting to be processed. - */ - size_t send_queue_count; - UV_UDP_PRIVATE_FIELDS -}; - -/* uv_udp_send_t is a subclass of uv_req_t. */ -struct uv_udp_send_s { - UV_REQ_FIELDS - uv_udp_t* handle; - uv_udp_send_cb cb; - UV_UDP_SEND_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle); -UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags); -UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); -UV_EXTERN int uv_udp_bind(uv_udp_t* handle, - const struct sockaddr* addr, - unsigned int flags); - -UV_EXTERN int uv_udp_getsockname(const uv_udp_t* handle, - struct sockaddr* name, - int* namelen); -UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle, - const char* multicast_addr, - const char* interface_addr, - uv_membership membership); -UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_set_multicast_interface(uv_udp_t* handle, - const char* interface_addr); -UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on); -UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); -UV_EXTERN int uv_udp_send(uv_udp_send_t* req, - uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr, - uv_udp_send_cb send_cb); -UV_EXTERN int uv_udp_try_send(uv_udp_t* handle, - const uv_buf_t bufs[], - unsigned int nbufs, - const struct sockaddr* addr); -UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, - uv_alloc_cb alloc_cb, - uv_udp_recv_cb recv_cb); -UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle); - - -/* - * uv_tty_t is a subclass of uv_stream_t. - * - * Representing a stream for the console. - */ -struct uv_tty_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_TTY_PRIVATE_FIELDS -}; - -typedef enum { - /* Initial/normal terminal mode */ - UV_TTY_MODE_NORMAL, - /* Raw input mode (On Windows, ENABLE_WINDOW_INPUT is also enabled) */ - UV_TTY_MODE_RAW, - /* Binary-safe I/O mode for IPC (Unix-only) */ - UV_TTY_MODE_IO -} uv_tty_mode_t; - -UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable); -UV_EXTERN int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode); -UV_EXTERN int uv_tty_reset_mode(void); -UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); - -#ifdef __cplusplus -extern "C++" { - -inline int uv_tty_set_mode(uv_tty_t* handle, int mode) { - return uv_tty_set_mode(handle, static_cast(mode)); -} - -} -#endif - -UV_EXTERN uv_handle_type uv_guess_handle(uv_file file); - -/* - * uv_pipe_t is a subclass of uv_stream_t. - * - * Representing a pipe stream or pipe server. On Windows this is a Named - * Pipe. On Unix this is a Unix domain socket. - * - * A single uv_pipe_t always represents one end of a pipe. You can use - * uv_pipe_link to create a pair of connected pipe ends. - */ -struct uv_pipe_s { - UV_HANDLE_FIELDS - UV_STREAM_FIELDS - UV_PIPE_PRIVATE_FIELDS -}; - -enum uv_pipe_flags { - UV_PIPE_IPC = 0x01, - UV_PIPE_SPAWN_SAFE = 0x02, - UV_PIPE_READABLE = 0x04, - UV_PIPE_WRITABLE = 0x08 -}; -/* - * Initialize a pipe. The last argument is a boolean to indicate if - * this pipe will be used for handle passing between processes. - */ -UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int flags); - -/* - * Creates a pipe and assigns the two pipe ends to the given uv_pipe_t's - */ -UV_EXTERN int uv_pipe_link(uv_pipe_t *read, uv_pipe_t *write); - -/* - * Attempt to synchronously close the given pipe. This will only work if the pipe is - * inactive (i.e. not reading, writing listening, connecting, etc. Otherwise this function - * will abort() - */ -UV_EXTERN void uv_pipe_close_sync(uv_pipe_t *pipe); - -/* - * Opens an existing file descriptor or HANDLE as a pipe. - */ -UV_EXTERN int uv_pipe_open(uv_pipe_t*, uv_file file); -UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); -UV_EXTERN void uv_pipe_connect(uv_connect_t* req, - uv_pipe_t* handle, - const char* name, - uv_connect_cb cb); -UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle, - char* buffer, - size_t* size); -UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count); -UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle); -UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle); - - -struct uv_poll_s { - UV_HANDLE_FIELDS - uv_poll_cb poll_cb; - UV_POLL_PRIVATE_FIELDS -}; - -enum uv_poll_event { - UV_READABLE = 1, - UV_WRITABLE = 2, - UV_DISCONNECT = 4 -}; - -UV_EXTERN int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd); -UV_EXTERN int uv_poll_init_socket(uv_loop_t* loop, - uv_poll_t* handle, - uv_os_sock_t socket); -UV_EXTERN int uv_poll_start(uv_poll_t* handle, int events, uv_poll_cb cb); -UV_EXTERN int uv_poll_stop(uv_poll_t* handle); - - -struct uv_prepare_s { - UV_HANDLE_FIELDS - UV_PREPARE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare); -UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb); -UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare); - - -struct uv_check_s { - UV_HANDLE_FIELDS - UV_CHECK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check); -UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb); -UV_EXTERN int uv_check_stop(uv_check_t* check); - - -struct uv_idle_s { - UV_HANDLE_FIELDS - UV_IDLE_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle); -UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb); -UV_EXTERN int uv_idle_stop(uv_idle_t* idle); - - -struct uv_async_s { - UV_HANDLE_FIELDS - UV_ASYNC_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_async_init(uv_loop_t*, - uv_async_t* async, - uv_async_cb async_cb); -UV_EXTERN int uv_async_send(uv_async_t* async); - - -/* - * uv_timer_t is a subclass of uv_handle_t. - * - * Used to get woken up at a specified time in the future. - */ -struct uv_timer_s { - UV_HANDLE_FIELDS - UV_TIMER_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* handle); -UV_EXTERN int uv_timer_start(uv_timer_t* handle, - uv_timer_cb cb, - uint64_t timeout, - uint64_t repeat); -UV_EXTERN int uv_timer_stop(uv_timer_t* handle); -UV_EXTERN int uv_timer_again(uv_timer_t* handle); -UV_EXTERN void uv_timer_set_repeat(uv_timer_t* handle, uint64_t repeat); -UV_EXTERN uint64_t uv_timer_get_repeat(const uv_timer_t* handle); - - -/* - * uv_getaddrinfo_t is a subclass of uv_req_t. - * - * Request object for uv_getaddrinfo. - */ -struct uv_getaddrinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* struct addrinfo* addrinfo is marked as private, but it really isn't. */ - UV_GETADDRINFO_PRIVATE_FIELDS -}; - - -UV_EXTERN int uv_getaddrinfo(uv_loop_t* loop, - uv_getaddrinfo_t* req, - uv_getaddrinfo_cb getaddrinfo_cb, - const char* node, - const char* service, - const struct addrinfo* hints); -UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai); - -/* -* uv_getnameinfo_t is a subclass of uv_req_t. -* -* Request object for uv_getnameinfo. -*/ -struct uv_getnameinfo_s { - UV_REQ_FIELDS - /* read-only */ - uv_loop_t* loop; - /* host and service are marked as private, but they really aren't. */ - UV_GETNAMEINFO_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_getnameinfo(uv_loop_t* loop, - uv_getnameinfo_t* req, - uv_getnameinfo_cb getnameinfo_cb, - const struct sockaddr* addr, - int flags); - -typedef struct uv_stdio_container_s { - uv_handle_type type; - union { - uv_stream_t *stream; - uv_file fd; - uv_os_fd_t os_handle; - } data; -} uv_stdio_container_t; - -/* uv_spawn() options */ -typedef struct uv_process_options_s { - uv_exit_cb exit_cb; /* Called after the process exits. */ - const char* file; /* Path to program to execute. */ - /* - * Command line arguments. args[0] should be the path to the program. On - * Windows this uses CreateProcess which concatenates the arguments into a - * string this can cause some strange errors. See the note at - * windows_verbatim_arguments. - */ - char** args; - /* - * This will be set as the environ variable in the subprocess. If this is - * NULL then the parents environ will be used. - */ - char** env; - /* - * If non-null this represents a directory the subprocess should execute - * in. Stands for current working directory. - */ - const char* cwd; - /* - * Various flags that control how uv_spawn() behaves. See the definition of - * `enum uv_process_flags` below. - */ - unsigned int flags; - /* - * The `stdio` field points to an array of uv_stdio_container_t structs that - * describe the file descriptors that will be made available to the child - * process. The convention is that stdio[0] points to stdin, fd 1 is used for - * stdout, and fd 2 is stderr. - * - * Note that on windows file descriptors greater than 2 are available to the - * child process only if the child processes uses the MSVCRT runtime. - */ - int stdio_count; - uv_stdio_container_t* stdio; - /* - * Libuv can change the child process' user/group id. This happens only when - * the appropriate bits are set in the flags fields. This is not supported on - * windows; uv_spawn() will fail and set the error to UV_ENOTSUP. - */ - uv_uid_t uid; - uv_gid_t gid; -} uv_process_options_t; - -/* - * These are the flags that can be used for the uv_process_options.flags field. - */ -enum uv_process_flags { - /* - * Set the child process' user id. The user id is supplied in the `uid` field - * of the options struct. This does not work on windows; setting this flag - * will cause uv_spawn() to fail. - */ - UV_PROCESS_SETUID = (1 << 0), - /* - * Set the child process' group id. The user id is supplied in the `gid` - * field of the options struct. This does not work on windows; setting this - * flag will cause uv_spawn() to fail. - */ - UV_PROCESS_SETGID = (1 << 1), - /* - * Do not wrap any arguments in quotes, or perform any other escaping, when - * converting the argument list into a command line string. This option is - * only meaningful on Windows systems. On Unix it is silently ignored. - */ - UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = (1 << 2), - /* - * Spawn the child process in a detached state - this will make it a process - * group leader, and will effectively enable the child to keep running after - * the parent exits. Note that the child process will still keep the - * parent's event loop alive unless the parent process calls uv_unref() on - * the child's process handle. - */ - UV_PROCESS_DETACHED = (1 << 3), - /* - * Hide the subprocess console window that would normally be created. This - * option is only meaningful on Windows systems. On Unix it is silently - * ignored. - */ - UV_PROCESS_WINDOWS_HIDE = (1 << 4), - /* - * Reset SIGPIPE to the default handler. Useful for parent processes that ignore - * SIGPIPE, but don't want to make the same assumption for child processes - */ - UV_PROCESS_RESET_SIGPIPE = (1 << 5) -}; - -/* - * uv_process_t is a subclass of uv_handle_t. - */ -struct uv_process_s { - UV_HANDLE_FIELDS - uv_exit_cb exit_cb; - int pid; - UV_PROCESS_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_spawn(uv_loop_t* loop, - uv_process_t* handle, - const uv_process_options_t* options); -UV_EXTERN int uv_process_kill(uv_process_t*, int signum); -UV_EXTERN int uv_kill(int pid, int signum); - - -/* - * uv_work_t is a subclass of uv_req_t. - */ -struct uv_work_s { - UV_REQ_FIELDS - uv_loop_t* loop; - uv_work_cb work_cb; - uv_after_work_cb after_work_cb; - UV_WORK_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_queue_work(uv_loop_t* loop, - uv_work_t* req, - uv_work_cb work_cb, - uv_after_work_cb after_work_cb); - -UV_EXTERN int uv_cancel(uv_req_t* req); - - -struct uv_cpu_info_s { - char* model; - int speed; - struct uv_cpu_times_s { - uint64_t user; - uint64_t nice; - uint64_t sys; - uint64_t idle; - uint64_t irq; - } cpu_times; -}; - -struct uv_interface_address_s { - char* name; - char phys_addr[6]; - int is_internal; - union { - struct sockaddr_in address4; - struct sockaddr_in6 address6; - } address; - union { - struct sockaddr_in netmask4; - struct sockaddr_in6 netmask6; - } netmask; -}; - -struct uv_passwd_s { - char* username; - long uid; - long gid; - char* shell; - char* homedir; -}; - -typedef enum { - UV_DIRENT_UNKNOWN, - UV_DIRENT_FILE, - UV_DIRENT_DIR, - UV_DIRENT_LINK, - UV_DIRENT_FIFO, - UV_DIRENT_SOCKET, - UV_DIRENT_CHAR, - UV_DIRENT_BLOCK -} uv_dirent_type_t; - -struct uv_dirent_s { - const char* name; - uv_dirent_type_t type; -}; - -UV_EXTERN char** uv_setup_args(int argc, char** argv); -UV_EXTERN int uv_get_process_title(char* buffer, size_t size); -UV_EXTERN int uv_set_process_title(const char* title); -UV_EXTERN int uv_resident_set_memory(size_t* rss); -UV_EXTERN int uv_uptime(double* uptime); - -typedef struct { - long tv_sec; - long tv_usec; -} uv_timeval_t; - -typedef struct { - uv_timeval_t ru_utime; /* user CPU time used */ - uv_timeval_t ru_stime; /* system CPU time used */ - uint64_t ru_maxrss; /* maximum resident set size */ - uint64_t ru_ixrss; /* integral shared memory size */ - uint64_t ru_idrss; /* integral unshared data size */ - uint64_t ru_isrss; /* integral unshared stack size */ - uint64_t ru_minflt; /* page reclaims (soft page faults) */ - uint64_t ru_majflt; /* page faults (hard page faults) */ - uint64_t ru_nswap; /* swaps */ - uint64_t ru_inblock; /* block input operations */ - uint64_t ru_oublock; /* block output operations */ - uint64_t ru_msgsnd; /* IPC messages sent */ - uint64_t ru_msgrcv; /* IPC messages received */ - uint64_t ru_nsignals; /* signals received */ - uint64_t ru_nvcsw; /* voluntary context switches */ - uint64_t ru_nivcsw; /* involuntary context switches */ -} uv_rusage_t; - -UV_EXTERN int uv_getrusage(uv_rusage_t* rusage); - -UV_EXTERN int uv_os_homedir(char* buffer, size_t* size); -UV_EXTERN int uv_os_tmpdir(char* buffer, size_t* size); -UV_EXTERN int uv_os_get_passwd(uv_passwd_t* pwd); -UV_EXTERN void uv_os_free_passwd(uv_passwd_t* pwd); - -UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); -UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); - -UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, - int* count); -UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses, - int count); - - -typedef enum { - UV_FS_UNKNOWN = -1, - UV_FS_CUSTOM, - UV_FS_OPEN, - UV_FS_CLOSE, - UV_FS_READ, - UV_FS_WRITE, - UV_FS_SENDFILE, - UV_FS_STAT, - UV_FS_LSTAT, - UV_FS_FSTAT, - UV_FS_FTRUNCATE, - UV_FS_UTIME, - UV_FS_FUTIME, - UV_FS_ACCESS, - UV_FS_CHMOD, - UV_FS_FCHMOD, - UV_FS_FSYNC, - UV_FS_FDATASYNC, - UV_FS_UNLINK, - UV_FS_RMDIR, - UV_FS_MKDIR, - UV_FS_MKDTEMP, - UV_FS_RENAME, - UV_FS_SCANDIR, - UV_FS_LINK, - UV_FS_SYMLINK, - UV_FS_READLINK, - UV_FS_CHOWN, - UV_FS_FCHOWN, - UV_FS_REALPATH -} uv_fs_type; - -/* uv_fs_t is a subclass of uv_req_t. */ -struct uv_fs_s { - UV_REQ_FIELDS - uv_fs_type fs_type; - uv_loop_t* loop; - uv_fs_cb cb; - ssize_t result; - void* ptr; - const char* path; - uv_stat_t statbuf; /* Stores the result of uv_fs_stat() and uv_fs_fstat(). */ - UV_FS_PRIVATE_FIELDS -}; - -UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req); -UV_EXTERN int uv_fs_close(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_open(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_read(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_write(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - const uv_buf_t bufs[], - unsigned int nbufs, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_mkdtemp(uv_loop_t* loop, - uv_fs_t* req, - const char* tpl, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_scandir_next(uv_fs_t* req, - uv_dirent_t* ent); -UV_EXTERN int uv_fs_stat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_rename(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_fs_cb cb); -UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int64_t offset, - uv_fs_cb cb); -UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, - uv_fs_t* req, - uv_file out_fd, - uv_file in_fd, - int64_t in_offset, - size_t length, - uv_fs_cb cb); -UV_EXTERN int uv_fs_access(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_utime(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_futime(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - double atime, - double mtime, - uv_fs_cb cb); -UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_link(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - uv_fs_cb cb); - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * path argument points to a directory. - */ -#define UV_FS_SYMLINK_DIR 0x0001 - -/* - * This flag can be used with uv_fs_symlink() on Windows to specify whether - * the symlink is to be created using junction points. - */ -#define UV_FS_SYMLINK_JUNCTION 0x0002 - -UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - const char* new_path, - int flags, - uv_fs_cb cb); -UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_realpath(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - int mode, - uv_fs_cb cb); -UV_EXTERN int uv_fs_chown(uv_loop_t* loop, - uv_fs_t* req, - const char* path, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); -UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, - uv_fs_t* req, - uv_file file, - uv_uid_t uid, - uv_gid_t gid, - uv_fs_cb cb); - - -enum uv_fs_event { - UV_RENAME = 1, - UV_CHANGE = 2 -}; - - -struct uv_fs_event_s { - UV_HANDLE_FIELDS - /* private */ - char* path; - UV_FS_EVENT_PRIVATE_FIELDS -}; - - -/* - * uv_fs_stat() based polling file watcher. - */ -struct uv_fs_poll_s { - UV_HANDLE_FIELDS - /* Private, don't touch. */ - void* poll_ctx; -}; - -UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle, - uv_fs_poll_cb poll_cb, - const char* path, - unsigned int interval); -UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle); -UV_EXTERN int uv_fs_poll_getpath(uv_fs_poll_t* handle, - char* buffer, - size_t* size); - - -struct uv_signal_s { - UV_HANDLE_FIELDS - uv_signal_cb signal_cb; - int signum; - UV_SIGNAL_PRIVATE_FIELDS -}; - -UV_EXTERN int uv_signal_init(uv_loop_t* loop, uv_signal_t* handle); -UV_EXTERN int uv_signal_start(uv_signal_t* handle, - uv_signal_cb signal_cb, - int signum); -UV_EXTERN int uv_signal_stop(uv_signal_t* handle); - -UV_EXTERN void uv_loadavg(double avg[3]); - - -/* - * Flags to be passed to uv_fs_event_start(). - */ -enum uv_fs_event_flags { - /* - * By default, if the fs event watcher is given a directory name, we will - * watch for all events in that directory. This flags overrides this behavior - * and makes fs_event report only changes to the directory entry itself. This - * flag does not affect individual files watched. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_WATCH_ENTRY = 1, - - /* - * By default uv_fs_event will try to use a kernel interface such as inotify - * or kqueue to detect events. This may not work on remote filesystems such - * as NFS mounts. This flag makes fs_event fall back to calling stat() on a - * regular interval. - * This flag is currently not implemented yet on any backend. - */ - UV_FS_EVENT_STAT = 2, - - /* - * By default, event watcher, when watching directory, is not registering - * (is ignoring) changes in it's subdirectories. - * This flag will override this behaviour on platforms that support it. - */ - UV_FS_EVENT_RECURSIVE = 4 -}; - - -UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_start(uv_fs_event_t* handle, - uv_fs_event_cb cb, - const char* path, - unsigned int flags); -UV_EXTERN int uv_fs_event_stop(uv_fs_event_t* handle); -UV_EXTERN int uv_fs_event_getpath(uv_fs_event_t* handle, - char* buffer, - size_t* size); - -UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); -UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); - -UV_EXTERN int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size); -UV_EXTERN int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size); - -UV_EXTERN int uv_inet_ntop(int af, const void* src, char* dst, size_t size); -UV_EXTERN int uv_inet_pton(int af, const char* src, void* dst); - -UV_EXTERN int uv_exepath(char* buffer, size_t* size); - -UV_EXTERN int uv_cwd(char* buffer, size_t* size); - -UV_EXTERN int uv_chdir(const char* dir); - -UV_EXTERN uint64_t uv_get_free_memory(void); -UV_EXTERN uint64_t uv_get_total_memory(void); - -UV_EXTERN uint64_t uv_hrtime(void); - -UV_EXTERN void uv_disable_stdio_inheritance(void); - -UV_EXTERN int uv_dlopen(const char* filename, uv_lib_t* lib); -UV_EXTERN void uv_dlclose(uv_lib_t* lib); -UV_EXTERN int uv_dlsym(uv_lib_t* lib, const char* name, void** ptr); -UV_EXTERN const char* uv_dlerror(const uv_lib_t* lib); - -UV_EXTERN int uv_mutex_init(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle); -UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle); -UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle); - -UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock); -UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock); -UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock); - -UV_EXTERN int uv_sem_init(uv_sem_t* sem, unsigned int value); -UV_EXTERN void uv_sem_destroy(uv_sem_t* sem); -UV_EXTERN void uv_sem_post(uv_sem_t* sem); -UV_EXTERN void uv_sem_wait(uv_sem_t* sem); -UV_EXTERN int uv_sem_trywait(uv_sem_t* sem); - -UV_EXTERN int uv_cond_init(uv_cond_t* cond); -UV_EXTERN void uv_cond_destroy(uv_cond_t* cond); -UV_EXTERN void uv_cond_signal(uv_cond_t* cond); -UV_EXTERN void uv_cond_broadcast(uv_cond_t* cond); - -UV_EXTERN int uv_barrier_init(uv_barrier_t* barrier, unsigned int count); -UV_EXTERN void uv_barrier_destroy(uv_barrier_t* barrier); -UV_EXTERN int uv_barrier_wait(uv_barrier_t* barrier); - -UV_EXTERN void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex); -UV_EXTERN int uv_cond_timedwait(uv_cond_t* cond, - uv_mutex_t* mutex, - uint64_t timeout); - -UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void)); - -UV_EXTERN int uv_key_create(uv_key_t* key); -UV_EXTERN void uv_key_delete(uv_key_t* key); -UV_EXTERN void* uv_key_get(uv_key_t* key); -UV_EXTERN void uv_key_set(uv_key_t* key, void* value); - -/* - * CPU masks for thread affinity must be at least UV_CPU_SETSIZE bytes long. - */ -#if defined(_WIN32) -# if defined(_WIN64) -# define UV_CPU_SETSIZE 64 -# else -# define UV_CPU_SETSIZE 32 -# endif -#else -# if defined(__APPLE__) || defined(_AIX) -# define UV_CPU_SETSIZE 8 -# else -# define UV_CPU_SETSIZE CPU_SETSIZE -# endif -#endif - -/* - * Callback that is invoked to initialize thread execution. - * - * `arg` is the same value that was passed to uv_thread_create(). - */ -typedef void (*uv_thread_cb)(void* arg); - -UV_EXTERN int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg); -UV_EXTERN int uv_thread_setaffinity(uv_thread_t* tid, - char *cpumask, - char *oldmask, - size_t mask_size); -UV_EXTERN int uv_thread_getaffinity(uv_thread_t* tid, - char *cpumask, - size_t mask_size); -UV_EXTERN int uv_thread_detach(uv_thread_t* tid); -UV_EXTERN uv_thread_t uv_thread_self(void); -UV_EXTERN int uv_thread_join(uv_thread_t *tid); -UV_EXTERN int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2); - -/* The presence of these unions force similar struct layout. */ -#define XX(_, name) uv_ ## name ## _t name; -union uv_any_handle { - UV_HANDLE_TYPE_MAP(XX) -}; - -union uv_any_req { - UV_REQ_TYPE_MAP(XX) -}; -#undef XX - - -struct uv_loop_s { - /* User data - use this for whatever. */ - void* data; - /* Loop reference counting. */ - unsigned int active_handles; - void* handle_queue[2]; - void* active_reqs[2]; - /* Internal flag to signal loop stop. */ - unsigned int stop_flag; - UV_LOOP_PRIVATE_FIELDS -}; - - -/* Don't export the private CPP symbols. */ -#undef UV_HANDLE_TYPE_PRIVATE -#undef UV_REQ_TYPE_PRIVATE -#undef UV_REQ_PRIVATE_FIELDS -#undef UV_STREAM_PRIVATE_FIELDS -#undef UV_TCP_PRIVATE_FIELDS -#undef UV_PREPARE_PRIVATE_FIELDS -#undef UV_CHECK_PRIVATE_FIELDS -#undef UV_IDLE_PRIVATE_FIELDS -#undef UV_ASYNC_PRIVATE_FIELDS -#undef UV_TIMER_PRIVATE_FIELDS -#undef UV_GETADDRINFO_PRIVATE_FIELDS -#undef UV_GETNAMEINFO_PRIVATE_FIELDS -#undef UV_FS_REQ_PRIVATE_FIELDS -#undef UV_WORK_PRIVATE_FIELDS -#undef UV_FS_EVENT_PRIVATE_FIELDS -#undef UV_SIGNAL_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_FIELDS -#undef UV_LOOP_PRIVATE_PLATFORM_FIELDS - -#ifdef __cplusplus -} -#endif -#endif /* UV_H */ diff --git a/julia-0.6.2/lib/julia/libLLVM-3.9.1.so b/julia-0.6.2/lib/julia/libLLVM-3.9.1.so deleted file mode 120000 index 093992f..0000000 --- a/julia-0.6.2/lib/julia/libLLVM-3.9.1.so +++ /dev/null @@ -1 +0,0 @@ -libLLVM-3.9.so \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libLLVM-3.9.so.REMOVED.git-id b/julia-0.6.2/lib/julia/libLLVM-3.9.so.REMOVED.git-id deleted file mode 100644 index 9bd34be..0000000 --- a/julia-0.6.2/lib/julia/libLLVM-3.9.so.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -173da2407f070e4c4947732c7bbed9c8abb0727b \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libLLVM.so b/julia-0.6.2/lib/julia/libLLVM.so deleted file mode 120000 index 093992f..0000000 --- a/julia-0.6.2/lib/julia/libLLVM.so +++ /dev/null @@ -1 +0,0 @@ -libLLVM-3.9.so \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libamd.so b/julia-0.6.2/lib/julia/libamd.so deleted file mode 100755 index 131e3b7..0000000 Binary files a/julia-0.6.2/lib/julia/libamd.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libarpack.so b/julia-0.6.2/lib/julia/libarpack.so deleted file mode 120000 index 6160734..0000000 --- a/julia-0.6.2/lib/julia/libarpack.so +++ /dev/null @@ -1 +0,0 @@ -libarpack.so.2.0.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libarpack.so.2 b/julia-0.6.2/lib/julia/libarpack.so.2 deleted file mode 120000 index 6160734..0000000 --- a/julia-0.6.2/lib/julia/libarpack.so.2 +++ /dev/null @@ -1 +0,0 @@ -libarpack.so.2.0.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libarpack.so.2.0.0 b/julia-0.6.2/lib/julia/libarpack.so.2.0.0 deleted file mode 100755 index 8453af9..0000000 Binary files a/julia-0.6.2/lib/julia/libarpack.so.2.0.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libcamd.so b/julia-0.6.2/lib/julia/libcamd.so deleted file mode 100755 index 2e82c4f..0000000 Binary files a/julia-0.6.2/lib/julia/libcamd.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libccalltest.so b/julia-0.6.2/lib/julia/libccalltest.so deleted file mode 100755 index 3e05ac3..0000000 Binary files a/julia-0.6.2/lib/julia/libccalltest.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libccalltest.so.debug b/julia-0.6.2/lib/julia/libccalltest.so.debug deleted file mode 100755 index ffd5968..0000000 Binary files a/julia-0.6.2/lib/julia/libccalltest.so.debug and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libccolamd.so b/julia-0.6.2/lib/julia/libccolamd.so deleted file mode 100755 index 24e95d0..0000000 Binary files a/julia-0.6.2/lib/julia/libccolamd.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libcholmod.so b/julia-0.6.2/lib/julia/libcholmod.so deleted file mode 100755 index 83ae9ca..0000000 Binary files a/julia-0.6.2/lib/julia/libcholmod.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libcolamd.so b/julia-0.6.2/lib/julia/libcolamd.so deleted file mode 100755 index 4cdd009..0000000 Binary files a/julia-0.6.2/lib/julia/libcolamd.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libcurl.so b/julia-0.6.2/lib/julia/libcurl.so deleted file mode 120000 index a5e8ad8..0000000 --- a/julia-0.6.2/lib/julia/libcurl.so +++ /dev/null @@ -1 +0,0 @@ -libcurl.so.4.5.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libcurl.so.4 b/julia-0.6.2/lib/julia/libcurl.so.4 deleted file mode 120000 index a5e8ad8..0000000 --- a/julia-0.6.2/lib/julia/libcurl.so.4 +++ /dev/null @@ -1 +0,0 @@ -libcurl.so.4.5.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libcurl.so.4.5.0 b/julia-0.6.2/lib/julia/libcurl.so.4.5.0 deleted file mode 100755 index e2aa490..0000000 Binary files a/julia-0.6.2/lib/julia/libcurl.so.4.5.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libdSFMT.so b/julia-0.6.2/lib/julia/libdSFMT.so deleted file mode 100755 index d7c2050..0000000 Binary files a/julia-0.6.2/lib/julia/libdSFMT.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libfftw3.so b/julia-0.6.2/lib/julia/libfftw3.so deleted file mode 120000 index 2add15e..0000000 --- a/julia-0.6.2/lib/julia/libfftw3.so +++ /dev/null @@ -1 +0,0 @@ -libfftw3.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3.so.3 b/julia-0.6.2/lib/julia/libfftw3.so.3 deleted file mode 120000 index 2add15e..0000000 --- a/julia-0.6.2/lib/julia/libfftw3.so.3 +++ /dev/null @@ -1 +0,0 @@ -libfftw3.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3.so.3.5.6 b/julia-0.6.2/lib/julia/libfftw3.so.3.5.6 deleted file mode 100755 index 889a45c..0000000 Binary files a/julia-0.6.2/lib/julia/libfftw3.so.3.5.6 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libfftw3_threads.so b/julia-0.6.2/lib/julia/libfftw3_threads.so deleted file mode 120000 index 77d321f..0000000 --- a/julia-0.6.2/lib/julia/libfftw3_threads.so +++ /dev/null @@ -1 +0,0 @@ -libfftw3_threads.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3_threads.so.3 b/julia-0.6.2/lib/julia/libfftw3_threads.so.3 deleted file mode 120000 index 77d321f..0000000 --- a/julia-0.6.2/lib/julia/libfftw3_threads.so.3 +++ /dev/null @@ -1 +0,0 @@ -libfftw3_threads.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3_threads.so.3.5.6 b/julia-0.6.2/lib/julia/libfftw3_threads.so.3.5.6 deleted file mode 100755 index 608e89c..0000000 Binary files a/julia-0.6.2/lib/julia/libfftw3_threads.so.3.5.6 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libfftw3f.so b/julia-0.6.2/lib/julia/libfftw3f.so deleted file mode 120000 index bb22b57..0000000 --- a/julia-0.6.2/lib/julia/libfftw3f.so +++ /dev/null @@ -1 +0,0 @@ -libfftw3f.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3f.so.3 b/julia-0.6.2/lib/julia/libfftw3f.so.3 deleted file mode 120000 index bb22b57..0000000 --- a/julia-0.6.2/lib/julia/libfftw3f.so.3 +++ /dev/null @@ -1 +0,0 @@ -libfftw3f.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3f.so.3.5.6 b/julia-0.6.2/lib/julia/libfftw3f.so.3.5.6 deleted file mode 100755 index 63738bc..0000000 Binary files a/julia-0.6.2/lib/julia/libfftw3f.so.3.5.6 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libfftw3f_threads.so b/julia-0.6.2/lib/julia/libfftw3f_threads.so deleted file mode 120000 index 37727ca..0000000 --- a/julia-0.6.2/lib/julia/libfftw3f_threads.so +++ /dev/null @@ -1 +0,0 @@ -libfftw3f_threads.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3f_threads.so.3 b/julia-0.6.2/lib/julia/libfftw3f_threads.so.3 deleted file mode 120000 index 37727ca..0000000 --- a/julia-0.6.2/lib/julia/libfftw3f_threads.so.3 +++ /dev/null @@ -1 +0,0 @@ -libfftw3f_threads.so.3.5.6 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libfftw3f_threads.so.3.5.6 b/julia-0.6.2/lib/julia/libfftw3f_threads.so.3.5.6 deleted file mode 100755 index e945114..0000000 Binary files a/julia-0.6.2/lib/julia/libfftw3f_threads.so.3.5.6 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libgcc_s.so.1 b/julia-0.6.2/lib/julia/libgcc_s.so.1 deleted file mode 100755 index 666dfaf..0000000 Binary files a/julia-0.6.2/lib/julia/libgcc_s.so.1 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libgfortran.so.4 b/julia-0.6.2/lib/julia/libgfortran.so.4 deleted file mode 100755 index 8dc738f..0000000 Binary files a/julia-0.6.2/lib/julia/libgfortran.so.4 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libgit2.so b/julia-0.6.2/lib/julia/libgit2.so deleted file mode 120000 index 94950dd..0000000 --- a/julia-0.6.2/lib/julia/libgit2.so +++ /dev/null @@ -1 +0,0 @@ -libgit2.so.25 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libgit2.so.0.25.1 b/julia-0.6.2/lib/julia/libgit2.so.0.25.1 deleted file mode 100755 index fba59c3..0000000 Binary files a/julia-0.6.2/lib/julia/libgit2.so.0.25.1 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libgit2.so.25 b/julia-0.6.2/lib/julia/libgit2.so.25 deleted file mode 120000 index dba2ed0..0000000 --- a/julia-0.6.2/lib/julia/libgit2.so.25 +++ /dev/null @@ -1 +0,0 @@ -libgit2.so.0.25.1 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libgmp.so b/julia-0.6.2/lib/julia/libgmp.so deleted file mode 120000 index db67e23..0000000 --- a/julia-0.6.2/lib/julia/libgmp.so +++ /dev/null @@ -1 +0,0 @@ -libgmp.so.10.3.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libgmp.so.10 b/julia-0.6.2/lib/julia/libgmp.so.10 deleted file mode 120000 index db67e23..0000000 --- a/julia-0.6.2/lib/julia/libgmp.so.10 +++ /dev/null @@ -1 +0,0 @@ -libgmp.so.10.3.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libgmp.so.10.3.2 b/julia-0.6.2/lib/julia/libgmp.so.10.3.2 deleted file mode 100755 index 334a99f..0000000 Binary files a/julia-0.6.2/lib/julia/libgmp.so.10.3.2 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libmbedcrypto.so b/julia-0.6.2/lib/julia/libmbedcrypto.so deleted file mode 120000 index 32a2e29..0000000 --- a/julia-0.6.2/lib/julia/libmbedcrypto.so +++ /dev/null @@ -1 +0,0 @@ -libmbedcrypto.so.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedcrypto.so.0 b/julia-0.6.2/lib/julia/libmbedcrypto.so.0 deleted file mode 120000 index d29d3f5..0000000 --- a/julia-0.6.2/lib/julia/libmbedcrypto.so.0 +++ /dev/null @@ -1 +0,0 @@ -libmbedcrypto.so.2.3.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedcrypto.so.2.3.0 b/julia-0.6.2/lib/julia/libmbedcrypto.so.2.3.0 deleted file mode 100755 index 20c0248..0000000 Binary files a/julia-0.6.2/lib/julia/libmbedcrypto.so.2.3.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libmbedtls.so b/julia-0.6.2/lib/julia/libmbedtls.so deleted file mode 120000 index 3e26c40..0000000 --- a/julia-0.6.2/lib/julia/libmbedtls.so +++ /dev/null @@ -1 +0,0 @@ -libmbedtls.so.10 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedtls.so.10 b/julia-0.6.2/lib/julia/libmbedtls.so.10 deleted file mode 120000 index ac298b0..0000000 --- a/julia-0.6.2/lib/julia/libmbedtls.so.10 +++ /dev/null @@ -1 +0,0 @@ -libmbedtls.so.2.3.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedtls.so.2.3.0 b/julia-0.6.2/lib/julia/libmbedtls.so.2.3.0 deleted file mode 100755 index b4be41f..0000000 Binary files a/julia-0.6.2/lib/julia/libmbedtls.so.2.3.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libmbedx509.so b/julia-0.6.2/lib/julia/libmbedx509.so deleted file mode 120000 index 44fc081..0000000 --- a/julia-0.6.2/lib/julia/libmbedx509.so +++ /dev/null @@ -1 +0,0 @@ -libmbedx509.so.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedx509.so.0 b/julia-0.6.2/lib/julia/libmbedx509.so.0 deleted file mode 120000 index 431ddce..0000000 --- a/julia-0.6.2/lib/julia/libmbedx509.so.0 +++ /dev/null @@ -1 +0,0 @@ -libmbedx509.so.2.3.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmbedx509.so.2.3.0 b/julia-0.6.2/lib/julia/libmbedx509.so.2.3.0 deleted file mode 100755 index 31310e8..0000000 Binary files a/julia-0.6.2/lib/julia/libmbedx509.so.2.3.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libmpfr.so b/julia-0.6.2/lib/julia/libmpfr.so deleted file mode 120000 index d77f027..0000000 --- a/julia-0.6.2/lib/julia/libmpfr.so +++ /dev/null @@ -1 +0,0 @@ -libmpfr.so.4.1.5 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmpfr.so.4 b/julia-0.6.2/lib/julia/libmpfr.so.4 deleted file mode 120000 index d77f027..0000000 --- a/julia-0.6.2/lib/julia/libmpfr.so.4 +++ /dev/null @@ -1 +0,0 @@ -libmpfr.so.4.1.5 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libmpfr.so.4.1.5 b/julia-0.6.2/lib/julia/libmpfr.so.4.1.5 deleted file mode 100755 index 469d879..0000000 Binary files a/julia-0.6.2/lib/julia/libmpfr.so.4.1.5 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libopenblas64_.so.0 b/julia-0.6.2/lib/julia/libopenblas64_.so.0 deleted file mode 120000 index f04083e..0000000 --- a/julia-0.6.2/lib/julia/libopenblas64_.so.0 +++ /dev/null @@ -1 +0,0 @@ -libopenblas64_.so \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenblas64_.so.REMOVED.git-id b/julia-0.6.2/lib/julia/libopenblas64_.so.REMOVED.git-id deleted file mode 100644 index 2cd89b5..0000000 --- a/julia-0.6.2/lib/julia/libopenblas64_.so.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c4107e0b3adc180eb0fcff4a80b11a4158eeee7f \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenlibm.so b/julia-0.6.2/lib/julia/libopenlibm.so deleted file mode 120000 index 85a8721..0000000 --- a/julia-0.6.2/lib/julia/libopenlibm.so +++ /dev/null @@ -1 +0,0 @@ -libopenlibm.so.2.3 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenlibm.so.2 b/julia-0.6.2/lib/julia/libopenlibm.so.2 deleted file mode 120000 index 85a8721..0000000 --- a/julia-0.6.2/lib/julia/libopenlibm.so.2 +++ /dev/null @@ -1 +0,0 @@ -libopenlibm.so.2.3 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenlibm.so.2.3 b/julia-0.6.2/lib/julia/libopenlibm.so.2.3 deleted file mode 100755 index 1aa9544..0000000 Binary files a/julia-0.6.2/lib/julia/libopenlibm.so.2.3 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libopenspecfun.so b/julia-0.6.2/lib/julia/libopenspecfun.so deleted file mode 120000 index d84c8a5..0000000 --- a/julia-0.6.2/lib/julia/libopenspecfun.so +++ /dev/null @@ -1 +0,0 @@ -libopenspecfun.so.1.3 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenspecfun.so.1 b/julia-0.6.2/lib/julia/libopenspecfun.so.1 deleted file mode 120000 index d84c8a5..0000000 --- a/julia-0.6.2/lib/julia/libopenspecfun.so.1 +++ /dev/null @@ -1 +0,0 @@ -libopenspecfun.so.1.3 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libopenspecfun.so.1.3 b/julia-0.6.2/lib/julia/libopenspecfun.so.1.3 deleted file mode 100755 index 6886474..0000000 Binary files a/julia-0.6.2/lib/julia/libopenspecfun.so.1.3 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libpcre2-8.so b/julia-0.6.2/lib/julia/libpcre2-8.so deleted file mode 120000 index 58db0cb..0000000 --- a/julia-0.6.2/lib/julia/libpcre2-8.so +++ /dev/null @@ -1 +0,0 @@ -libpcre2-8.so.0.5.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libpcre2-8.so.0 b/julia-0.6.2/lib/julia/libpcre2-8.so.0 deleted file mode 120000 index 58db0cb..0000000 --- a/julia-0.6.2/lib/julia/libpcre2-8.so.0 +++ /dev/null @@ -1 +0,0 @@ -libpcre2-8.so.0.5.0 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libpcre2-8.so.0.5.0 b/julia-0.6.2/lib/julia/libpcre2-8.so.0.5.0 deleted file mode 100755 index 60b7f0d..0000000 Binary files a/julia-0.6.2/lib/julia/libpcre2-8.so.0.5.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libpcre2-posix.so b/julia-0.6.2/lib/julia/libpcre2-posix.so deleted file mode 120000 index ec084bf..0000000 --- a/julia-0.6.2/lib/julia/libpcre2-posix.so +++ /dev/null @@ -1 +0,0 @@ -libpcre2-posix.so.1.0.1 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libpcre2-posix.so.1 b/julia-0.6.2/lib/julia/libpcre2-posix.so.1 deleted file mode 120000 index ec084bf..0000000 --- a/julia-0.6.2/lib/julia/libpcre2-posix.so.1 +++ /dev/null @@ -1 +0,0 @@ -libpcre2-posix.so.1.0.1 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libpcre2-posix.so.1.0.1 b/julia-0.6.2/lib/julia/libpcre2-posix.so.1.0.1 deleted file mode 100755 index fc7bab1..0000000 Binary files a/julia-0.6.2/lib/julia/libpcre2-posix.so.1.0.1 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libquadmath.so.0 b/julia-0.6.2/lib/julia/libquadmath.so.0 deleted file mode 100755 index a77633a..0000000 Binary files a/julia-0.6.2/lib/julia/libquadmath.so.0 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libspqr.so b/julia-0.6.2/lib/julia/libspqr.so deleted file mode 100755 index 5fca0cf..0000000 Binary files a/julia-0.6.2/lib/julia/libspqr.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libssh2.so b/julia-0.6.2/lib/julia/libssh2.so deleted file mode 120000 index b4441c3..0000000 --- a/julia-0.6.2/lib/julia/libssh2.so +++ /dev/null @@ -1 +0,0 @@ -libssh2.so.1 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libssh2.so.1 b/julia-0.6.2/lib/julia/libssh2.so.1 deleted file mode 120000 index 8a7d69e..0000000 --- a/julia-0.6.2/lib/julia/libssh2.so.1 +++ /dev/null @@ -1 +0,0 @@ -libssh2.so.1.0.1 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libssh2.so.1.0.1 b/julia-0.6.2/lib/julia/libssh2.so.1.0.1 deleted file mode 100755 index acc0829..0000000 Binary files a/julia-0.6.2/lib/julia/libssh2.so.1.0.1 and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libstdc++.so.6.REMOVED.git-id b/julia-0.6.2/lib/julia/libstdc++.so.6.REMOVED.git-id deleted file mode 100644 index 5331be2..0000000 --- a/julia-0.6.2/lib/julia/libstdc++.so.6.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -377f8f8ce9cebf8cacbe276ca0b9c2a4f1c37e0b \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/libsuitesparse_wrapper.so b/julia-0.6.2/lib/julia/libsuitesparse_wrapper.so deleted file mode 100755 index 73ee68b..0000000 Binary files a/julia-0.6.2/lib/julia/libsuitesparse_wrapper.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libsuitesparseconfig.so b/julia-0.6.2/lib/julia/libsuitesparseconfig.so deleted file mode 100755 index c2c8424..0000000 Binary files a/julia-0.6.2/lib/julia/libsuitesparseconfig.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/libumfpack.so b/julia-0.6.2/lib/julia/libumfpack.so deleted file mode 100755 index 5f8e029..0000000 Binary files a/julia-0.6.2/lib/julia/libumfpack.so and /dev/null differ diff --git a/julia-0.6.2/lib/julia/sys-debug.so.REMOVED.git-id b/julia-0.6.2/lib/julia/sys-debug.so.REMOVED.git-id deleted file mode 100644 index fa1342d..0000000 --- a/julia-0.6.2/lib/julia/sys-debug.so.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bea66e45699bd0218bb96710f12fb2dbada76944 \ No newline at end of file diff --git a/julia-0.6.2/lib/julia/sys.so.REMOVED.git-id b/julia-0.6.2/lib/julia/sys.so.REMOVED.git-id deleted file mode 100644 index 1734422..0000000 --- a/julia-0.6.2/lib/julia/sys.so.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a33162357633293d6284881a2fd2ed7828b6c23f \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia-debug.so b/julia-0.6.2/lib/libjulia-debug.so deleted file mode 120000 index 68d73c8..0000000 --- a/julia-0.6.2/lib/libjulia-debug.so +++ /dev/null @@ -1 +0,0 @@ -libjulia-debug.so.0.6.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia-debug.so.0.6 b/julia-0.6.2/lib/libjulia-debug.so.0.6 deleted file mode 120000 index 68d73c8..0000000 --- a/julia-0.6.2/lib/libjulia-debug.so.0.6 +++ /dev/null @@ -1 +0,0 @@ -libjulia-debug.so.0.6.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia-debug.so.0.6.2.REMOVED.git-id b/julia-0.6.2/lib/libjulia-debug.so.0.6.2.REMOVED.git-id deleted file mode 100644 index 0040ce7..0000000 --- a/julia-0.6.2/lib/libjulia-debug.so.0.6.2.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -9a1a9b9a68aee9351d7f700849be5390e19d717e \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia.so b/julia-0.6.2/lib/libjulia.so deleted file mode 120000 index 9dc2399..0000000 --- a/julia-0.6.2/lib/libjulia.so +++ /dev/null @@ -1 +0,0 @@ -libjulia.so.0.6.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia.so.0.6 b/julia-0.6.2/lib/libjulia.so.0.6 deleted file mode 120000 index 9dc2399..0000000 --- a/julia-0.6.2/lib/libjulia.so.0.6 +++ /dev/null @@ -1 +0,0 @@ -libjulia.so.0.6.2 \ No newline at end of file diff --git a/julia-0.6.2/lib/libjulia.so.0.6.2.REMOVED.git-id b/julia-0.6.2/lib/libjulia.so.0.6.2.REMOVED.git-id deleted file mode 100644 index e4147b5..0000000 --- a/julia-0.6.2/lib/libjulia.so.0.6.2.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -346cbbe3cdbfd336c1789bc5b187403d546c7b30 \ No newline at end of file diff --git a/julia-0.6.2/share/appdata/julia.appdata.xml b/julia-0.6.2/share/appdata/julia.appdata.xml deleted file mode 100644 index 576d883..0000000 --- a/julia-0.6.2/share/appdata/julia.appdata.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - julia.desktop - CC-BY-SA-3.0 - MIT and LGPL-2.1+ and GPL-2.0+ - -

- Julia is a high-level, high-performance dynamic programming language for - technical computing, with syntax that is familiar to users of other - technical computing environments. It provides a sophisticated compiler, - distributed parallel execution, numerical accuracy, and an extensive - mathematical function library. -

-

- The library, largely written in Julia itself, - also integrates mature, best-of-breed C and Fortran libraries for linear - algebra, random number generation, signal processing, and string processing. - In addition, the Julia developer community is contributing a number of - external packages through Julia’s built-in package manager at a rapid pace. -

-
- - https://julialang.org/images/julia-gnome.png - - https://julialang.org/ - julia-dev@googlegroups.com -
diff --git a/julia-0.6.2/share/applications/julia.desktop b/julia-0.6.2/share/applications/julia.desktop deleted file mode 100644 index 6b41981..0000000 --- a/julia-0.6.2/share/applications/julia.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Julia -Comment=High-level, high-performance dynamic language for technical computing -Exec=julia -Icon=julia -Terminal=true -Type=Application -Categories=Development;ComputerScience;Building;Science;Math;NumericalAnalysis;ParallelComputing;DataVisualization;ConsoleOnly; diff --git a/julia-0.6.2/share/doc/julia/examples/ModInts.jl b/julia-0.6.2/share/doc/julia/examples/ModInts.jl deleted file mode 100644 index a6894cd..0000000 --- a/julia-0.6.2/share/doc/julia/examples/ModInts.jl +++ /dev/null @@ -1,27 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -module ModInts -export ModInt - -import Base: +, -, *, /, inv - -struct ModInt{n} <: Integer - k::Int - ModInt{n}(k) where n = new(mod(k,n)) -end - -Base.show{n}(io::IO, k::ModInt{n}) = - print(io, get(io, :compact, false) ? k.k : "$(k.k) mod $n") - -+{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k+b.k) --{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k-b.k) -*{n}(a::ModInt{n}, b::ModInt{n}) = ModInt{n}(a.k*b.k) --{n}(a::ModInt{n}) = ModInt{n}(-a.k) - -inv{n}(a::ModInt{n}) = ModInt{n}(invmod(a.k, n)) -/{n}(a::ModInt{n}, b::ModInt{n}) = a*inv(b) # broaden for non-coprime? - -Base.promote_rule{n}(::Type{ModInt{n}}, ::Type{Int}) = ModInt{n} -Base.convert{n}(::Type{ModInt{n}}, i::Int) = ModInt{n}(i) - -end # module diff --git a/julia-0.6.2/share/doc/julia/examples/bubblesort.jl b/julia-0.6.2/share/doc/julia/examples/bubblesort.jl deleted file mode 100644 index 6b7c244..0000000 --- a/julia-0.6.2/share/doc/julia/examples/bubblesort.jl +++ /dev/null @@ -1,19 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -import Base.Sort -struct BubbleSortAlg <: Sort.Algorithm end -const BubbleSort = BubbleSortAlg() - -function Base.sort!(v::AbstractVector, lo::Int, hi::Int, ::BubbleSortAlg, o::Sort.Ordering) - while true - clean = true - for i = lo:hi-1 - if Sort.lt(o, v[i+1], v[i]) - v[i+1], v[i] = v[i], v[i+1] - clean = false - end - end - clean && break - end - return v -end diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/README b/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/README deleted file mode 100644 index c6bb2cf..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/README +++ /dev/null @@ -1,27 +0,0 @@ -This is a proof-of-concept that uses ZeroMQ as transport. -It uses a star topology as opposed to the native mesh network. - -Package ZMQ must be installed. All workers only run on localhost. - -All Julia nodes only connect to a "broker" process that listens on known ports -8100 and 8101 via ZMQ sockets. - - -All commands must be run from `examples/clustermanager/0mq` directory - -First, start the broker. In a new console type: - julia broker.jl - -This does not return. - -Next, start a Julia REPL and type: - include("ZMQCM.jl") - ZMQCM.start_master(4) # start with four workers - - -Alternatively, head.jl, a test script could be run. It just launches the requested number of workers, -executes a simple command on all of them and exits. - julia head.jl 4 - -NOTE: As stated this is a proof-of-concept. A real Julia cluster using ZMQ will probably use -different ZMQ socket types and optimize the transport. diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/ZMQCM.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/ZMQCM.jl deleted file mode 100644 index d18e7b6..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/ZMQCM.jl +++ /dev/null @@ -1,277 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -using ZMQ - -import Base: launch, manage, connect, kill - -const BROKER_SUB_PORT = 8100 -const BROKER_PUB_PORT = 8101 - -const SELF_INITIATED = 0 -const REMOTE_INITIATED = 1 - -const PAYLOAD_MSG = "J" -const CONTROL_MSG = "Z" - -const REQUEST_ACK = "R" -const ACK_MSG = "A" -const KILL_MSG = "K" - -mutable struct ZMQCMan <: ClusterManager - map_zmq_julia::Dict{Int, Tuple} - c::Condition - isfree::Bool - ctx - pub - sub - zid_self - ZMQCMan() = new(Dict{Int, Tuple}(), Condition(), true) -end - -const manager = ZMQCMan() - -function lock_for_send() - if manager.isfree == true - manager.isfree = false - else - while manager.isfree == false - wait(manager.c) - if manager.isfree == true - manager.isfree = false - return - end - end - end -end - -function release_lock_for_send() - manager.isfree = true - notify(manager.c, all=true) -end - -function init_node(zid=0) - manager.ctx = Context(1) - pub=Socket(manager.ctx, PUB) # Outbound - connect(pub, "tcp://127.0.0.1:$BROKER_SUB_PORT") - - sub=Socket(manager.ctx, SUB) # In bound - connect(sub, "tcp://127.0.0.1:$BROKER_PUB_PORT") - ZMQ.set_subscribe(sub, string(zid)) - - manager.pub = pub - manager.sub = sub - manager.zid_self = zid - - (pub, sub) -end - -function send_data(zid, mtype, data) - lock_for_send() - ZMQ.send(manager.pub, Message(string(zid)), SNDMORE) - ZMQ.send(manager.pub, Message(string(manager.zid_self)), SNDMORE) - #println("Sending message of type $mtype to $zid") - ZMQ.send(manager.pub, Message(mtype), SNDMORE) - ZMQ.send(manager.pub, Message(data)) - release_lock_for_send() -end - -function setup_connection(zid, initiated_by) - try - read_stream=BufferStream() - write_stream=BufferStream() - - if initiated_by == REMOTE_INITIATED - test_remote = false - else - test_remote = true - end - - manager.map_zmq_julia[zid] = (read_stream, write_stream, test_remote) - - @schedule begin - while true - (r_s, w_s, do_test_remote) = manager.map_zmq_julia[zid] - if do_test_remote - send_data(zid, CONTROL_MSG, REQUEST_ACK) - sleep(0.5) - else - break - end - end - (r_s, w_s, do_test_remote) = manager.map_zmq_julia[zid] - - while true - data = readavailable(w_s) - send_data(zid, PAYLOAD_MSG, data) - end - end - (read_stream, write_stream) - catch e - Base.show_backtrace(STDOUT,catch_backtrace()) - println(e) - rethrow(e) - end -end - -# BROKER -function start_broker() - ctx=Context(1) - xpub=Socket(ctx, XPUB) - xsub=Socket(ctx, XSUB) - - ZMQ.bind(xsub, "tcp://127.0.0.1:$(BROKER_SUB_PORT)") - ZMQ.bind(xpub, "tcp://127.0.0.1:$(BROKER_PUB_PORT)") - - ccall((:zmq_proxy, :libzmq), Cint, (Ptr{Void}, Ptr{Void}, Ptr{Void}), xsub.data, xpub.data, C_NULL) -# proxy(xsub, xpub) - - # control never comes here - ZMQ.close(xpub) - ZMQ.close(xsub) - ZMQ.close(ctx) -end - -function recv_data() - try - #println("On $(manager.zid_self) waiting to recv message") - zid = parse(Int,String(ZMQ.recv(manager.sub))) - assert(zid == manager.zid_self) - - from_zid = parse(Int,String(ZMQ.recv(manager.sub))) - mtype = String(ZMQ.recv(manager.sub)) - - #println("$zid received message of type $mtype from $from_zid") - - data = ZMQ.recv(manager.sub) - if mtype == CONTROL_MSG - cmsg = String(data) - if cmsg == REQUEST_ACK - #println("$from_zid REQUESTED_ACK from $zid") - # send back a control_msg - send_data(from_zid, CONTROL_MSG, ACK_MSG) - elseif cmsg == ACK_MSG - #println("$zid got ACK_MSG from $from_zid") - (r_s, w_s, test_remote) = manager.map_zmq_julia[from_zid] - manager.map_zmq_julia[from_zid] = (r_s, w_s, false) - elseif cmsg == KILL_MSG - exit(0) - else - error("Unknown control message : ", cmsg) - end - data = "" - end - - (from_zid, data) - catch e - Base.show_backtrace(STDOUT,catch_backtrace()) - println(e) - rethrow(e) - end - -end - -# MASTER -function start_master(np) - init_node() - @schedule begin - try - while true - (from_zid, data) = recv_data() - - #println("master recv data from $from_zid") - - (r_s, w_s, t_r) = manager.map_zmq_julia[from_zid] - unsafe_write(r_s, pointer(data), length(data)) - end - catch e - Base.show_backtrace(STDOUT,catch_backtrace()) - println(e) - rethrow(e) - end - end - - addprocs(manager; np=np) -end - - -function launch(manager::ZMQCMan, params::Dict, launched::Array, c::Condition) - #println("launch $(params[:np])") - for i in 1:params[:np] - io, pobj = open(`$(params[:exename]) worker.jl $i $(Base.cluster_cookie())`, "r") - - wconfig = WorkerConfig() - wconfig.userdata = Dict(:zid=>i, :io=>io) - push!(launched, wconfig) - notify(c) - end -end - -function connect(manager::ZMQCMan, pid::Int, config::WorkerConfig) - #println("connect_m2w") - if myid() == 1 - zid = get(config.userdata)[:zid] - config.connect_at = zid # This will be useful in the worker-to-worker connection setup. - - print_worker_stdout(get(config.userdata)[:io], pid) - else - #println("connect_w2w") - zid = get(config.connect_at) - config.userdata = Dict{Symbol, Any}(:zid=>zid) - end - - streams = setup_connection(zid, SELF_INITIATED) - - udata = get(config.userdata) - udata[:streams] = streams - - streams -end - -# WORKER -function start_worker(zid, cookie) - #println("start_worker") - Base.init_worker(cookie, ZMQCMan()) - init_node(zid) - - while true - (from_zid, data) = recv_data() - - #println("worker recv data from $from_zid") - - streams = get(manager.map_zmq_julia, from_zid, nothing) - if streams === nothing - # First time.. - (r_s, w_s) = setup_connection(from_zid, REMOTE_INITIATED) - Base.process_messages(r_s, w_s) - else - (r_s, w_s, t_r) = streams - end - - unsafe_write(r_s, pointer(data), length(data)) - end -end - -function manage(manager::ZMQCMan, id::Int, config::WorkerConfig, op) - nothing -end - -function kill(manager::ZMQCMan, pid::Int, config::WorkerConfig) - send_data(get(config.userdata)[:zid], CONTROL_MSG, KILL_MSG) - (r_s, w_s) = get(config.userdata)[:streams] - close(r_s) - close(w_s) - - # remove from our map - delete!(manager.map_zmq_julia, get(config.userdata)[:zid]) - - nothing -end - - -function print_worker_stdout(io, pid) - @schedule while !eof(io) - line = readline(io) - println("\tFrom worker $(pid):\t$line") - end -end - diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/broker.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/broker.jl deleted file mode 100644 index 87d2849..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/broker.jl +++ /dev/null @@ -1,4 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -include("ZMQCM.jl") -start_broker() diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/head.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/head.jl deleted file mode 100644 index ff0f718..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/head.jl +++ /dev/null @@ -1,11 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -include("ZMQCM.jl") - -# @spawn run(`julia broker.jl`) - -start_master(parse(Int,ARGS[1])) - -resp = pmap(x -> myid() *2, [1:nworkers()]) - -println(resp) diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/worker.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/worker.jl deleted file mode 100644 index bbb2ebc..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/0mq/worker.jl +++ /dev/null @@ -1,5 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -include("ZMQCM.jl") - -start_worker(parse(Int,ARGS[1]), ARGS[2]) diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/README b/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/README deleted file mode 100644 index b14d069..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/README +++ /dev/null @@ -1,12 +0,0 @@ -This is a simple proof-of-concept that uses UNIX domain sockets as transport. - -All commands must be run from `examples/clustermanager/simple` directory - -Start a Julia REPL and type: - include("UnixDomainCM.jl") - addprocs(UnixDomainCM(4)) # start with four workers - -Alternatively, head.jl, a test script could be run. It just launches the requested number of workers, -executes a simple command on all of them and exits. - julia head.jl 4 - diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/UnixDomainCM.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/UnixDomainCM.jl deleted file mode 100644 index d1e27e2..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/UnixDomainCM.jl +++ /dev/null @@ -1,92 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -import Base: launch, manage, connect, exit - -mutable struct UnixDomainCM <: ClusterManager - np::Integer -end - -function launch(manager::UnixDomainCM, params::Dict, launched::Array, c::Condition) -# println("launch $(manager.np)") - cookie = Base.cluster_cookie() - for i in 1:manager.np - sockname = tempname() - try - cmd = `$(params[:exename]) --startup-file=no $(@__FILE__) udwrkr $sockname $cookie` - io, pobj = open(cmd, "r") - - wconfig = WorkerConfig() - wconfig.userdata = Dict(:sockname=>sockname, :io=>io, :process=>pobj) - push!(launched, wconfig) - notify(c) - catch e - println(e) - end - end -end - -function connect(manager::UnixDomainCM, pid::Int, config::WorkerConfig) - if myid() == 1 -# println("connect_m2w") - config.connect_at = get(config.userdata)[:sockname] # This will be useful in the worker-to-worker connection setup. - - print_worker_stdout(get(config.userdata)[:io], pid) - else -# println("connect_w2w") - sockname = get(config.connect_at) - config.userdata = Dict{Symbol, Any}(:sockname=>sockname) - end - - t = time() - while true - try - address = get(config.userdata)[:sockname] - if isa(address, Tuple) - sock = connect(address...) - else - sock = connect(address) - end - return (sock, sock) - catch e - if (time() - t) > 30.0 - rethrow(e) - else - sleep(0.1) - end - end - end - -end - -# WORKER -function start_worker(sockname, cookie) - Base.init_worker(cookie, UnixDomainCM(0)) - - srvr = listen(sockname) - while true - sock = accept(srvr) - Base.process_messages(sock, sock) - end -end - -function manage(manager::UnixDomainCM, id::Int, config::WorkerConfig, op) - # Does not seem to be required, filesystem entry cleanup is happening automatically on process exit -# if op == :deregister -# try -# rm(get(config.userdata)[:sockname]) -# end -# end - nothing -end - -function print_worker_stdout(io, pid) - @schedule while !eof(io) - line = readline(io) - println("\tFrom worker $(pid):\t$line") - end -end - -if (length(ARGS) > 0) && (ARGS[1] == "udwrkr") - # script has been launched as a worker - start_worker(ARGS[2], ARGS[3]) -end diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/head.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/head.jl deleted file mode 100644 index cb16b8e..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/head.jl +++ /dev/null @@ -1,7 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -include("UnixDomainCM.jl") - -addprocs(UnixDomainCM(parse(Int,ARGS[1]))) -resp = pmap(x -> myid() *2, [1:nworkers()]) -println(resp) diff --git a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/test_simple.jl b/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/test_simple.jl deleted file mode 100644 index 57e8a8a..0000000 --- a/julia-0.6.2/share/doc/julia/examples/clustermanager/simple/test_simple.jl +++ /dev/null @@ -1,12 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -cmanpath = joinpath(dirname(@__FILE__), "UnixDomainCM.jl") -include(cmanpath) - -npids = addprocs(UnixDomainCM(2)) -assert(length(npids) == 2) -test_pids = [remotecall_fetch(myid, x) for x in npids] -assert(npids == test_pids) -rmprocs(npids; waitfor=1.0) - -exit(0) diff --git a/julia-0.6.2/share/doc/julia/examples/dictchannel.jl b/julia-0.6.2/share/doc/julia/examples/dictchannel.jl deleted file mode 100644 index f1b9bfd..0000000 --- a/julia-0.6.2/share/doc/julia/examples/dictchannel.jl +++ /dev/null @@ -1,34 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -import Base: put!, wait, isready, take!, fetch - -mutable struct DictChannel <: AbstractChannel - d::Dict - cond_take::Condition # waiting for data to become available - DictChannel() = new(Dict(), Condition()) -end - -function put!(D::DictChannel, k, v) - D.d[k] = v - notify(D.cond_take) - D -end - -function take!(D::DictChannel, k) - v=fetch(D,k) - delete!(D.d, k) - v -end - -isready(D::DictChannel) = length(D.d) > 1 -isready(D::DictChannel, k) = haskey(D.d,k) -function fetch(D::DictChannel, k) - wait(D,k) - D.d[k] -end - -function wait(D::DictChannel, k) - while !isready(D, k) - wait(D.cond_take) - end -end diff --git a/julia-0.6.2/share/doc/julia/examples/embedding/.gitignore b/julia-0.6.2/share/doc/julia/examples/embedding/.gitignore deleted file mode 100644 index 4ce246e..0000000 --- a/julia-0.6.2/share/doc/julia/examples/embedding/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/embedding -/embedding-debug diff --git a/julia-0.6.2/share/doc/julia/examples/embedding/Makefile b/julia-0.6.2/share/doc/julia/examples/embedding/Makefile deleted file mode 100644 index 38e9bc3..0000000 --- a/julia-0.6.2/share/doc/julia/examples/embedding/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -# This Makefile template requires the following variables to be set -# in the environment or on the command-line: -# JULIA: path to julia[.exe] executable -# BIN: binary build directory - -ifndef JULIA - $(error "Please pass JULIA=[path of target julia binary], or set as environment variable!") -endif -ifndef BIN - $(error "Please pass BIN=[path of build directory], or set as environment variable!") -endif - -#============================================================================= -# this source directory where embedding.c is located -SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) - -# get the executable suffix, if any -EXE := $(suffix $(abspath $(JULIA))) - -# get compiler and linker flags. (see: `contrib/julia-config.jl`) -JULIA_CONFIG := $(JULIA) -e 'include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "julia-config.jl"))' -- -CPPFLAGS_ADD := -CFLAGS_ADD = $(shell $(JULIA_CONFIG) --cflags) -LDFLAGS_ADD = -lm $(shell $(JULIA_CONFIG) --ldflags --ldlibs) - -DEBUGFLAGS += -g - -#============================================================================= - -release: $(BIN)/embedding$(EXE) -debug: $(BIN)/embedding-debug$(EXE) - -$(BIN)/embedding$(EXE): $(SRCDIR)/embedding.c - $(CC) $^ -o $@ $(CPPFLAGS_ADD) $(CPPFLAGS) $(CFLAGS_ADD) $(CFLAGS) $(LDFLAGS_ADD) $(LDFLAGS) - -$(BIN)/embedding-debug$(EXE): $(SRCDIR)/embedding.c - $(CC) $^ -o $@ $(CPPFLAGS_ADD) $(CPPFLAGS) $(CFLAGS_ADD) $(CFLAGS) $(LDFLAGS_ADD) $(LDFLAGS) $(DEBUGFLAGS) - -check: $(BIN)/embedding$(EXE) - $(JULIA) $(SRCDIR)/embedding-test.jl $< - @echo SUCCESS - -clean: - -rm -f $(BIN)/embedding-debug$(EXE) $(BIN)/embedding$(EXE) - -.PHONY: release debug clean check - -# Makefile debugging trick: -# call print-VARIABLE to see the runtime value of any variable -print-%: - @echo '$*=$($*)' diff --git a/julia-0.6.2/share/doc/julia/examples/embedding/embedding-test.jl b/julia-0.6.2/share/doc/julia/examples/embedding/embedding-test.jl deleted file mode 100644 index 8081bdc..0000000 --- a/julia-0.6.2/share/doc/julia/examples/embedding/embedding-test.jl +++ /dev/null @@ -1,22 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -# tests the output of the embedding example is correct -using Base.Test - -@test length(ARGS) == 1 -@testset "embedding example" begin - stdout = Pipe() - stderr = Pipe() - p = spawn(pipeline(Cmd(ARGS), stdin=DevNull, stdout=stdout, stderr=stderr)) - close(stdout.in) - close(stderr.in) - stdout_task = @async readlines(stdout) - stderr = readstring(stderr) - @test stderr == "MethodError: no method matching this_function_has_no_methods()\n" - @test success(p) - lines = wait(stdout_task) - @test length(lines) == 9 - @test parse(Float64, lines[1]) ≈ sqrt(2) - @test lines[8] == "called bar" - @test lines[9] == "calling new bar" -end diff --git a/julia-0.6.2/share/doc/julia/examples/embedding/embedding.c b/julia-0.6.2/share/doc/julia/examples/embedding/embedding.c deleted file mode 100644 index a4172a1..0000000 --- a/julia-0.6.2/share/doc/julia/examples/embedding/embedding.c +++ /dev/null @@ -1,153 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -#include -#include -#include - -#ifdef _OS_WINDOWS_ -__declspec(dllexport) __cdecl -#endif -double my_c_sqrt(double x) -{ - return sqrt(x); -} - -jl_value_t *checked_eval_string(const char* code) -{ - jl_value_t *result = jl_eval_string(code); - if (jl_exception_occurred()) { - // none of these allocate, so a gc-root (JL_GC_PUSH) is not necessary - jl_call2(jl_get_function(jl_base_module, "showerror"), - jl_stderr_obj(), - jl_exception_occurred()); - jl_printf(jl_stderr_stream(), "\n"); - jl_atexit_hook(1); - exit(1); - } - assert(result && "Missing return value but no exception occurred!"); - return result; -} - -int main() -{ - jl_init(); - - { - // Simple running of Julia code - - checked_eval_string("println(sqrt(2.0))"); - } - - { - // Accessing the return value - - jl_value_t *ret = checked_eval_string("sqrt(2.0)"); - double retDouble = jl_unbox_float64(ret); - printf("sqrt(2.0) in C: %e\n", retDouble); - fflush(stdout); - } - - { - // Same as above but with function handle (more flexible) - - jl_function_t *func = jl_get_function(jl_base_module, "sqrt"); - jl_value_t* argument = jl_box_float64(2.0); - jl_value_t* ret = jl_call1(func, argument); - double retDouble = jl_unbox_float64(ret); - printf("sqrt(2.0) in C: %e\n", retDouble); - fflush(stdout); - } - - { - // 1D arrays - - jl_value_t* array_type = jl_apply_array_type((jl_value_t*)jl_float64_type, 1); - jl_array_t* x = jl_alloc_array_1d(array_type, 10); - // JL_GC_PUSH* is required here to ensure that `x` is not deleted before - // (aka, is gc-rooted until) the program reaches the corresponding JL_GC_POP() - JL_GC_PUSH1(&x); - - double* xData = jl_array_data(x); - - size_t i; - for (i = 0; i < jl_array_len(x); i++) - xData[i] = i; - - jl_function_t *func = jl_get_function(jl_base_module, "reverse!"); - jl_call1(func, (jl_value_t*) x); - - printf("x = ["); - for (i = 0; i < jl_array_len(x); i++) - printf("%e ", xData[i]); - printf("]\n"); - fflush(stdout); - - JL_GC_POP(); - } - - { - // Defining a Julia function and calling it - - checked_eval_string("my_func(x) = 2 * x"); - - jl_function_t *func = jl_get_function(jl_current_module, "my_func"); - jl_value_t* arg = jl_box_float64(5.0); - double ret = jl_unbox_float64(jl_call1(func, arg)); - - printf("my_func(5.0) = %f\n", ret); - fflush(stdout); - } - - { - // Calling a C function from Julia (from C) - - // in a shared library (exported, by name) - checked_eval_string("println( ccall(:my_c_sqrt, Float64, (Float64,), 2.0) )"); - - // or via a pointer - jl_value_t *call_by_ptr = checked_eval_string( - "my_c_sqrt -> println( ccall(my_c_sqrt, Float64, (Float64,), 2.0) )"); - jl_call1(call_by_ptr, jl_box_voidpointer(my_c_sqrt)); - } - - { - // Handling exceptions gracefully - - jl_value_t *f = checked_eval_string("function this_function_has_no_methods end"); - jl_call0(f); - - if (jl_exception_occurred()) { - jl_call2(jl_get_function(jl_base_module, "showerror"), - jl_stderr_obj(), - jl_exception_occurred()); - jl_printf(jl_stderr_stream(), "\n"); - } - - } - - { - // Creating and using a native C function handle - // to a Julia function signature - - checked_eval_string( - "function bar()\n" - " println(\"called bar\")\n" - " random_return_value = 42\n" - "end"); - checked_eval_string( - "function bar_from_c()\n" - " bar()\n" - " nothing\n" - "end"); - typedef void (*Func_VOID__VOID)(void); - jl_value_t *pbar = jl_eval_string("cfunction(bar_from_c, Void, ())"); - Func_VOID__VOID bar = (Func_VOID__VOID)jl_unbox_voidpointer(pbar); - bar(); - checked_eval_string("bar() = println(\"calling new bar\")"); - bar(); - } - - int ret = 0; - jl_atexit_hook(ret); - return ret; -} diff --git a/julia-0.6.2/share/doc/julia/examples/juliatypes.jl b/julia-0.6.2/share/doc/julia/examples/juliatypes.jl deleted file mode 100644 index 09f6fc5..0000000 --- a/julia-0.6.2/share/doc/julia/examples/juliatypes.jl +++ /dev/null @@ -1,1037 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -import Base: convert, show - -abstract type Ty end - -mutable struct TypeName - name::Symbol - abs::Bool - super::Ty # actually TagT - # arity - # representation - # mutable - TypeName(name, abs, super) = new(name, abs, super) - TypeName(name, abs) = new(name, abs) -end - -show(io::IO, x::TypeName) = print(io, x.name) - -mutable struct TagT <: Ty - name::TypeName - params - vararg::Bool - TagT(n, p, v=false) = new(n, p, v) -end - -function show(io::IO, t::TagT) - print(io, t.name.name) - isempty(t.params) && return - print(io, '{') - l = length(t.params) - for i=1:l - show(io, t.params[i]) - if i == l && t.vararg - print(io, "...") - elseif i < l - print(io, ",") - end - end - print(io, '}') -end - -mutable struct BottomTy <: Ty -end - -show(io::IO, ::BottomTy) = print(io, "BottomT") - -mutable struct UnionT <: Ty - a - b - UnionT() = BottomT - UnionT(a) = a - UnionT(a, b) = new(a, b) - UnionT(a, ts...) = new(a, UnionT(ts...)) -end - -function show(io::IO, t::UnionT) - print(io, "UnionT(") - while true - show(io, t.a) - print(io, ",") - if isa(t.b, UnionT) - t = t.b - else - show(io, t.b) - break - end - end - print(io, ')') -end - -mutable struct Var - name::Symbol - lb - ub - Var(n, lb=BottomT, ub=AnyT) = new(n, lb, ub) -end - -function show_var_bounds(io::IO, v::Var) - if v.lb !== BottomT - if v.ub === AnyT - print(io, v.name) - print(io, ">:") - show(io, v.lb) - return - end - show(io, v.lb) - print(io, "<:") - end - print(io, v.name) - if v.ub !== AnyT - print(io, "<:") - show(io, v.ub) - end -end - -show(io::IO, v::Var) = print(io, v.name) - -mutable struct UnionAllT <: Ty - var::Var - T - UnionAllT(v::Var, t) = new(v, t) - UnionAllT(v::Var, t::Union{Type,Tuple}) = new(v, convert(Ty, t)) -end - -function show(io::IO, x::UnionAllT) - print(io, "(@UnionAll ") - show_var_bounds(io, x.var) - print(io, " ") - show(io, x.T) - print(io, ")") -end - - -# Any, Bottom, and Tuple - -const AnyT = TagT(TypeName(:Any,true), ()) -AnyT.name.super = AnyT - -const BottomT = BottomTy() - -const TupleName = TypeName(:Tuple,false,AnyT) -const TupleT = TagT(TupleName, (AnyT,), true) -tupletype(xs...) = inst(TupleName, xs...) -vatype(xs...) = (t = inst(TupleName, xs...); t.vararg = true; t) - - -# type application - -inst(typename::TypeName, params...) = TagT(typename, params) - -inst(t::TagT) = t - -inst(t::UnionAllT, param) = subst(t.T, Dict{Any,Any}(t.var => param)) -inst(t::UnionAllT, param, rest...) = inst(inst(t,param), rest...) - -supertype(t::TagT) = t.name===TupleName ? AnyT : inst(t.name.super, t.params...) - -extend(d::Dict, k, v) = (x = copy(d); x[k]=v; x) - -subst(t::TagT, env) = t===AnyT ? t : TagT(t.name, map(x->subst(x,env), t.params), t.vararg) -subst(t::UnionT, env) = UnionT(subst(t.a,env), subst(t.b,env)) -subst(t::Var, env) = get(env, t, t) -subst(t::UnionAllT, env) = (assert(!haskey(env, t.var)); - newVar = Var(t.var.name, subst(t.var.lb, env), subst(t.var.ub, env)); - UnionAllT(newVar, subst(t.T, extend(env, t.var, newVar)))) -subst(t, env) = t - - -# subtype - -isequal_type(x, y) = issub(x, y) && issub(y, x) - -mutable struct Bounds - # record current lower and upper bounds of a Var - # right: whether this Var is on the right-hand side of A <: B - lb - ub - right::Bool -end - -mutable struct UnionState - depth::Int # number of union decision points we're inside - more::Bool # new union found; need to grow stack - stack::Vector{Bool} # stack of decisions - UnionState() = new(1,0,Bool[]) -end - -mutable struct Env - vars::Dict{Var,Bounds} - Lunions::UnionState - Runions::UnionState - outer::Bool - Env() = new(Dict{Var,Bounds}(), UnionState(), UnionState(), true) -end - -function issub_env(x, y) - e = Env() - ans = forall_exists_issub(x, y, e) - ans, e.vars -end -issub(x, y) = issub_env(x, y)[1] -issub(x, y, env) = (x === y) -issub(x::Ty, y::Ty, env) = (x === y) || x === BottomT - -function forall_exists_issub(x, y, env) - # for all combinations of elements from Unions on the left, there must - # exist a combination of elements from Unions on the right that makes - # issub() true. Unions in invariant position are on both the left and - # the right in this formula. - sub = exists_issub(x, y, env) - - if sub && env.Lunions.more - push!(env.Lunions.stack, false) - sub = forall_exists_issub(x, y, env) - if sub - env.Lunions.stack[end] = true - sub = forall_exists_issub(x, y, env) - end - pop!(env.Lunions.stack) - end - return sub -end - -function exists_issub(x, y, env) - env.Lunions.depth = env.Runions.depth = 1 - env.Lunions.more = env.Runions.more = false - - found = issub(x, y, env) - - if env.Lunions.more - # return up to forall_exists_issub. the recursion must have this shape: - # ∀₁ ∀₁ - # ∃₁ => ∀₂ - # ... - # ∃₁ - # ∃₂ - return true - end - if env.Runions.more - push!(env.Runions.stack, false) - found = exists_issub(x, y, env) - if !found - env.Runions.stack[end] = true - found = exists_issub(x, y, env) - end - pop!(env.Runions.stack) - end - return found -end - -function issub_union(t, u::UnionT, env, R, state::UnionState) - env.outer = false - if state.depth > length(state.stack) - # indicate that stack needs to grow - state.more = true - return true - end - ui = state.stack[state.depth]; state.depth += 1 - choice = getfield(u, 1+ui) - return R ? issub(t, choice, env) : issub(choice, t, env) -end - -issub(a::UnionT, b::UnionT, env) = a === b || issub_union(a, b, env, true, env.Runions) -issub(a::UnionT, b::Ty, env) = b===AnyT || issub_union(b, a, env, false, env.Lunions) -issub(a::Ty, b::UnionT, env) = - a===BottomT || a===b.a || a===b.b || issub_union(a, b, env, true, env.Runions) - -# handle vars before unions -issub(a::UnionT, b::Var, env) = var_gt(b, a, env) -issub(a::Var, b::UnionT, env) = var_lt(a, b, env) - -function issub(a::TagT, b::TagT, env) - env.outer = false - a === b && return true - b === AnyT && return true - a === AnyT && return false - if a.name !== b.name - return issub(supertype(a), b, env) - end - if a.name === TupleName - va, vb = a.vararg, b.vararg - la, lb = length(a.params), length(b.params) - ai = bi = 1 - while ai <= la - bi > lb && return false - !issub(a.params[ai], b.params[bi], env) && return false - ai += 1 - if bi < lb || !vb - bi += 1 - end - end - return (la==lb && va==vb) || (vb && (la >= (va ? lb : lb-1))) - end - for i = 1:length(a.params) - ai, bi = a.params[i], b.params[i] - # use issub in both directions to test equality - if !(ai===bi || (issub(ai, bi, env) && issub(bi, ai, env))) - return false - end - end - return true -end - -function join(a,b) - (a===BottomT || b===AnyT || a === b) && return b - (b===BottomT || a===AnyT) && return a - UnionT(a,b) -end - -issub(a::Ty, b::Var, env) = var_gt(b, a, env) -issub(a::Var, b::Ty, env) = var_lt(a, b, env) -function issub(a::Var, b::Var, env) - env.outer = false - a === b && return true - aa = env.vars[a]; bb = env.vars[b] - if aa.right - # this is a bit odd, but seems necessary to make this case work: - # (@UnionAll x<:T<:x RefT{RefT{T}}) == RefT{@UnionAll x<:T<:x RefT{T}} - bb.right && return issub(bb.ub, bb.lb, env) - return var_lt(a, b, env) - else - if !bb.right # check ∀a,b . a<:b - # the bounds of left-side variables never change, and can only lead - # to other left-side variables, so using || here is safe. - return issub(aa.ub, b, env) || issub(a, bb.lb, env) - end - return var_gt(b, a, env) - end -end - -# issub, but taking apart unions before handling vars -issub_ufirst(a::UnionT, b::Var, env) = issub_union(b, a, env, false, env.Lunions) -issub_ufirst(a::Var, b::UnionT, env) = a===b.a || a===b.b || issub_union(a, b, env, true, env.Runions) -issub_ufirst(a, b, env) = issub(a, b, env) - -function var_lt(b::Var, a::Union{Ty,Var}, env) - env.outer = false - bb = env.vars[b] - #println("$b($(bb.lb),$(bb.ub)) <: $a") - !bb.right && return issub_ufirst(bb.ub, a, env) # check ∀b . b<:a - !issub_ufirst(bb.lb, a, env) && return false - # for contravariance we would need to compute a meet here, but - # because of invariance bb.ub ⊓ a == a here always. however for this - # to work we need to compute issub(left,right) before issub(right,left), - # since otherwise the issub(a, bb.ub) check in var_gt becomes vacuous. - bb.ub = a # meet(bb.ub, a) - return true -end - -function var_gt(b::Var, a::Union{Ty,Var}, env) - env.outer = false - bb = env.vars[b] - #println("$b($(bb.lb),$(bb.ub)) >: $a") - !bb.right && return issub_ufirst(a, bb.lb, env) # check ∀b . b>:a - !issub_ufirst(a, bb.ub, env) && return false - bb.lb = join(bb.lb, a) - return true -end - -function rename(t::UnionAllT) - v = Var(t.var.name, t.var.lb, t.var.ub) - UnionAllT(v, inst(t,v)) -end - -function issub_unionall(t::Ty, u::UnionAllT, env, R) - outer = env.outer - haskey(env.vars, u.var) && (u = rename(u)) - env.vars[u.var] = Bounds(u.var.lb, u.var.ub, R) - ans = R ? issub(t, u.T, env) : issub(u.T, t, env) - !outer && delete!(env.vars, u.var) - return ans -end - -issub(a::UnionAllT, b::UnionAllT, env) = a === b || issub_unionall(a, b, env, true) -issub(a::UnionT, b::UnionAllT, env) = issub_unionall(a, b, env, true) -issub(a::UnionAllT, b::UnionT, env) = issub_unionall(b, a, env, false) -issub(a::Ty, b::UnionAllT, env) = a === BottomT || issub_unionall(a, b, env, true) -issub(a::UnionAllT, b::Ty, env) = b === AnyT || issub_unionall(b, a, env, false) - - -# convenient syntax - -macro UnionAll(var, expr) - lb = :BottomT - ub = :AnyT - if isa(var,Expr) && var.head === :comparison - if length(var.args) == 3 - v = var.args[1] - if var.args[2] == :(<:) - ub = esc(var.args[3]) - elseif var.args[2] == :(>:) - lb = esc(var.args[3]) - else - error("invalid bounds in UnionAll") - end - elseif length(var.args) == 5 - v = var.args[3] - if var.args[2] == var.args[4] == :(<:) - lb = esc(var.args[1]) - ub = esc(var.args[5]) - else - error("invalid bounds in UnionAll") - end - else - error("invalid bounds in UnionAll") - end - elseif isa(var,Expr) && var.head === :(<:) - v = var.args[1] - ub = esc(var.args[2]) - elseif isa(var,Expr) && var.head === :(>:) - v = var.args[1] - lb = esc(var.args[2]) - elseif !isa(var,Symbol) - error("invalid variable in UnionAll") - else - v = var - end - quote - let $(esc(v)) = Var($(Expr(:quote,v)), $lb, $ub) - UnionAllT($(esc(v)), $(esc(expr))) - end - end -end - - -# translating from existing julia types - -const tndict = ObjectIdDict() - -xlate(t) = xlate(t, ObjectIdDict()) - -xlate(t, env) = t - -function xlate(t::Union, env) - if t === Union{} - return BottomT - end - UnionT(map(x->xlate(x,env), t.types)...) -end - -function xlate(t::Tuple, env) - if length(t) == 0 - return inst(TupleName) - end - va = Base.isvarargtype(t[end]) - ts = map(x->(Base.isvarargtype(x) ? xlate(x.parameters[1],env) : xlate(x,env)), t) - tnew = inst(TupleName, ts...) - tnew.vararg = va - tnew -end - -function xlate(t::TypeVar, env) - if haskey(env, t) - return env[t] - end - v = Var(t.name, xlate(t.lb,env), xlate(t.ub,env)) - env[t] = v - v -end - -function xlate(t::DataType, env) - if t === Any - return AnyT - elseif t <: Tuple - return xlate((t.parameters...,), env) - elseif !haskey(tndict,t.name) - para = map(x->xlate(x,env), t.name.primary.parameters) # adds tvars to env - sup = xlate(t.name.primary.super, env) - for i = length(para):-1:1 - sup = UnionAllT(para[i], sup) - end - tn = TypeName(t.name.name, t.abstract, sup) - tndict[t.name] = tn - else - tn = tndict[t.name] - end - inst(tn, map(x->xlate(x,env), t.parameters)...) -end - -convert(::Type{Ty}, t::Union{Type,Tuple}) = xlate(t) -convert(::Type{Ty}, t::TypeVar) = xlate(t) - -issub(a::Union{Type,Tuple}, b::Union{Type,Tuple}) = issub(xlate(a), xlate(b)) -issub(a::Ty , b::Union{Type,Tuple}) = issub(a , xlate(b)) -issub(a::Union{Type,Tuple}, b::Ty ) = issub(xlate(a), b) -issub_env(a::Union{Type,Tuple}, b::Union{Type,Tuple}) = issub_env(xlate(a), xlate(b)) -issub_env(a::Ty , b::Union{Type,Tuple}) = issub_env(a , xlate(b)) -issub_env(a::Union{Type,Tuple}, b::Ty ) = issub_env(xlate(a), b) - -tt(ts...) = Tuple{ts...} -vt(ts...) = Tuple{ts[1:end-1]..., Vararg{ts[end]}} - -# tests - -AbstractArrayT = - let AbstractArrayName = TypeName(:AbstractArray, true, @UnionAll T @UnionAll N AnyT) - @UnionAll T @UnionAll N inst(AbstractArrayName, T, N) - end - -ArrayT = - let ArrayName = TypeName(:Array, false, @UnionAll T @UnionAll N inst(AbstractArrayT, T, N)) - @UnionAll T @UnionAll N inst(ArrayName, T, N) - end - -PairT = let PairName = TypeName(:Pair, false, @UnionAll A @UnionAll B AnyT) - @UnionAll A @UnionAll B inst(PairName, A, B) -end - -RefT = let RefName = TypeName(:Ref, false, @UnionAll T AnyT) - @UnionAll T inst(RefName, T) -end - -tndict[AbstractArray.name] = AbstractArrayT.T.T.name -tndict[Array.name] = ArrayT.T.T.name -tndict[Pair.name] = PairT.T.T.name - -using Base.Test - -issub_strict(x,y) = issub(x,y) && !issub(y,x) - -# level 1: no varags, union, UnionAll -function test_1() - @test issub_strict(Int, Integer) - @test issub_strict(Array{Int,1}, AbstractArray{Int,1}) - - @test isequal_type(Int, Int) - @test isequal_type(Integer, Integer) - @test isequal_type(Array{Int,1}, Array{Int,1}) - @test isequal_type(AbstractArray{Int,1}, AbstractArray{Int,1}) - - @test issub_strict((Int,Int), (Integer,Integer)) - @test issub_strict((Array{Int,1},), (AbstractArray{Int,1},)) - - @test isequal_type((Integer,Integer), (Integer,Integer)) - - @test !issub((Int,Int), (Int,)) - @test !issub((Int,), (Integer,Integer)) -end - -# level 2: varargs -function test_2() - @test issub_strict((Int,Int), vt(Int,)) - @test issub_strict((Int,Int), vt(Int,Int,)) - @test issub_strict((Int,Int), vt(Int,Integer,)) - @test issub_strict((Int,Int), vt(Int,Int,Integer,)) - @test issub_strict(vt(Int,Int), vt(Int,)) - @test issub_strict(vt(Int,Int,Int), vt(Int,)) - @test issub_strict(vt(Int,Int,Int), vt(Integer,Int,)) - @test issub_strict(vt(Int,), vt(Any,)) - @test issub_strict((), vt(Any,)) - - @test isequal_type(vt(Int,), vt(Int,)) - @test isequal_type(vt(Integer,), vt(Integer,)) - - @test !issub((), vt(Int, Int)) - @test !issub((Int,), vt(Int, Int, Int)) - - @test !issub((Int, (Real, Integer)), vt(Int)) -end - -function test_no_diagonal() - # from test_3 - @test issub((@UnionAll T @UnionAll S tupletype(T,S)), (@UnionAll T tupletype(T,T))) - - @test isequal_type((@UnionAll T tupletype(T,T)), (@UnionAll T @UnionAll S tupletype(T,S))) - - @test issub(tupletype(inst(ArrayT,Ty(Integer),1), Ty(Int)), - (@UnionAll T<:Ty(Integer) tupletype(inst(ArrayT,T,1),T))) - - @test issub(Ty((Int,AbstractString,Vector{Any})), - @UnionAll T tupletype(T, T, inst(ArrayT,T,1))) - - @test isequal_type(Ty(Array{Tuple{Integer,Integer},1}), - inst(ArrayT, (@UnionAll T<:Ty(Integer) tupletype(T,T)), 1)) - - @test issub(Ty((Float32,Array{Real,1})), - @UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - - @test isequal_type((@UnionAll T tupletype(inst(RefT,T), T)), - (@UnionAll T @UnionAll S<:T tupletype(inst(RefT,T),S))) - @test isequal_type((@UnionAll T tupletype(inst(RefT,T), T)), - (@UnionAll T @UnionAll S<:T @UnionAll R<:S tupletype(inst(RefT,T),R))) - - @test issub((@UnionAll S<:Ty(Int) (@UnionAll R<:Ty(AbstractString) tupletype(S,R,Ty(Vector{Any})))), - (@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))) -end - -# level 3: UnionAll -function test_3() - @test issub_strict(Ty(Array{Int,1}), @UnionAll T inst(ArrayT, T, 1)) - @test issub_strict((@UnionAll T inst(PairT,T,T)), (@UnionAll T @UnionAll S inst(PairT,T,S))) - @test issub(inst(PairT,Ty(Int),Ty(Int8)), (@UnionAll T @UnionAll S inst(PairT,T,S))) - @test issub(inst(PairT,Ty(Int),Ty(Int8)), (@UnionAll S inst(PairT,Ty(Int),S))) - - @test !issub((@UnionAll T<:Ty(Real) T), (@UnionAll T<:Ty(Integer) T)) - - # diagonal - #@test issub_strict((@UnionAll T tupletype(T,T)), (@UnionAll T @UnionAll S tupletype(T,S))) - @test issub((@UnionAll T tupletype(T,T)), (@UnionAll T @UnionAll S tupletype(T,S))) - @test isequal_type((@UnionAll T tupletype(T,T)), (@UnionAll R tupletype(R,R))) - # diagonal - #@test !issub(tupletype(Ty(Real),Ty(Real)), @UnionAll T<:Ty(Real) tupletype(T,T)) - - @test !issub((@UnionAll T<:Ty(Integer) @UnionAll S<:Ty(Number) (T,S)), - (@UnionAll T<:Ty(Integer) @UnionAll S<:Ty(Number) (S,T))) - - AUA = inst(ArrayT, (@UnionAll T inst(ArrayT,T,1)), 1) - UAA = (@UnionAll T inst(ArrayT, inst(ArrayT,T,1), 1)) - - @test !issub(AUA, UAA) - @test !issub(UAA, AUA) - @test !isequal_type(AUA, UAA) - - @test issub_strict((@UnionAll T Int), (@UnionAll T<:Ty(Integer) Integer)) - - @test isequal_type((@UnionAll T @UnionAll S tupletype(T, tupletype(S))), - (@UnionAll T tupletype(T, @UnionAll S tupletype(S)))) - - @test !issub((@UnionAll T inst(PairT,T,T)), inst(PairT,Ty(Int),Ty(Int8))) - @test !issub((@UnionAll T inst(PairT,T,T)), inst(PairT,Ty(Int),Ty(Int))) - - @test isequal_type((@UnionAll T tupletype(T)), tupletype(AnyT)) - @test isequal_type((@UnionAll T<:Ty(Real) tupletype(T)), tupletype(Ty(Real))) - - #@test !issub(tupletype(inst(ArrayT,Ty(Integer),1), Ty(Int)), - # (@UnionAll T<:Ty(Integer) tupletype(inst(ArrayT,T,1),T))) - @test issub(tupletype(inst(ArrayT,Ty(Integer),1), Ty(Int)), - (@UnionAll T<:Ty(Integer) @UnionAll S<:T tupletype(inst(ArrayT,T,1),S))) - - @test !issub(tupletype(inst(ArrayT,Ty(Integer),1), Ty(Real)), - (@UnionAll T<:Ty(Integer) tupletype(inst(ArrayT,T,1),T))) - - @test !issub(Ty((Int,AbstractString,Vector{Integer})), - @UnionAll T tupletype(T, T, inst(ArrayT,T,1))) - @test !issub(Ty((AbstractString,Int,Vector{Integer})), - @UnionAll T tupletype(T, T, inst(ArrayT,T,1))) - @test !issub(Ty((Int,AbstractString,Vector{Tuple{Integer}})), - @UnionAll T tupletype(T,T,inst(ArrayT,tupletype(T),1))) - - #@test !issub(Ty((Int,AbstractString,Vector{Any})), - # @UnionAll T tupletype(T, T, inst(ArrayT,T,1))) - - @test isequal_type(Ty(Array{Int,1}), inst(ArrayT, (@UnionAll T<:Ty(Int) T), 1)) - @test isequal_type(Ty(Array{Tuple{Any},1}), inst(ArrayT, (@UnionAll T tupletype(T)), 1)) - - @test isequal_type(Ty(Array{Tuple{Int,Int},1}), - inst(ArrayT, (@UnionAll T<:Ty(Int) tupletype(T,T)), 1)) - @test !issub(Ty(Array{Tuple{Int,Integer},1}), - inst(ArrayT, (@UnionAll T<:Ty(Integer) tupletype(T,T)), 1)) - - - @test !issub(inst(PairT,Ty(Int),Ty(Int8)), (@UnionAll T inst(PairT,T,T))) - - @test !issub(tupletype(inst(ArrayT,Ty(Int),1), Ty(Integer)), - (@UnionAll T<:Ty(Integer) tupletype(inst(ArrayT,T,1),T))) - - @test !issub(tupletype(Ty(Integer), inst(ArrayT,Ty(Int),1)), - (@UnionAll T<:Ty(Integer) tupletype(T, inst(ArrayT,T,1)))) - - @test !issub(Ty(Array{Array{Int,1},Integer}), - (@UnionAll T inst(ArrayT,inst(ArrayT,T,1),T))) - - @test issub(Ty(Array{Array{Int,1},Int}), - (@UnionAll T inst(ArrayT,inst(ArrayT,T,1),T))) - - @test issub(Ty((Integer,Int)), @UnionAll T<:Ty(Integer) @UnionAll S<:T tupletype(T,S)) - @test !issub(Ty((Integer,Int)), @UnionAll T<:Ty(Int) @UnionAll S<:T tupletype(T,S)) - @test !issub(Ty((Integer,Int)), @UnionAll T<:Ty(AbstractString) @UnionAll S<:T tupletype(T,S)) - - @test issub(Ty((Float32,Array{Float32,1})), - @UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - - @test !issub(Ty((Float32,Array{Float64,1})), - @UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - - #@test !issub(Ty((Float32,Array{Real,1})), - # @UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - - @test !issub(Ty((Number,Array{Real,1})), - @UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - - @test issub((@UnionAll Ty(Int)<:T<:Ty(Integer) T), @UnionAll T<:Ty(Real) T) - @test issub((@UnionAll Ty(Int)<:T<:Ty(Integer) inst(ArrayT,T,1)), - (@UnionAll T<:Ty(Real) inst(ArrayT,T,1))) - - @test issub((@UnionAll Ty(Int)<:T<:Ty(Integer) T), - (@UnionAll Ty(Integer)<:T<:Ty(Real) T)) - @test !issub((@UnionAll Ty(Int)<:T<:Ty(Integer) inst(ArrayT,T,1)), - (@UnionAll Ty(Integer)<:T<:Ty(Real) inst(ArrayT,T,1))) - - X = (@UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)) - Y = (@UnionAll A<:Ty(Real) @UnionAll B<:inst(AbstractArrayT,A,1) tupletype(A,B)) - @test isequal_type(X,Y) - Z = (@UnionAll A<:Ty(Real) @UnionAll B<:inst(AbstractArrayT,A,1) tupletype(Ty(Real),B)) - @test issub_strict(X,Z) - - @test issub_strict((@UnionAll T @UnionAll S<:T inst(PairT,T,S)), - (@UnionAll T @UnionAll S inst(PairT,T,S))) - @test issub_strict((@UnionAll T @UnionAll S>:T inst(PairT,T,S)), - (@UnionAll T @UnionAll S inst(PairT,T,S))) - - #@test issub_strict((@UnionAll T tupletype(inst(RefT,T), T)), - # (@UnionAll T @UnionAll S<:T tupletype(inst(RefT,T),S))) - #@test issub_strict((@UnionAll T tupletype(inst(RefT,T), T)), - # (@UnionAll T @UnionAll S<:T @UnionAll R<:S tupletype(inst(RefT,T),R))) - @test isequal_type((@UnionAll T tupletype(inst(RefT,T), T)), - (@UnionAll T @UnionAll T<:S<:T tupletype(inst(RefT,T),S))) - @test issub_strict((@UnionAll T tupletype(inst(RefT,T), T)), - (@UnionAll T @UnionAll S>:T tupletype(inst(RefT,T),S))) -end - -# level 4: Union -function test_4() - @test isequal_type(UnionT(BottomT,BottomT), BottomT) - - @test issub_strict(Int, Union{Int,AbstractString}) - @test issub_strict(Union{Int,Int8}, Integer) - - @test isequal_type(Union{Int,Int8}, Union{Int,Int8}) - - @test isequal_type(UnionT(Ty(Int),Ty(Integer)), Ty(Integer)) - - @test isequal_type(tt(Union{Int,Int8},Int16), Union{tt(Int,Int16),tt(Int8,Int16)}) - - @test issub_strict((Int,Int8,Int), vt(Union{Int,Int8},)) - @test issub_strict((Int,Int8,Int), vt(Union{Int,Int8,Int16},)) - - # nested unions - @test !issub(UnionT(Ty(Int),inst(RefT,UnionT(Ty(Int),Ty(Int8)))), - UnionT(Ty(Int),inst(RefT,UnionT(Ty(Int8),Ty(Int16))))) - - A = Ty(Int); B = Ty(Int8) - C = Ty(Int16); D = Ty(Int32) - @test issub(UnionT(UnionT(A,UnionT(A,UnionT(B,C))), UnionT(D,BottomT)), - UnionT(UnionT(A,B),UnionT(C,UnionT(B,D)))) - @test !issub(UnionT(UnionT(A,UnionT(A,UnionT(B,C))), UnionT(D,BottomT)), - UnionT(UnionT(A,B),UnionT(C,UnionT(B,A)))) - - @test isequal_type(UnionT(UnionT(A,B,C), UnionT(D)), UnionT(A,B,C,D)) - @test isequal_type(UnionT(UnionT(A,B,C), UnionT(D)), UnionT(A,UnionT(B,C),D)) - @test isequal_type(UnionT(UnionT(UnionT(UnionT(A)),B,C), UnionT(D)), - UnionT(A,UnionT(B,C),D)) - - @test issub_strict(UnionT(UnionT(A,C), UnionT(D)), UnionT(A,B,C,D)) - - @test !issub(UnionT(UnionT(A,B,C), UnionT(D)), UnionT(A,C,D)) - - # obviously these unions can be simplified, but when they aren't there's trouble - X = UnionT(UnionT(A,B,C),UnionT(A,B,C),UnionT(A,B,C),UnionT(A,B,C), - UnionT(A,B,C),UnionT(A,B,C),UnionT(A,B,C),UnionT(A,B,C)) - Y = UnionT(UnionT(D,B,C),UnionT(D,B,C),UnionT(D,B,C),UnionT(D,B,C), - UnionT(D,B,C),UnionT(D,B,C),UnionT(D,B,C),UnionT(A,B,C)) - @test issub_strict(X,Y) -end - -# level 5: union and UnionAll -function test_5() - u = Ty(Union{Int8,Int}) - - @test issub(Ty((AbstractString,Array{Int,1})), - (@UnionAll T UnionT(tupletype(T,inst(ArrayT,T,1)), - tupletype(T,inst(ArrayT,Ty(Int),1))))) - - @test issub(Ty((Union{Vector{Int},Vector{Int8}},)), - @UnionAll T tupletype(inst(ArrayT,T,1),)) - - @test !issub(Ty((Union{Vector{Int},Vector{Int8}},Vector{Int})), - @UnionAll T tupletype(inst(ArrayT,T,1), inst(ArrayT,T,1))) - - @test !issub(Ty((Union{Vector{Int},Vector{Int8}},Vector{Int8})), - @UnionAll T tupletype(inst(ArrayT,T,1), inst(ArrayT,T,1))) - - @test !issub(Ty(Vector{Int}), @UnionAll T>:u inst(ArrayT,T,1)) - @test issub(Ty(Vector{Integer}), @UnionAll T>:u inst(ArrayT,T,1)) - @test issub(Ty(Vector{Union{Int,Int8}}), @UnionAll T>:u inst(ArrayT,T,1)) - - @test issub((@UnionAll Ty(Int)<:T<:u inst(ArrayT,T,1)), - (@UnionAll Ty(Int)<:T<:u inst(ArrayT,T,1))) - - # with varargs - @test !issub(inst(ArrayT,tupletype(inst(ArrayT,Ty(Int)),inst(ArrayT,Ty(Vector{Int16})),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Int)))), - @UnionAll T<:(@UnionAll S vatype(UnionT(inst(ArrayT,S),inst(ArrayT,inst(ArrayT,S,1))))) inst(ArrayT,T)) - - @test issub(inst(ArrayT,tupletype(inst(ArrayT,Ty(Int)),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Int)))), - @UnionAll T<:(@UnionAll S vatype(UnionT(inst(ArrayT,S),inst(ArrayT,inst(ArrayT,S,1))))) inst(ArrayT,T)) - - @test !issub(tupletype(inst(ArrayT,Ty(Int)),inst(ArrayT,Ty(Vector{Int16})),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Int))), - @UnionAll S vatype(UnionT(inst(ArrayT,S),inst(ArrayT,inst(ArrayT,S,1))))) - - @test issub(tupletype(inst(ArrayT,Ty(Int)),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Vector{Int})),inst(ArrayT,Ty(Int))), - @UnionAll S vatype(UnionT(inst(ArrayT,S),inst(ArrayT,inst(ArrayT,S,1))))) - - B = @UnionAll S<:u tupletype(S, tupletype(AnyT,AnyT,AnyT), inst(RefT,S)) - # these tests require renaming in issub_unionall - @test issub((@UnionAll T<:B tupletype(Ty(Int8), T, inst(RefT,Ty(Int8)))), B) - @test !issub((@UnionAll T<:B tupletype(Ty(Int8), T, inst(RefT,T))), B) - - # the `convert(Type{T},T)` pattern, where T is a Union - # required changing priority of unions and vars - @test issub(tupletype(inst(ArrayT,u,1),Ty(Int)), - @UnionAll T tupletype(inst(ArrayT,T,1), T)) - @test issub(tupletype(inst(ArrayT,u,1),Ty(Int)), - @UnionAll T @UnionAll S<:T tupletype(inst(ArrayT,T,1), S)) -end - -# tricky type variable lower bounds -function test_6() - # diagonal - #@test !issub((@UnionAll S<:Ty(Int) (@UnionAll R<:Ty(AbstractString) tupletype(S,R,Ty(Vector{Any})))), - # (@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))) - @test issub((@UnionAll S<:Ty(Int) (@UnionAll R<:Ty(AbstractString) tupletype(S,R,Ty(Vector{Any})))), - (@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))) - - @test !issub((@UnionAll S<:Ty(Int) (@UnionAll R<:Ty(AbstractString) tupletype(S,R,Ty(Vector{Integer})))), - (@UnionAll T tupletype(T, T, inst(ArrayT,T,1)))) - - t = @UnionAll T tupletype(T,T,inst(RefT,T)) - @test isequal_type(t, rename(t)) - - @test !issub((@UnionAll T tupletype(T,Ty(AbstractString),inst(RefT,T))), - (@UnionAll T tupletype(T,T,inst(RefT,T)))) - - @test !issub((@UnionAll T tupletype(T,inst(RefT,T),Ty(AbstractString))), - (@UnionAll T tupletype(T,inst(RefT,T),T))) - - i = Ty(Int); ai = Ty(Integer) - @test isequal_type((@UnionAll i<:T<:i inst(RefT,T)), inst(RefT,i)) - @test isequal_type((@UnionAll ai<:T<:ai inst(RefT,T)), inst(RefT,ai)) - - # Pair{T,S} <: Pair{T,T} can be true with certain bounds - @test issub_strict((@UnionAll i<:T<:i @UnionAll i<:S<:i inst(PairT,T,S)), - @UnionAll T inst(PairT,T,T)) - - @test issub_strict(tupletype(i, inst(RefT,i)), - (@UnionAll T @UnionAll S<:T tupletype(S,inst(RefT,T)))) - - @test !issub(tupletype(Ty(Real), inst(RefT,i)), - (@UnionAll T @UnionAll S<:T tupletype(S,inst(RefT,T)))) - - # S >: T - @test issub_strict(tupletype(Ty(Real), inst(RefT,i)), - (@UnionAll T @UnionAll S>:T tupletype(S,inst(RefT,T)))) - - @test !issub(tupletype(inst(RefT,i), inst(RefT,ai)), - (@UnionAll T @UnionAll S>:T tupletype(inst(RefT,S),inst(RefT,T)))) - - @test issub_strict(tupletype(inst(RefT,Ty(Real)), inst(RefT,ai)), - (@UnionAll T @UnionAll S>:T tupletype(inst(RefT,S),inst(RefT,T)))) - - - @test issub_strict(tupletype(Ty(Real), inst(RefT,tupletype(i))), - (@UnionAll T @UnionAll S>:T tupletype(S,inst(RefT,tupletype(T))))) - - @test !issub(tupletype(inst(RefT,tupletype(i)), inst(RefT,tupletype(ai))), - (@UnionAll T @UnionAll S>:T tupletype(inst(RefT,tupletype(S)),inst(RefT,tupletype(T))))) - - @test issub_strict(tupletype(inst(RefT,tupletype(Ty(Real))), inst(RefT,tupletype(ai))), - (@UnionAll T @UnionAll S>:T tupletype(inst(RefT,tupletype(S)),inst(RefT,tupletype(T))))) - - # (@UnionAll x<:T<:x Q{T}) == Q{x} - @test isequal_type(inst(RefT,inst(RefT,i)), - inst(RefT,@UnionAll i<:T<:i inst(RefT,T))) - @test isequal_type((@UnionAll i<:T<:i inst(RefT,inst(RefT,T))), - inst(RefT,@UnionAll i<:T<:i inst(RefT,T))) - @test !issub((@UnionAll i<:T<:i inst(RefT,inst(RefT,T))), - inst(RefT,@UnionAll T<:i inst(RefT,T))) - - u = Ty(Union{Int8,Int64}) - A = inst(RefT,BottomT) - B = @UnionAll S<:u inst(RefT,S) - @test issub(inst(RefT,B), @UnionAll A<:T<:B inst(RefT,T)) - - C = @UnionAll S<:u S - @test issub(inst(RefT,C), @UnionAll u<:T<:u inst(RefT,T)) - - BB = @UnionAll S<:BottomT S - @test issub(inst(RefT,B), @UnionAll BB<:U<:B inst(RefT,U)) -end - -# tests that don't pass yet -function test_failing() - # TODO: S <: Array{T} cases -end - -function test_all() - test_1() - test_2() - test_no_diagonal() - test_3() - test_4() - test_5() - test_6() - test_failing() -end - -const menagerie = - Any[BottomT, AnyT, Ty(Int), Ty(Int8), Ty(Integer), Ty(Real), - Ty(Array{Int,1}), Ty(AbstractArray{Int,1}), - Ty(vt(Int,Integer,)), Ty(vt(Integer,Int,)), Ty(()), - Ty(Union{Int,Int8}), - (@UnionAll T inst(ArrayT, T, 1)), - (@UnionAll T inst(PairT,T,T)), - (@UnionAll T @UnionAll S inst(PairT,T,S)), - inst(PairT,Ty(Int),Ty(Int8)), - (@UnionAll S inst(PairT,Ty(Int),S)), - (@UnionAll T tupletype(T,T)), - (@UnionAll T<:Ty(Integer) tupletype(T,T)), - (@UnionAll T @UnionAll S tupletype(T,S)), - (@UnionAll T<:Ty(Integer) @UnionAll S<:Ty(Number) (T,S)), - (@UnionAll T<:Ty(Integer) @UnionAll S<:Ty(Number) (S,T)), - inst(ArrayT, (@UnionAll T inst(ArrayT,T,1)), 1), - (@UnionAll T inst(ArrayT, inst(ArrayT,T,1), 1)), - inst(ArrayT, (@UnionAll T<:Ty(Int) T), 1), - (@UnionAll T<:Ty(Real) @UnionAll S<:inst(AbstractArrayT,T,1) tupletype(T,S)), - UnionT(Ty(Int),inst(RefT,UnionT(Ty(Int),Ty(Int8)))), - (@UnionAll T UnionT(tupletype(T,inst(ArrayT,T,1)), - tupletype(T,inst(ArrayT,Ty(Int),1)))), - ] - -let new = Any[] - # add variants of each type - for T in menagerie - push!(new, inst(RefT, T)) - push!(new, tupletype(T)) - push!(new, tupletype(T,T)) - push!(new, vatype(T)) - push!(new, @UnionAll S<:T S) - push!(new, @UnionAll S<:T inst(RefT,S)) - end - append!(menagerie, new) -end - -function test_properties() - x→y = !x || y - ¬T = @UnionAll X>:T inst(RefT,X) - - for T in menagerie - # top and bottom identities - @test issub(BottomT, T) - @test issub(T, AnyT) - @test issub(T, BottomT) → isequal_type(T, BottomT) - @test issub(AnyT, T) → isequal_type(T, AnyT) - - # unionall identity - @test isequal_type(T, @UnionAll S<:T S) - @test isequal_type(inst(RefT,T), @UnionAll T<:U<:T inst(RefT,U)) - - # equality under renaming - if isa(T, UnionAllT) - @test isequal_type(T, rename(T)) - end - - # inequality under wrapping - @test !isequal_type(T, inst(RefT,T)) - - for S in menagerie - issubTS = issub(T, S) - # transitivity - if issubTS - for R in menagerie - if issub(S, R) - if !issub(T, R) - @show T - @show S - @show R - end - @test issub(T, R) # issub(S, R) → issub(T, R) - @test issub(inst(RefT,S), @UnionAll T<:U<:R inst(RefT,U)) - end - end - end - - # union subsumption - @test isequal_type(T, UnionT(T,S)) → issub(S, T) - - # invariance - @test isequal_type(T, S) == isequal_type(inst(RefT,T), inst(RefT,S)) - - # covariance - @test issubTS == issub(tupletype(T), tupletype(S)) - @test issubTS == issub(vatype(T), vatype(S)) - @test issubTS == issub(tupletype(T), vatype(S)) - - # contravariance - @test issubTS == issub(¬S, ¬T) - end - end -end - -# function non_terminating_F() -# # undecidable F_<: instance -# ¬T = @ForAll α<:T α -# θ = @ForAll α ¬(@ForAll β<:α ¬β) -# a₀ = Var(:a₀, BottomT, θ) -# issub(a₀, (@ForAll a₁<:a₀ ¬a₁)) -# end - -# attempt to implement non-terminating example from -# "On the Decidability of Subtyping with Bounded Existential Types" -function non_terminating_2() - C = let CName = TypeName(:C, false, @UnionAll T AnyT) - @UnionAll T inst(CName, T) - end - D = let DName = TypeName(:D, false, @UnionAll T AnyT) - @UnionAll T inst(DName, T) - end - ¬T = @UnionAll X>:T inst(D,X) - U = AnyT - X = Var(:X, BottomT, ¬U) - e = Env() - e.vars[X] = Bounds(BottomT, ¬U, false) - issub(X, ¬inst(C,X), e) -end - -#= -Replacing type S with a union over var T(ᶜ)<:S can affect the subtype -relation in all possible ways: - - (C{Real},C{Real}) < @U T<:Real (C{T},C{T}) - (Real,Real) = @U T<:Real (T,T) - - (C{Real},C{Real}) ! @U Tᶜ<:Real (C{T},C{T}) (*) # neither <= nor >= - (Real,Real) > @U Tᶜ<:Real (T,T) - - (C{Real},) < @U T<:Real (C{T},) - (Real,) = @U T<:Real (T,) - (C{Real},) ! @U Tᶜ<:Real (C{T},) (*) - (Real,) = @U Tᶜ<:Real (T,) - -cases (*) are probably not needed in practice. - - -transform all covariant occurrences of non-concrete types to -vars: (Real,Real) => @U T<:Real @U S<:Real (T,S) -and then treat all vars as invariant. -this can maybe even be done on the fly without actually making the -UnionAll types up-front. -in fact this may only need to be done on the left. -which implies right away that the algorithm works as-is if the left -side is a concrete type. - -possible explanation: - -1. match all tvars with invariant rule -2. imagine left side is concrete -3. therefore all (right-) vars will have to equal concrete types - (this completes the base case) -4. inductive hypothesis: tvars match concrete types -5. "build up" an abstract type on the left over the initial concrete type -6. handle all abstract types T in covariant position on the left by treating - them as variables V<:T instead -7. by the inductive hypothesis tvars continue to match concrete types - -it seems you need to plug in the isconcrete predicate in step 6. - -=# diff --git a/julia-0.6.2/share/doc/julia/examples/lru.jl b/julia-0.6.2/share/doc/julia/examples/lru.jl deleted file mode 100644 index 7fa54ff..0000000 --- a/julia-0.6.2/share/doc/julia/examples/lru.jl +++ /dev/null @@ -1,130 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -module LRUExample -# An LRU (Least Recently Used) cache is an associative data structure which -# maintains its contents in an order such that the most recently used item -# is at the beginning of the structure, and the least recently used at the end. -# -# This file specifies two types of LRU caches, both with and without a size -# limit. BoundedLRU has a limit and evicts the LRU item if a new item is added -# after that bound is reached. UnboundedLRU does not have a maximum size, but -# can be used as a basis for more complex LRUs. -# -# LRUs should follow the interfaces for general collections, indexable -# collections, and associative collections. - -# The standard implementation of an LRU backs a hash table with a doubly-linked -# list for O(1) operations when reordering on access and eviction. The Julia -# implementation instead backs the table with a Vector. For moderately-sized -# collections, the difference in performance is small, and this implmentation -# is simpler and easier to understand. - -import Base.isempty, Base.length, Base.sizeof -import Base.start, Base.next, Base.done -import Base.haskey, Base.get -import Base.setindex!, Base.getindex, Base.delete!, Base.empty! -import Base.show - -abstract type LRU{K,V} <: Associative{K,V} end - -# Default cache size -const __MAXCACHE = 1024 - -mutable struct CacheItem{K,V} - k::K - v::V -end - -mutable struct UnboundedLRU{K,V} <: LRU{K,V} - ht::Dict - q::Vector{CacheItem} - - UnboundedLRU{K,V}() where {K,V} = new(Dict(), similar(Array{CacheItem}(1), 0)) -end -UnboundedLRU() = UnboundedLRU{Any, Any}() - -mutable struct BoundedLRU{K,V} <: LRU{K,V} - ht::Dict - q::Vector{CacheItem} - maxsize::Int - - BoundedLRU{K,V}(m) where {K,V} = new(Dict(), similar(Array{CacheItem}(1), 0), m) - BoundedLRU{K,V}() where {K,V} = BoundedLRU(__MAXCACHE) -end -BoundedLRU(m) = BoundedLRU{Any, Any}(m) -BoundedLRU() = BoundedLRU{Any, Any}() - -## collections ## - -isempty(lru::LRU) = isempty(lru.q) -length(lru::LRU) = length(lru.q) - -## associative ## - -# Should this check count as an access? -haskey(lru::LRU, key) = haskey(lru.ht, key) - -get(lru::LRU, key, default) = haskey(lru, key) ? lru[key] : default - -function empty!(lru::LRU) - empty!(lru.ht) - empty!(lru.q) -end - - -show(io::IO, lru::UnboundedLRU) = print(io,"UnboundedLRU()") -show(io::IO, lru::BoundedLRU) = print(io,"BoundedLRU($(lru.maxsize))") - -## indexable ## - -# Method to do the second, slow lookup in the list with early return. -function locate(q, x) - for i = 1:length(q) - if q[i] == x - return i - end - end - error("Item not found.") -end - -function getindex(lru::LRU, key) - item = lru.ht[key] - idx = locate(lru.q, item) - splice!(lru.q, idx) - unshift!(lru.q, item) - item.v -end - -function setindex!(lru::LRU, v, key) - if haskey(lru, key) - item = lru.ht[key] - idx = locate(lru.q, item) - item.v = v - splice!(lru.q, idx) - else - item = CacheItem(key, v) - lru.ht[key] = item - end - unshift!(lru.q, item) -end - -# Eviction -function setindex!{V,K}(lru::BoundedLRU, v::V, key::K) - invoke(setindex!, Tuple{LRU,V,K}, lru, v, key) - nrm = length(lru) - lru.maxsize - for i in 1:nrm - rm = pop!(lru.q) - delete!(lru.ht, rm.k) - end -end - -## associative ## - -function delete!(lru::LRU, key) - item = lru.ht[key] - idx = locate(lru.q, item) - delete!(lru.ht, key) - delete!(lru.q, idx) -end - -end # module diff --git a/julia-0.6.2/share/doc/julia/examples/lru_test.jl b/julia-0.6.2/share/doc/julia/examples/lru_test.jl deleted file mode 100644 index 3370220..0000000 --- a/julia-0.6.2/share/doc/julia/examples/lru_test.jl +++ /dev/null @@ -1,47 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -using .LRUExample - -TestLRU = LRUExample.UnboundedLRU{String, String}() -TestBLRU = LRUExample.BoundedLRU{String, String}(1000) - -get_str(i) = String(vcat(map(x->[x>>4; x&0x0F], reinterpret(UInt8, [Int32(i)]))...)) - -isbounded{L<:LRUExample.LRU}(::Type{L}) = any(map(n->n==:maxsize, fieldnames(L))) -isbounded{L<:LRUExample.LRU}(l::L) = isbounded(L) - -nmax = round.(Int, logspace(2, 5, 4)) - -function lrutest() - #println("LRU consistency tests") - for lru in (TestLRU,TestBLRU) - for n in nmax - empty!(lru) - #@printf(" %s, %d items\n", lru, n) - #print(" Simple eviction: ") - for i in 1:n - str = get_str(i) - lru[str] = str - @assert lru.q[1].v == str - if isbounded(lru) && length(lru) >= lru.maxsize - tailstr = get_str(i-lru.maxsize+1) - @assert lru.q[end].v == tailstr - end - end - #println("pass") - - #print(" Lookup, random access: ") - for i in 1:n - str = get_str(rand(1:n)) - if haskey(lru, str) # the bounded LRUs can have cache misses - blah = lru[str] - @assert lru.q[1].v == blah - end - end - #println("pass") - end - empty!(lru) - end -end - -lrutest() diff --git a/julia-0.6.2/share/doc/julia/examples/ndgrid.jl b/julia-0.6.2/share/doc/julia/examples/ndgrid.jl deleted file mode 100644 index 3bce2fc..0000000 --- a/julia-0.6.2/share/doc/julia/examples/ndgrid.jl +++ /dev/null @@ -1,52 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -ndgrid(v::AbstractVector) = copy(v) - -function ndgrid{T}(v1::AbstractVector{T}, v2::AbstractVector{T}) - m, n = length(v1), length(v2) - v1 = reshape(v1, m, 1) - v2 = reshape(v2, 1, n) - (repmat(v1, 1, n), repmat(v2, m, 1)) -end - -function ndgrid_fill(a, v, s, snext) - for j = 1:length(a) - a[j] = v[div(rem(j-1, snext), s)+1] - end -end - -function ndgrid{T}(vs::AbstractVector{T}...) - n = length(vs) - sz = map(length, vs) - out = ntuple(i->Array{T}(sz), n) - s = 1 - for i=1:n - a = out[i]::Array - v = vs[i] - snext = s*size(a,i) - ndgrid_fill(a, v, s, snext) - s = snext - end - out -end - -meshgrid(v::AbstractVector) = meshgrid(v, v) - -function meshgrid{T}(vx::AbstractVector{T}, vy::AbstractVector{T}) - m, n = length(vy), length(vx) - vx = reshape(vx, 1, n) - vy = reshape(vy, m, 1) - (repmat(vx, m, 1), repmat(vy, 1, n)) -end - -function meshgrid{T}(vx::AbstractVector{T}, vy::AbstractVector{T}, - vz::AbstractVector{T}) - m, n, o = length(vy), length(vx), length(vz) - vx = reshape(vx, 1, n, 1) - vy = reshape(vy, m, 1, 1) - vz = reshape(vz, 1, 1, o) - om = ones(Int, m) - on = ones(Int, n) - oo = ones(Int, o) - (vx[om, :, oo], vy[:, on, oo], vz[om, on, :]) -end diff --git a/julia-0.6.2/share/doc/julia/examples/queens.jl b/julia-0.6.2/share/doc/julia/examples/queens.jl deleted file mode 100644 index e44e2fd..0000000 --- a/julia-0.6.2/share/doc/julia/examples/queens.jl +++ /dev/null @@ -1,28 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -# n-queens (nqueens) solver, for nsquaresx-by-nsquaresy board - -struct Queen - x::Int - y::Int -end -hitshorz(queena, queenb) = queena.x == queenb.x -hitsvert(queena, queenb) = queena.y == queenb.y -hitsdiag(queena, queenb) = abs(queena.x - queenb.x) == abs(queena.y - queenb.y) -hitshvd(qa, qb) = hitshorz(qa, qb) || hitsvert(qa, qb) || hitsdiag(qa, qb) -hitsany(testqueen, queens) = any(q -> hitshvd(testqueen, q), queens) - -function trysolve(nsquaresx, nsquaresy, nqueens, presqueens = ()) - nqueens == 0 && return presqueens - for xsquare in 1:nsquaresx - for ysquare in 1:nsquaresy - testqueen = Queen(xsquare, ysquare) - if !hitsany(testqueen, presqueens) - tryqueens = (presqueens..., testqueen) - maybesol = trysolve(nsquaresx, nsquaresy, nqueens - 1, tryqueens) - maybesol !== nothing && return maybesol - end - end - end - return nothing -end diff --git a/julia-0.6.2/share/doc/julia/examples/quine.jl b/julia-0.6.2/share/doc/julia/examples/quine.jl deleted file mode 100644 index aae47e3..0000000 --- a/julia-0.6.2/share/doc/julia/examples/quine.jl +++ /dev/null @@ -1,4 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -x="println(\"# This file is a part of Julia. License is MIT: https://julialang.org/license\\n\\nx=\$(repr(x))\\n\$x\")" -println("# This file is a part of Julia. License is MIT: https://julialang.org/license\n\nx=$(repr(x))\n$x") diff --git a/julia-0.6.2/share/doc/julia/examples/staged.jl b/julia-0.6.2/share/doc/julia/examples/staged.jl deleted file mode 100644 index 5b14f1d..0000000 --- a/julia-0.6.2/share/doc/julia/examples/staged.jl +++ /dev/null @@ -1,61 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -function add_method(gf, an, at, body) - argexs = [Expr(Symbol("::"), an[i], at[i]) for i=1:length(an)] - def = quote - let __F__=($gf) - function __F__($(argexs...)) - $body - end - end - end - eval(def) -end - -macro staged(fdef) - if !isa(fdef,Expr) || fdef.head !== :function - error("@staged: expected method definition") - end - fname = fdef.args[1].args[1] - argspec = fdef.args[1].args[2:end] - argnames = map(x->(isa(x,Expr) ? x.args[1] : x), argspec) - qargnames = map(x->Expr(:quote,x), argnames) - fbody = fdef.args[2] - @gensym gengf argtypes expander genbody - quote - let ($gengf) - global ($fname) # should be "outer" - local ($expander) - function ($expander)($(argnames...)) - $fbody - end - ($gengf)() = 0 # should be initially empty GF - function ($fname)($(argspec...)) - ($argtypes) = typeof(tuple($(argnames...))) - if !method_exists($gengf, $argtypes) - ($genbody) = apply(($expander), ($argtypes)) - add_method($gengf, Any[$(qargnames...)], - $argtypes, $genbody) - end - return ($gengf)($(argnames...)) - end - end - end -end - -# example - -@staged function nloops(dims::Tuple) - names = map(x->gensym(), dims) - ex = quote - println([$(names...)]) - end - for i = 1:length(dims) - ex = quote - for $(names[i]) in dims[$i] - $ex - end - end - end - ex -end diff --git a/julia-0.6.2/share/doc/julia/examples/time.jl b/julia-0.6.2/share/doc/julia/examples/time.jl deleted file mode 100644 index 45bd30f..0000000 --- a/julia-0.6.2/share/doc/julia/examples/time.jl +++ /dev/null @@ -1,45 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -module Time -export TimeDelta - -import Base.show, Base.+, Base.-, Base.convert, Base.promote_rule - -struct TimeDelta{p} - v::Int64 -end - -const PREFIXES = [ - "yocto", "zepto", "atto", "femto", "pico", "nano", "micro", "milli", - "", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta", -] -const ZERO_INDEX = 9 -const MAX_INDEX = 17 - -function show{p}(io::IO, x::TimeDelta{p}) - k = max(1,min(MAX_INDEX,fld(p,3)+ZERO_INDEX)) - r = p-3(k-ZERO_INDEX) - prefix = PREFIXES[k] - if r == 0 - s = x.v == 1 ? "" : "s" - print(io, "$(x.v) $(prefix)second$s") - elseif r > 0 - print(io, "$(x.v*10^r) $(prefix)seconds") - else - print(io, "$(x.v/10^-r) $(prefix)seconds") - end -end - -convert{p,q}(::Type{TimeDelta{p}}, x::TimeDelta{q}) = - TimeDelta{p}(p <= q ? x.v*10^(q-p) : div(x.v,10^(p-q))) - -promote_rule{p,q}(::Type{TimeDelta{p}}, ::Type{TimeDelta{q}}) = TimeDelta{min(p,q)} - --{p}(x::TimeDelta{p}) = TimeDelta{p}(-x.v) -+{p}(x::TimeDelta{p}, y::TimeDelta{p}) = TimeDelta{p}(x.v+y.v) --{p}(x::TimeDelta{p}, y::TimeDelta{p}) = TimeDelta{p}(x.v-y.v) - -+(x::TimeDelta, y::TimeDelta) = +(promote(x,y)...) --(x::TimeDelta, y::TimeDelta) = -(promote(x,y)...) - -end # module diff --git a/julia-0.6.2/share/doc/julia/examples/typetree.jl b/julia-0.6.2/share/doc/julia/examples/typetree.jl deleted file mode 100644 index 1ca8714..0000000 --- a/julia-0.6.2/share/doc/julia/examples/typetree.jl +++ /dev/null @@ -1,154 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -module TypeTrees -## -# Generate a text graphic of Julia modules type tree -## - -struct Binding - mod::Module - sym::Symbol -end -Binding(tn::TypeName) = Binding(tn.module, tn.name) -Base.isless(a::Binding, b::Binding) = isless(a.sym, b.sym) - -# The node type holds the type of the current node and a dict of subtypes -struct TTNode - typ # ::Type - subtypes::Dict{Binding, TTNode} - - TTNode(t::ANY) = new(t, Dict{Binding, TTNode}()) -end - -# Add a node to a dict if not added -function add_ttnode(subtypes::Dict{Binding, TTNode}, sname::Binding, tnode::TTNode) - return get!(subtypes, sname, tnode) -end - -function add_ttnode(subtypes::Dict{Binding, TTNode}, sname::Binding, t::Type) - return get!(subtypes, sname, TTNode(t)) -end - -# Store a type and its type hierarchy chain -# Recurse till we reach the top level type -function store_type(sname::Binding, t::Union) - suptype = Union - tnode = TTNode(t) - - # store unions under Union type - subtypes = store_type(Binding(suptype.name), suptype) - add_ttnode(subtypes, sname, tnode) - store_union(sname, tnode, t) - - # unions are also in a sense related to the types of their components - - return tnode.subtypes -end -function store_union(sname::Binding, tnode::TTNode, t::ANY) - t = Base.unwrap_unionall(t) - if isa(t, Union) - store_union(sname, tnode, t.a) - store_union(sname, tnode, t.b) - elseif isa(t, DataType) - binding = Binding(t.name) - subtypes = store_type(binding, t) - add_ttnode(subtypes, sname, tnode) - end - nothing -end - -function store_type(sname::Binding, t::UnionAll) - suptype = Base.unwrap_unionall(t) - binding = isa(suptype, DataType) ? Binding(suptype.name) : Binding(Main, string(suptype::Union)) - subtypes = store_type(binding, suptype) - tnode = add_ttnode(subtypes, sname, t) - return tnode.subtypes -end - -function store_type(sname::Binding, t::DataType) - suptype = supertype(t) - subtypes = (suptype != t) ? store_type(Binding(suptype.name), suptype) : types_tree - tnode = add_ttnode(subtypes, sname, t) - return tnode.subtypes -end - -# examine all symbols in module and store those that are types -function store_all_from(m::Module) - for s in names(m, true) - if isdefined(m, s) && !Base.isdeprecated(m, s) - t = getfield(m, s) - if isa(t, Type) && t !== Union{} - store_type(Binding(m, s), t) - elseif isa(t, Module) && module_name(t) === s && module_parent(t) === m && t !== m - store_all_from(t) - end - end - end -end - -type_props(typ) = "" -type_props(typ::DataType) = string("<<", - typ.abstract ? " abstract" : " concrete", - typ.mutable ? " mutable" : " immutable", - typ.layout != C_NULL ? string( - Base.datatype_pointerfree(typ) ? " pointerfree" : "", - Base.datatype_haspadding(typ) ? " haspadding" : "", - " nfields:", Core.nfields(typ), - " size:", typ.size, - ", align:", Base.datatype_alignment(typ)) : "", - " >>") - -function print_tree(subtypes::Dict{Binding, TTNode}, pfx::String="") - for b in sort!(collect(keys(subtypes))) - v = subtypes[b] - ishidden = unsafe_load(Base.unsafe_convert(Ptr{UInt8}, b.sym)) == UInt8('#') - if ishidden && supertype(v.typ) === Function - continue - end - if b.mod === Main - n = string(b.sym) - elseif !isa(v.typ, DataType) || v.typ.name.module != b.mod || v.typ.name.name != b.sym - n_io = IOBuffer() - print(n_io, b.mod, '.', b.sym) - ua = v.typ - if isa(ua, UnionAll) - print(n_io, "{") - while true - print(n_io, ua.var) - ua = ua.body - if isa(ua, UnionAll) - print(n_io, ", ") - else - break - end - end - print(n_io, "}") - end - n = String(take!(n_io)) - else - n = string(v.typ) - end - if n == string(v.typ) - println(pfx, "+- ", n, " ", type_props(v.typ)) - else - println(pfx, "+- ", n, " = ", v.typ, " ", type_props(v.typ)) - end - v.typ === Function && println(pfx, ". ## hiding implicit Function subtypes ##") - print_tree(v.subtypes, pfx * ". ") - end -end - - -# TODO: optionally take module names in command line -# TODO: option to list subtrees of type tree, or other symbol types -const types_tree = Dict{Binding, TTNode}() - -store_all_from(Main) - -# print_tree(types_tree) - -end # module - -if !isinteractive() - TypeTrees.print_tree(TypeTrees.types_tree) -end diff --git a/julia-0.6.2/share/doc/julia/examples/wordcount.jl b/julia-0.6.2/share/doc/julia/examples/wordcount.jl deleted file mode 100644 index 2011c88..0000000 --- a/julia-0.6.2/share/doc/julia/examples/wordcount.jl +++ /dev/null @@ -1,86 +0,0 @@ -# This file is a part of Julia. License is MIT: https://julialang.org/license - -# wordcount.jl -# -# Implementation of parallelized "word-count" of a text, inspired by the -# Hadoop WordCount example. Uses @spawn and fetch() to parallelize -# the "map" task. Reduce is currently done single-threaded. -# -# To run in parallel on a string stored in variable `text`: -# julia -p -# julia> require("/examples/wordcount.jl") -# julia> ...(define text)... -# julia> counts=parallel_wordcount(text) -# -# Or to run on a group of files, writing results to an output file: -# julia -p -# julia> require("/examples/wordcount.jl") -# julia> wordcount_files("/tmp/output.txt", "/tmp/input1.txt","/tmp/input2.txt",...) - -# "Map" function. -# Takes a string. Returns a Dict with the number of times each word -# appears in that string. -function wordcount(text) - words=split(text,[' ','\n','\t','-','.',',',':',';'];keep=false) - counts=Dict() - for w = words - counts[w]=get(counts,w,0)+1 - end - return counts -end - -# "Reduce" function. -# Takes a collection of Dicts in the format returned by wordcount() -# Returns a Dict in which words that appear in multiple inputs -# have their totals added together. -function wcreduce(wcs) - counts=Dict() - for c in wcs, (k,v) in c - counts[k] = get(counts,k,0)+v - end - return counts -end - -# Splits input string into nprocs() equal-sized chunks (last one rounds up), -# and @spawns wordcount() for each chunk to run in parallel. Then fetch()s -# results and performs wcreduce(). -function parallel_wordcount(text) - lines=split(text,'\n';keep=false) - np=nprocs() - unitsize=ceil(length(lines)/np) - wcounts=[] - rrefs=[] - # spawn procs - for i=1:np - first=unitsize*(i-1)+1 - last=unitsize*i - if last>length(lines) - last=length(lines) - end - subtext=join(lines[Int(first):Int(last)],"\n") - push!(rrefs, @spawn wordcount( subtext ) ) - end - # fetch results - while length(rrefs)>0 - push!(wcounts,fetch(pop!(rrefs))) - end - # reduce - count=wcreduce(wcounts) - return count -end - -# Takes the name of a result file, and a list of input file names. -# Combines the contents of all files, then performs a parallel_wordcount -# on the resulting string. Writes the results to result_file. -function wordcount_files(result_file,inputs...) - text = "" - for file in inputs - text *= readstring(file) - end - wc = parallel_wordcount(text) - open(result_file,"w") do f - for (k,v) in wc - println(f, k,"=",v) - end - end -end diff --git a/julia-0.6.2/share/doc/julia/html/en/assets/arrow.svg b/julia-0.6.2/share/doc/julia/html/en/assets/arrow.svg deleted file mode 100644 index ee2798d..0000000 --- a/julia-0.6.2/share/doc/julia/html/en/assets/arrow.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/julia-0.6.2/share/doc/julia/html/en/assets/documenter.css b/julia-0.6.2/share/doc/julia/html/en/assets/documenter.css deleted file mode 100644 index b8514ef..0000000 --- a/julia-0.6.2/share/doc/julia/html/en/assets/documenter.css +++ /dev/null @@ -1,541 +0,0 @@ -/* - * The default CSS style for Documenter.jl generated sites - * - * Heavily inspired by the Julia Sphinx theme - * https://github.com/JuliaLang/JuliaDoc - * which extends the sphinx_rtd_theme - * https://github.com/snide/sphinx_rtd_theme - * - * Part of Documenter.jl - * https://github.com/JuliaDocs/Documenter.jl - * - * License: MIT - */ - -/* fonts */ -body, input { - font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif; - font-size: 16px; - color: #222; - text-rendering: optimizeLegibility; -} - -pre, code { - font-family: 'Roboto Mono', Monaco, courier, monospace; - font-size: 0.90em; -} - -pre code { - font-size: 1em; -} - -a { - color: #2980b9; - text-decoration: none; -} - -a:hover { - color: #3091d1; -} - -a:visited { - color: #9b59b6; -} - -body { - line-height: 1.5; -} - -h1 { font-size: 1.75em; } -h2 { font-size: 1.50em; } -h3 { font-size: 1.25em; } -h4 { font-size: 1.15em; } -h5 { font-size: 1.10em; } -h6 { font-size: 1em; } - -h4, h5, h6 { - margin: 1em 0; -} - -img { - max-width: 100%; -} - -table { - border-collapse: collapse; - margin: 1em 0; -} - -th, td { - border: 1px solid #e1e4e5; - padding: 0.5em 1em; -} - -th { - border-bottom-width: 2px; -} - -tr:nth-child(even) { - background-color: #f3f6f6; -} - -hr { - border: 0; - border-top: 1px solid #e5e5e5; -} - -/* Inline code and code blocks */ - -code { - padding: 0.1em; - background-color: rgba(0,0,0,.04); - border-radius: 3px; -} - -pre { - background-color: #f5f5f5; - border: 1px solid #dddddd; - border-radius: 3px; - padding: 0.5em; - overflow: auto; -} - -pre code { - padding: 0; - background-color: initial; -} - -/* Headers in admonitions and docstrings */ -.admonition h1, -article section.docstring h1 { - font-size: 1.25em; -} - -.admonition h2, -article section.docstring h2 { - font-size: 1.10em; -} - -.admonition h3, -.admonition h4, -.admonition h5, -.admonition h6, -article section.docstring h3, -article section.docstring h4, -article section.docstring h5, -article section.docstring h6 { - font-size: 1em; -} - -/* Navigation */ -nav.toc { - position: fixed; - top: 0; - left: 0; - bottom: 0; - width: 20em; - overflow-y: auto; - padding: 1em 0; - background-color: #fcfcfc; - box-shadow: inset -14px 0px 5px -12px rgb(210,210,210); -} - -nav.toc .logo { - margin: 0 auto; - display: block; - max-height: 6em; - max-width: 18em; -} - -nav.toc h1 { - text-align: center; - margin-top: .57em; - margin-bottom: 0; -} - -nav.toc select { - display: block; - height: 2em; - padding: 0 1.6em 0 1em; - min-width: 7em; - max-width: 90%; - max-width: calc(100% - 5em); - margin: 0 auto; - font-size: .83em; - border: 1px solid #c9c9c9; - border-radius: 1em; - - /* TODO: doesn't seem to be centered on Safari */ - text-align: center; - text-align-last: center; - - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; - - background: white url("arrow.svg"); - background-size: 1.155em; - background-repeat: no-repeat; - background-position: right; -} - -nav.toc select:hover { - border: 1px solid #a0a0a0; -} - -nav.toc select option { - text-align: center; -} - -nav.toc input { - display: block; - height: 2em; - width: 90%; - width: calc(100% - 5em); - margin: 1.2em auto; - padding: 0 1em; - border: 1px solid #c9c9c9; - border-radius: 1em; - font-size: .83em; -} - -nav.toc > ul * { - margin: 0; -} - -nav.toc ul { - color: #404040; - padding: 0; - list-style: none; -} - -nav.toc ul .toctext { - color: inherit; - display: block; -} - -nav.toc ul a:hover { - color: #fcfcfc; - background-color: #4e4a4a; -} - -nav.toc ul.internal a { - color: inherit; - display: block; -} - -nav.toc ul.internal a:hover { - background-color: #d6d6d6; -} - -nav.toc ul.internal { - background-color: #e3e3e3; - box-shadow: inset -14px 0px 5px -12px rgb(210,210,210); - list-style: none; -} - -nav.toc ul.internal li.toplevel { - border-top: 1px solid #c9c9c9; - font-weight: bold; -} - -nav.toc ul.internal li.toplevel:first-child { - border-top: none; -} - -nav.toc .toctext { - padding-top: 0.3em; - padding-bottom: 0.3em; - padding-right: 1em; -} - -nav.toc ul .toctext { - padding-left: 1em; -} - -nav.toc ul ul .toctext { - padding-left: 2em; -} - -nav.toc ul ul ul .toctext { - padding-left: 3em; -} - -nav.toc li.current > .toctext { - border-top: 1px solid #c9c9c9; - border-bottom: 1px solid #c9c9c9; - color: #404040; - font-weight: bold; - background-color: white; -} - -article { - margin-left: 20em; - min-width: 20em; - max-width: 48em; - padding: 2em; -} - -article > header {} - -article > header div#topbar { - display: none; -} - -article > header nav ul { - display: inline-block; - list-style: none; - margin: 0; - padding: 0; -} - -article > header nav li { - display: inline-block; - padding-right: 0.2em; -} - -article > header nav li:before { - content: "»"; - padding-right: 0.2em; -} - -article > header .edit-page { - float: right; -} - -article > footer {} - -article > footer a.prev { - float: left; -} -article > footer a.next { - float: right; -} - -article > footer a .direction:after { - content: ": "; -} - -article hr { - margin: 1em 0; -} - -article section.docstring { - border: 1px solid #ddd; - margin: 0.5em 0; - padding: 0.5em; - border-radius: 3px; -} - -article section.docstring .docstring-header { - margin-bottom: 1em; -} - -article section.docstring .docstring-binding { - color: #333; - font-weight: bold; -} - -article section.docstring .docstring-category { - font-style: italic; -} - -article section.docstring a.source-link { - float: left; - font-weight: bold; -} - -.nav-anchor, -.nav-anchor:hover, -.nav-anchor:visited { - color: #333; -} - -/* - * Admonitions - * - * Colors (title, body) - * warning: #f0b37e #ffedcc (orange) - * note: #6ab0de #e7f2fa (blue) - * tip: #1abc9c #dbfaf4 (green) -*/ -.admonition { - border-radius: 3px; - background-color: #eeeeee; -} - -.admonition-title { - border-radius: 3px 3px 0 0; - background-color: #9b9b9b; - padding: 0.15em 0.5em; -} - -.admonition-text { - padding: 0.5em; -} - -.admonition-text > :first-child { - margin-top: 0; -} - -.admonition-text > :last-child { - margin-bottom: 0; -} - -.admonition > .admonition-title:before { - font-family: "FontAwesome"; - margin-right: 5px; - content: "\f06a"; -} - -.admonition.warning > .admonition-title { - background-color: #f0b37e; -} - -.admonition.warning { - background-color: #ffedcc; -} - -.admonition.note > .admonition-title { - background-color: #6ab0de; -} - -.admonition.note { - background-color: #e7f2fa; -} - -.admonition.tip > .admonition-title { - background-color: #1abc9c; -} - -.admonition.tip { - background-color: #dbfaf4; -} - - -/* footnotes */ -.footnote { - padding-left: 0.8em; - border-left: 2px solid #ccc; -} - -/* Search page */ -#search-results .category { - font-size: smaller; -} - -#search-results .category:before { - content: " "; -} - -/* Overriding the block style of highligh.js. - * We have to override the padding and the background-color, since we style this - * part ourselves. Specifically, we style the
 surrounding the , while
- * highlight.js applies the .hljs style directly to the  tag.
- */
-.hljs {
-    background-color: transparent;
-    padding: 0;
-}
-
-@media only screen and (max-width: 768px) {
-    nav.toc {
-        position: fixed;
-        overflow-y: scroll;
-        width: 16em;
-        left: -16em;
-        -webkit-overflow-scrolling: touch;
-        -webkit-transition-property: left; /* Safari */
-        -webkit-transition-duration: 0.3s; /* Safari */
-        transition-property: left;
-        transition-duration: 0.3s;
-        -webkit-transition-timing-function: ease-out; /* Safari */
-        transition-timing-function: ease-out;
-        z-index: 2;
-    }
-
-    nav.toc.show {
-        left: 0;
-    }
-
-    article {
-        margin-left: 0;
-        padding: 3em 0.9em 0 0.9em; /* top right bottom left */
-        overflow-wrap: break-word;
-    }
-
-    article > header {
-        position: fixed;
-        left: 0;
-        z-index: 1;
-    }
-
-    article > header nav, hr {
-        display: none;
-    }
-
-    article > header div#topbar {
-        display: block; /* is mobile */
-        position: fixed;
-        width: 100%;
-        height: 1.5em;
-        padding-top: 1em;
-        padding-bottom: 1em;
-        background-color: #fcfcfc;
-        box-shadow: 0 1px 3px rgba(0,0,0,.26);
-        top: 0;
-        -webkit-transition-property: top; /* Safari */
-        -webkit-transition-duration: 0.3s; /* Safari */
-        transition-property: top;
-        transition-duration: 0.3s;
-    }
-
-    article > header div#topbar.headroom--unpinned.headroom--not-top.headroom--not-bottom {
-        top: -4em;
-        -webkit-transition-property: top; /* Safari */
-        -webkit-transition-duration: 0.7s; /* Safari */
-        transition-property: top;
-        transition-duration: 0.7s;
-    }
-
-    article > header div#topbar span {
-        position: fixed;
-        width: 80%;
-        height: 1.5em;
-        margin-top: -0.1em;
-        margin-left: 0.9em;
-        font-size: 1.2em;
-        overflow: hidden;
-    }
-
-    article > header div#topbar a.fa-bars {
-        float: right;
-        padding: 0.6em;
-        margin-top: -0.6em;
-        margin-right: 0.3em;
-        font-size: 1.5em;
-    }
-
-    article > header div#topbar a.fa-bars:visited {
-        color: #3091d1;
-    }
-
-    article table {
-        overflow-x: auto;
-        display: block;
-    }
-
-    article div.MathJax_Display {
-        overflow: scroll;
-    }
-
-    article span.MathJax {
-        overflow: hidden;
-    }
-}
-
-@media only screen and (max-width: 320px) {
-    body {
-        font-size: 15px;
-    }
-}
diff --git a/julia-0.6.2/share/doc/julia/html/en/assets/documenter.js b/julia-0.6.2/share/doc/julia/html/en/assets/documenter.js
deleted file mode 100644
index 82e239c..0000000
--- a/julia-0.6.2/share/doc/julia/html/en/assets/documenter.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Part of Documenter.jl
- *     https://github.com/JuliaDocs/Documenter.jl
- *
- * License: MIT
- */
-
-requirejs.config({
-    paths: {
-        'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min',
-        'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min',
-        'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.9.3/headroom.min',
-        'mathjax': 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML',
-        'highlight': 'highlightjs/highlight',
-    },
-    shim: {
-        'mathjax' : {
-            exports: "MathJax"
-        }
-    }
-});
-
-// Load MathJax
-require(['mathjax'], function(MathJax) {
-    MathJax.Hub.Config({
-      "tex2jax": {
-        inlineMath: [['$','$'], ['\\(','\\)']],
-        processEscapes: true
-      }
-    });
-    MathJax.Hub.Config({
-      config: ["MMLorHTML.js"],
-      jax: [
-        "input/TeX",
-        "output/HTML-CSS",
-        "output/NativeMML"
-      ],
-      extensions: [
-        "MathMenu.js",
-        "MathZoom.js",
-        "TeX/AMSmath.js",
-        "TeX/AMSsymbols.js",
-        "TeX/autobold.js",
-        "TeX/autoload-all.js"
-      ]
-    });
-    MathJax.Hub.Config({
-      TeX: { equationNumbers: { autoNumber: "AMS" } }
-    });
-})
-
-require(['jquery', 'highlight'], function($, hljs) {
-    $(document).ready(function() {
-        hljs.initHighlighting();
-    })
-
-})
-
-// update the version selector with info from the siteinfo.js and ../versions.js files
-require(['jquery'], function($) {
-    $(document).ready(function() {
-        var version_selector = $("#version-selector");
-
-        // add the current version to the selector based on siteinfo.js, but only if the selector is empty
-        if (typeof DOCUMENTER_CURRENT_VERSION !== 'undefined' && $('#version-selector > option').length == 0) {
-            var option = $("");
-            version_selector.append(option);
-        }
-
-        if (typeof DOC_VERSIONS !== 'undefined') {
-            var existing_versions = $('#version-selector > option');
-            var existing_versions_texts = existing_versions.map(function(i,x){return x.text});
-            DOC_VERSIONS.forEach(function(each) {
-                var version_url = documenterBaseURL + "/../" + each;
-                var existing_id = $.inArray(each, existing_versions_texts);
-                // if not already in the version selector, add it as a new option,
-                // otherwise update the old option with the URL and enable it
-                if (existing_id == -1) {
-                    var option = $("");
-                    version_selector.append(option);
-                } else {
-                    var option = existing_versions[existing_id];
-                    option.value = version_url;
-                    option.disabled = false;
-                }
-            });
-        }
-
-        // only show the version selector if the selector has been populated
-        if ($('#version-selector > option').length > 0) {
-            version_selector.css("visibility", "visible");
-        }
-    })
-
-})
-
-// mobile
-require(['jquery', 'headroom'], function($, Headroom) {
-    $(document).ready(function() {
-        var navtoc = $("nav.toc");
-        $("nav.toc li.current a.toctext").click(function() {
-            navtoc.toggleClass('show');
-        });
-        $("article > header div#topbar a.fa-bars").click(function(ev) {
-            ev.preventDefault();
-            navtoc.toggleClass('show');
-            if (navtoc.hasClass('show')) {
-                var title = $("article > header div#topbar span").text();
-                $("nav.toc ul li a:contains('" + title + "')").focus();
-            }
-        });
-        $("article#docs").bind('click', function(ev) {
-            if ($(ev.target).is('div#topbar a.fa-bars')) {
-                return;
-            }
-            if (navtoc.hasClass('show')) {
-                navtoc.removeClass('show');
-            }
-        });
-        if ($("article > header div#topbar").css('display') == 'block') {
-            var headroom = new Headroom(document.querySelector("article > header div#topbar"), {"tolerance": {"up": 10, "down": 10}});
-            headroom.init();
-        }
-    })
-})
diff --git a/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/default.css b/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/default.css
deleted file mode 100644
index f1bfade..0000000
--- a/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/default.css
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-Original highlight.js style (c) Ivan Sagalaev 
-
-*/
-
-.hljs {
-  display: block;
-  overflow-x: auto;
-  padding: 0.5em;
-  background: #F0F0F0;
-}
-
-
-/* Base color: saturation 0; */
-
-.hljs,
-.hljs-subst {
-  color: #444;
-}
-
-.hljs-comment {
-  color: #888888;
-}
-
-.hljs-keyword,
-.hljs-attribute,
-.hljs-selector-tag,
-.hljs-meta-keyword,
-.hljs-doctag,
-.hljs-name {
-  font-weight: bold;
-}
-
-
-/* User color: hue: 0 */
-
-.hljs-type,
-.hljs-string,
-.hljs-number,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-quote,
-.hljs-template-tag,
-.hljs-deletion {
-  color: #880000;
-}
-
-.hljs-title,
-.hljs-section {
-  color: #880000;
-  font-weight: bold;
-}
-
-.hljs-regexp,
-.hljs-symbol,
-.hljs-variable,
-.hljs-template-variable,
-.hljs-link,
-.hljs-selector-attr,
-.hljs-selector-pseudo {
-  color: #BC6060;
-}
-
-
-/* Language color: hue: 90; */
-
-.hljs-literal {
-  color: #78A960;
-}
-
-.hljs-built_in,
-.hljs-bullet,
-.hljs-code,
-.hljs-addition {
-  color: #397300;
-}
-
-
-/* Meta color: hue: 200 */
-
-.hljs-meta {
-  color: #1f7199;
-}
-
-.hljs-meta-string {
-  color: #4d99bf;
-}
-
-
-/* Misc effects */
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}
diff --git a/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/highlight.js b/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/highlight.js
deleted file mode 100644
index 054b615..0000000
--- a/julia-0.6.2/share/doc/julia/html/en/assets/highlightjs/highlight.js
+++ /dev/null
@@ -1,3403 +0,0 @@
-/*! highlight.js v9.11.0 | BSD3 License | git.io/hljslicense */
-(function(factory) {
-
-  // Find the global object for export to both the browser and web workers.
-  var globalObject = typeof window === 'object' && window ||
-                     typeof self === 'object' && self;
-
-  // Setup highlight.js for different environments. First is Node.js or
-  // CommonJS.
-  if(typeof exports !== 'undefined') {
-    factory(exports);
-  } else if(globalObject) {
-    // Export hljs globally even when using AMD for cases when this script
-    // is loaded with others that may still expect a global hljs.
-    globalObject.hljs = factory({});
-
-    // Finally register the global hljs with AMD.
-    if(typeof define === 'function' && define.amd) {
-      define([], function() {
-        return globalObject.hljs;
-      });
-    }
-  }
-
-}(function(hljs) {
-  // Convenience variables for build-in objects
-  var ArrayProto = [],
-      objectKeys = Object.keys;
-
-  // Global internal variables used within the highlight.js library.
-  var languages = {},
-      aliases   = {};
-
-  // Regular expressions used throughout the highlight.js library.
-  var noHighlightRe    = /^(no-?highlight|plain|text)$/i,
-      languagePrefixRe = /\blang(?:uage)?-([\w-]+)\b/i,
-      fixMarkupRe      = /((^(<[^>]+>|\t|)+|(?:\n)))/gm;
-
-  var spanEndTag = '';
-
-  // Global options used when within external APIs. This is modified when
-  // calling the `hljs.configure` function.
-  var options = {
-    classPrefix: 'hljs-',
-    tabReplace: null,
-    useBR: false,
-    languages: undefined
-  };
-
-
-  /* Utility functions */
-
-  function escape(value) {
-    return value.replace(/&/g, '&').replace(//g, '>');
-  }
-
-  function tag(node) {
-    return node.nodeName.toLowerCase();
-  }
-
-  function testRe(re, lexeme) {
-    var match = re && re.exec(lexeme);
-    return match && match.index === 0;
-  }
-
-  function isNotHighlighted(language) {
-    return noHighlightRe.test(language);
-  }
-
-  function blockLanguage(block) {
-    var i, match, length, _class;
-    var classes = block.className + ' ';
-
-    classes += block.parentNode ? block.parentNode.className : '';
-
-    // language-* takes precedence over non-prefixed class names.
-    match = languagePrefixRe.exec(classes);
-    if (match) {
-      return getLanguage(match[1]) ? match[1] : 'no-highlight';
-    }
-
-    classes = classes.split(/\s+/);
-
-    for (i = 0, length = classes.length; i < length; i++) {
-      _class = classes[i]
-
-      if (isNotHighlighted(_class) || getLanguage(_class)) {
-        return _class;
-      }
-    }
-  }
-
-  function inherit(parent) {  // inherit(parent, override_obj, override_obj, ...)
-    var key;
-    var result = {};
-    var objects = Array.prototype.slice.call(arguments, 1);
-
-    for (key in parent)
-      result[key] = parent[key];
-    objects.forEach(function(obj) {
-      for (key in obj)
-        result[key] = obj[key];
-    });
-    return result;
-  }
-
-  /* Stream merging */
-
-  function nodeStream(node) {
-    var result = [];
-    (function _nodeStream(node, offset) {
-      for (var child = node.firstChild; child; child = child.nextSibling) {
-        if (child.nodeType === 3)
-          offset += child.nodeValue.length;
-        else if (child.nodeType === 1) {
-          result.push({
-            event: 'start',
-            offset: offset,
-            node: child
-          });
-          offset = _nodeStream(child, offset);
-          // Prevent void elements from having an end tag that would actually
-          // double them in the output. There are more void elements in HTML
-          // but we list only those realistically expected in code display.
-          if (!tag(child).match(/br|hr|img|input/)) {
-            result.push({
-              event: 'stop',
-              offset: offset,
-              node: child
-            });
-          }
-        }
-      }
-      return offset;
-    })(node, 0);
-    return result;
-  }
-
-  function mergeStreams(original, highlighted, value) {
-    var processed = 0;
-    var result = '';
-    var nodeStack = [];
-
-    function selectStream() {
-      if (!original.length || !highlighted.length) {
-        return original.length ? original : highlighted;
-      }
-      if (original[0].offset !== highlighted[0].offset) {
-        return (original[0].offset < highlighted[0].offset) ? original : highlighted;
-      }
-
-      /*
-      To avoid starting the stream just before it should stop the order is
-      ensured that original always starts first and closes last:
-
-      if (event1 == 'start' && event2 == 'start')
-        return original;
-      if (event1 == 'start' && event2 == 'stop')
-        return highlighted;
-      if (event1 == 'stop' && event2 == 'start')
-        return original;
-      if (event1 == 'stop' && event2 == 'stop')
-        return highlighted;
-
-      ... which is collapsed to:
-      */
-      return highlighted[0].event === 'start' ? original : highlighted;
-    }
-
-    function open(node) {
-      function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value).replace('"', '"') + '"';}
-      result += '<' + tag(node) + ArrayProto.map.call(node.attributes, attr_str).join('') + '>';
-    }
-
-    function close(node) {
-      result += '';
-    }
-
-    function render(event) {
-      (event.event === 'start' ? open : close)(event.node);
-    }
-
-    while (original.length || highlighted.length) {
-      var stream = selectStream();
-      result += escape(value.substring(processed, stream[0].offset));
-      processed = stream[0].offset;
-      if (stream === original) {
-        /*
-        On any opening or closing tag of the original markup we first close
-        the entire highlighted node stack, then render the original tag along
-        with all the following original tags at the same offset and then
-        reopen all the tags on the highlighted stack.
-        */
-        nodeStack.reverse().forEach(close);
-        do {
-          render(stream.splice(0, 1)[0]);
-          stream = selectStream();
-        } while (stream === original && stream.length && stream[0].offset === processed);
-        nodeStack.reverse().forEach(open);
-      } else {
-        if (stream[0].event === 'start') {
-          nodeStack.push(stream[0].node);
-        } else {
-          nodeStack.pop();
-        }
-        render(stream.splice(0, 1)[0]);
-      }
-    }
-    return result + escape(value.substr(processed));
-  }
-
-  /* Initialization */
-
-  function expand_mode(mode) {
-    if (mode.variants && !mode.cached_variants) {
-      mode.cached_variants = mode.variants.map(function(variant) {
-        return inherit(mode, {variants: null}, variant);
-      });
-    }
-    return mode.cached_variants || (mode.endsWithParent && [inherit(mode)]) || [mode];
-  }
-
-  function compileLanguage(language) {
-
-    function reStr(re) {
-        return (re && re.source) || re;
-    }
-
-    function langRe(value, global) {
-      return new RegExp(
-        reStr(value),
-        'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')
-      );
-    }
-
-    function compileMode(mode, parent) {
-      if (mode.compiled)
-        return;
-      mode.compiled = true;
-
-      mode.keywords = mode.keywords || mode.beginKeywords;
-      if (mode.keywords) {
-        var compiled_keywords = {};
-
-        var flatten = function(className, str) {
-          if (language.case_insensitive) {
-            str = str.toLowerCase();
-          }
-          str.split(' ').forEach(function(kw) {
-            var pair = kw.split('|');
-            compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1];
-          });
-        };
-
-        if (typeof mode.keywords === 'string') { // string
-          flatten('keyword', mode.keywords);
-        } else {
-          objectKeys(mode.keywords).forEach(function (className) {
-            flatten(className, mode.keywords[className]);
-          });
-        }
-        mode.keywords = compiled_keywords;
-      }
-      mode.lexemesRe = langRe(mode.lexemes || /\w+/, true);
-
-      if (parent) {
-        if (mode.beginKeywords) {
-          mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b';
-        }
-        if (!mode.begin)
-          mode.begin = /\B|\b/;
-        mode.beginRe = langRe(mode.begin);
-        if (!mode.end && !mode.endsWithParent)
-          mode.end = /\B|\b/;
-        if (mode.end)
-          mode.endRe = langRe(mode.end);
-        mode.terminator_end = reStr(mode.end) || '';
-        if (mode.endsWithParent && parent.terminator_end)
-          mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;
-      }
-      if (mode.illegal)
-        mode.illegalRe = langRe(mode.illegal);
-      if (mode.relevance == null)
-        mode.relevance = 1;
-      if (!mode.contains) {
-        mode.contains = [];
-      }
-      mode.contains = Array.prototype.concat.apply([], mode.contains.map(function(c) {
-        return expand_mode(c === 'self' ? mode : c)
-      }));
-      mode.contains.forEach(function(c) {compileMode(c, mode);});
-
-      if (mode.starts) {
-        compileMode(mode.starts, parent);
-      }
-
-      var terminators =
-        mode.contains.map(function(c) {
-          return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin;
-        })
-        .concat([mode.terminator_end, mode.illegal])
-        .map(reStr)
-        .filter(Boolean);
-      mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(/*s*/) {return null;}};
-    }
-
-    compileMode(language);
-  }
-
-  /*
-  Core highlighting function. Accepts a language name, or an alias, and a
-  string with the code to highlight. Returns an object with the following
-  properties:
-
-  - relevance (int)
-  - value (an HTML string with highlighting markup)
-
-  */
-  function highlight(name, value, ignore_illegals, continuation) {
-
-    function subMode(lexeme, mode) {
-      var i, length;
-
-      for (i = 0, length = mode.contains.length; i < length; i++) {
-        if (testRe(mode.contains[i].beginRe, lexeme)) {
-          return mode.contains[i];
-        }
-      }
-    }
-
-    function endOfMode(mode, lexeme) {
-      if (testRe(mode.endRe, lexeme)) {
-        while (mode.endsParent && mode.parent) {
-          mode = mode.parent;
-        }
-        return mode;
-      }
-      if (mode.endsWithParent) {
-        return endOfMode(mode.parent, lexeme);
-      }
-    }
-
-    function isIllegal(lexeme, mode) {
-      return !ignore_illegals && testRe(mode.illegalRe, lexeme);
-    }
-
-    function keywordMatch(mode, match) {
-      var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];
-      return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str];
-    }
-
-    function buildSpan(classname, insideSpan, leaveOpen, noPrefix) {
-      var classPrefix = noPrefix ? '' : options.classPrefix,
-          openSpan    = '';
-
-      return openSpan + insideSpan + closeSpan;
-    }
-
-    function processKeywords() {
-      var keyword_match, last_index, match, result;
-
-      if (!top.keywords)
-        return escape(mode_buffer);
-
-      result = '';
-      last_index = 0;
-      top.lexemesRe.lastIndex = 0;
-      match = top.lexemesRe.exec(mode_buffer);
-
-      while (match) {
-        result += escape(mode_buffer.substring(last_index, match.index));
-        keyword_match = keywordMatch(top, match);
-        if (keyword_match) {
-          relevance += keyword_match[1];
-          result += buildSpan(keyword_match[0], escape(match[0]));
-        } else {
-          result += escape(match[0]);
-        }
-        last_index = top.lexemesRe.lastIndex;
-        match = top.lexemesRe.exec(mode_buffer);
-      }
-      return result + escape(mode_buffer.substr(last_index));
-    }
-
-    function processSubLanguage() {
-      var explicit = typeof top.subLanguage === 'string';
-      if (explicit && !languages[top.subLanguage]) {
-        return escape(mode_buffer);
-      }
-
-      var result = explicit ?
-                   highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) :
-                   highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined);
-
-      // Counting embedded language score towards the host language may be disabled
-      // with zeroing the containing mode relevance. Usecase in point is Markdown that
-      // allows XML everywhere and makes every XML snippet to have a much larger Markdown
-      // score.
-      if (top.relevance > 0) {
-        relevance += result.relevance;
-      }
-      if (explicit) {
-        continuations[top.subLanguage] = result.top;
-      }
-      return buildSpan(result.language, result.value, false, true);
-    }
-
-    function processBuffer() {
-      result += (top.subLanguage != null ? processSubLanguage() : processKeywords());
-      mode_buffer = '';
-    }
-
-    function startNewMode(mode) {
-      result += mode.className? buildSpan(mode.className, '', true): '';
-      top = Object.create(mode, {parent: {value: top}});
-    }
-
-    function processLexeme(buffer, lexeme) {
-
-      mode_buffer += buffer;
-
-      if (lexeme == null) {
-        processBuffer();
-        return 0;
-      }
-
-      var new_mode = subMode(lexeme, top);
-      if (new_mode) {
-        if (new_mode.skip) {
-          mode_buffer += lexeme;
-        } else {
-          if (new_mode.excludeBegin) {
-            mode_buffer += lexeme;
-          }
-          processBuffer();
-          if (!new_mode.returnBegin && !new_mode.excludeBegin) {
-            mode_buffer = lexeme;
-          }
-        }
-        startNewMode(new_mode, lexeme);
-        return new_mode.returnBegin ? 0 : lexeme.length;
-      }
-
-      var end_mode = endOfMode(top, lexeme);
-      if (end_mode) {
-        var origin = top;
-        if (origin.skip) {
-          mode_buffer += lexeme;
-        } else {
-          if (!(origin.returnEnd || origin.excludeEnd)) {
-            mode_buffer += lexeme;
-          }
-          processBuffer();
-          if (origin.excludeEnd) {
-            mode_buffer = lexeme;
-          }
-        }
-        do {
-          if (top.className) {
-            result += spanEndTag;
-          }
-          if (!top.skip) {
-            relevance += top.relevance;
-          }
-          top = top.parent;
-        } while (top !== end_mode.parent);
-        if (end_mode.starts) {
-          startNewMode(end_mode.starts, '');
-        }
-        return origin.returnEnd ? 0 : lexeme.length;
-      }
-
-      if (isIllegal(lexeme, top))
-        throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '') + '"');
-
-      /*
-      Parser should not reach this point as all types of lexemes should be caught
-      earlier, but if it does due to some bug make sure it advances at least one
-      character forward to prevent infinite looping.
-      */
-      mode_buffer += lexeme;
-      return lexeme.length || 1;
-    }
-
-    var language = getLanguage(name);
-    if (!language) {
-      throw new Error('Unknown language: "' + name + '"');
-    }
-
-    compileLanguage(language);
-    var top = continuation || language;
-    var continuations = {}; // keep continuations for sub-languages
-    var result = '', current;
-    for(current = top; current !== language; current = current.parent) {
-      if (current.className) {
-        result = buildSpan(current.className, '', true) + result;
-      }
-    }
-    var mode_buffer = '';
-    var relevance = 0;
-    try {
-      var match, count, index = 0;
-      while (true) {
-        top.terminators.lastIndex = index;
-        match = top.terminators.exec(value);
-        if (!match)
-          break;
-        count = processLexeme(value.substring(index, match.index), match[0]);
-        index = match.index + count;
-      }
-      processLexeme(value.substr(index));
-      for(current = top; current.parent; current = current.parent) { // close dangling modes
-        if (current.className) {
-          result += spanEndTag;
-        }
-      }
-      return {
-        relevance: relevance,
-        value: result,
-        language: name,
-        top: top
-      };
-    } catch (e) {
-      if (e.message && e.message.indexOf('Illegal') !== -1) {
-        return {
-          relevance: 0,
-          value: escape(value)
-        };
-      } else {
-        throw e;
-      }
-    }
-  }
-
-  /*
-  Highlighting with language detection. Accepts a string with the code to
-  highlight. Returns an object with the following properties:
-
-  - language (detected language)
-  - relevance (int)
-  - value (an HTML string with highlighting markup)
-  - second_best (object with the same structure for second-best heuristically
-    detected language, may be absent)
-
-  */
-  function highlightAuto(text, languageSubset) {
-    languageSubset = languageSubset || options.languages || objectKeys(languages);
-    var result = {
-      relevance: 0,
-      value: escape(text)
-    };
-    var second_best = result;
-    languageSubset.filter(getLanguage).forEach(function(name) {
-      var current = highlight(name, text, false);
-      current.language = name;
-      if (current.relevance > second_best.relevance) {
-        second_best = current;
-      }
-      if (current.relevance > result.relevance) {
-        second_best = result;
-        result = current;
-      }
-    });
-    if (second_best.language) {
-      result.second_best = second_best;
-    }
-    return result;
-  }
-
-  /*
-  Post-processing of the highlighted markup:
-
-  - replace TABs with something more useful
-  - replace real line-breaks with '
' for non-pre containers - - */ - function fixMarkup(value) { - return !(options.tabReplace || options.useBR) - ? value - : value.replace(fixMarkupRe, function(match, p1) { - if (options.useBR && match === '\n') { - return '
'; - } else if (options.tabReplace) { - return p1.replace(/\t/g, options.tabReplace); - } - return ''; - }); - } - - function buildClassName(prevClassName, currentLang, resultLang) { - var language = currentLang ? aliases[currentLang] : resultLang, - result = [prevClassName.trim()]; - - if (!prevClassName.match(/\bhljs\b/)) { - result.push('hljs'); - } - - if (prevClassName.indexOf(language) === -1) { - result.push(language); - } - - return result.join(' ').trim(); - } - - /* - Applies highlighting to a DOM node containing code. Accepts a DOM node and - two optional parameters for fixMarkup. - */ - function highlightBlock(block) { - var node, originalStream, result, resultNode, text; - var language = blockLanguage(block); - - if (isNotHighlighted(language)) - return; - - if (options.useBR) { - node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); - node.innerHTML = block.innerHTML.replace(/\n/g, '').replace(//g, '\n'); - } else { - node = block; - } - text = node.textContent; - result = language ? highlight(language, text, true) : highlightAuto(text); - - originalStream = nodeStream(node); - if (originalStream.length) { - resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); - resultNode.innerHTML = result.value; - result.value = mergeStreams(originalStream, nodeStream(resultNode), text); - } - result.value = fixMarkup(result.value); - - block.innerHTML = result.value; - block.className = buildClassName(block.className, language, result.language); - block.result = { - language: result.language, - re: result.relevance - }; - if (result.second_best) { - block.second_best = { - language: result.second_best.language, - re: result.second_best.relevance - }; - } - } - - /* - Updates highlight.js global options with values passed in the form of an object. - */ - function configure(user_options) { - options = inherit(options, user_options); - } - - /* - Applies highlighting to all
..
blocks on a page. - */ - function initHighlighting() { - if (initHighlighting.called) - return; - initHighlighting.called = true; - - var blocks = document.querySelectorAll('pre code'); - ArrayProto.forEach.call(blocks, highlightBlock); - } - - /* - Attaches highlighting to the page load event. - */ - function initHighlightingOnLoad() { - addEventListener('DOMContentLoaded', initHighlighting, false); - addEventListener('load', initHighlighting, false); - } - - function registerLanguage(name, language) { - var lang = languages[name] = language(hljs); - if (lang.aliases) { - lang.aliases.forEach(function(alias) {aliases[alias] = name;}); - } - } - - function listLanguages() { - return objectKeys(languages); - } - - function getLanguage(name) { - name = (name || '').toLowerCase(); - return languages[name] || languages[aliases[name]]; - } - - /* Interface definition */ - - hljs.highlight = highlight; - hljs.highlightAuto = highlightAuto; - hljs.fixMarkup = fixMarkup; - hljs.highlightBlock = highlightBlock; - hljs.configure = configure; - hljs.initHighlighting = initHighlighting; - hljs.initHighlightingOnLoad = initHighlightingOnLoad; - hljs.registerLanguage = registerLanguage; - hljs.listLanguages = listLanguages; - hljs.getLanguage = getLanguage; - hljs.inherit = inherit; - - // Common regexps - hljs.IDENT_RE = '[a-zA-Z]\\w*'; - hljs.UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\w*'; - hljs.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; - hljs.C_NUMBER_RE = '(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float - hljs.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... - hljs.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; - - // Common modes - hljs.BACKSLASH_ESCAPE = { - begin: '\\\\[\\s\\S]', relevance: 0 - }; - hljs.APOS_STRING_MODE = { - className: 'string', - begin: '\'', end: '\'', - illegal: '\\n', - contains: [hljs.BACKSLASH_ESCAPE] - }; - hljs.QUOTE_STRING_MODE = { - className: 'string', - begin: '"', end: '"', - illegal: '\\n', - contains: [hljs.BACKSLASH_ESCAPE] - }; - hljs.PHRASAL_WORDS_MODE = { - begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ - }; - hljs.COMMENT = function (begin, end, inherits) { - var mode = hljs.inherit( - { - className: 'comment', - begin: begin, end: end, - contains: [] - }, - inherits || {} - ); - mode.contains.push(hljs.PHRASAL_WORDS_MODE); - mode.contains.push({ - className: 'doctag', - begin: '(?:TODO|FIXME|NOTE|BUG|XXX):', - relevance: 0 - }); - return mode; - }; - hljs.C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$'); - hljs.C_BLOCK_COMMENT_MODE = hljs.COMMENT('/\\*', '\\*/'); - hljs.HASH_COMMENT_MODE = hljs.COMMENT('#', '$'); - hljs.NUMBER_MODE = { - className: 'number', - begin: hljs.NUMBER_RE, - relevance: 0 - }; - hljs.C_NUMBER_MODE = { - className: 'number', - begin: hljs.C_NUMBER_RE, - relevance: 0 - }; - hljs.BINARY_NUMBER_MODE = { - className: 'number', - begin: hljs.BINARY_NUMBER_RE, - relevance: 0 - }; - hljs.CSS_NUMBER_MODE = { - className: 'number', - begin: hljs.NUMBER_RE + '(' + - '%|em|ex|ch|rem' + - '|vw|vh|vmin|vmax' + - '|cm|mm|in|pt|pc|px' + - '|deg|grad|rad|turn' + - '|s|ms' + - '|Hz|kHz' + - '|dpi|dpcm|dppx' + - ')?', - relevance: 0 - }; - hljs.REGEXP_MODE = { - className: 'regexp', - begin: /\//, end: /\/[gimuy]*/, - illegal: /\n/, - contains: [ - hljs.BACKSLASH_ESCAPE, - { - begin: /\[/, end: /\]/, - relevance: 0, - contains: [hljs.BACKSLASH_ESCAPE] - } - ] - }; - hljs.TITLE_MODE = { - className: 'title', - begin: hljs.IDENT_RE, - relevance: 0 - }; - hljs.UNDERSCORE_TITLE_MODE = { - className: 'title', - begin: hljs.UNDERSCORE_IDENT_RE, - relevance: 0 - }; - hljs.METHOD_GUARD = { - // excludes method names from keyword processing - begin: '\\.\\s*' + hljs.UNDERSCORE_IDENT_RE, - relevance: 0 - }; - -hljs.registerLanguage('apache', function(hljs) { - var NUMBER = {className: 'number', begin: '[\\$%]\\d+'}; - return { - aliases: ['apacheconf'], - case_insensitive: true, - contains: [ - hljs.HASH_COMMENT_MODE, - {className: 'section', begin: ''}, - { - className: 'attribute', - begin: /\w+/, - relevance: 0, - // keywords aren’t needed for highlighting per se, they only boost relevance - // for a very generally defined mode (starts with a word, ends with line-end - keywords: { - nomarkup: - 'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' + - 'sethandler errordocument loadmodule options header listen serverroot ' + - 'servername' - }, - starts: { - end: /$/, - relevance: 0, - keywords: { - literal: 'on off all' - }, - contains: [ - { - className: 'meta', - begin: '\\s\\[', end: '\\]$' - }, - { - className: 'variable', - begin: '[\\$%]\\{', end: '\\}', - contains: ['self', NUMBER] - }, - NUMBER, - hljs.QUOTE_STRING_MODE - ] - } - } - ], - illegal: /\S/ - }; -}); - -hljs.registerLanguage('bash', function(hljs) { - var VAR = { - className: 'variable', - variants: [ - {begin: /\$[\w\d#@][\w\d_]*/}, - {begin: /\$\{(.*?)}/} - ] - }; - var QUOTE_STRING = { - className: 'string', - begin: /"/, end: /"/, - contains: [ - hljs.BACKSLASH_ESCAPE, - VAR, - { - className: 'variable', - begin: /\$\(/, end: /\)/, - contains: [hljs.BACKSLASH_ESCAPE] - } - ] - }; - var APOS_STRING = { - className: 'string', - begin: /'/, end: /'/ - }; - - return { - aliases: ['sh', 'zsh'], - lexemes: /\b-?[a-z\._]+\b/, - keywords: { - keyword: - 'if then else elif fi for while in do done case esac function', - literal: - 'true false', - built_in: - // Shell built-ins - // http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html - 'break cd continue eval exec exit export getopts hash pwd readonly return shift test times ' + - 'trap umask unset ' + - // Bash built-ins - 'alias bind builtin caller command declare echo enable help let local logout mapfile printf ' + - 'read readarray source type typeset ulimit unalias ' + - // Shell modifiers - 'set shopt ' + - // Zsh built-ins - 'autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles ' + - 'compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate ' + - 'fc fg float functions getcap getln history integer jobs kill limit log noglob popd print ' + - 'pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit ' + - 'unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof ' + - 'zpty zregexparse zsocket zstyle ztcp', - _: - '-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster - }, - contains: [ - { - className: 'meta', - begin: /^#![^\n]+sh\s*$/, - relevance: 10 - }, - { - className: 'function', - begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, - returnBegin: true, - contains: [hljs.inherit(hljs.TITLE_MODE, {begin: /\w[\w\d_]*/})], - relevance: 0 - }, - hljs.HASH_COMMENT_MODE, - QUOTE_STRING, - APOS_STRING, - VAR - ] - }; -}); - -hljs.registerLanguage('coffeescript', function(hljs) { - var KEYWORDS = { - keyword: - // JS keywords - 'in if for while finally new do return else break catch instanceof throw try this ' + - 'switch continue typeof delete debugger super yield import export from as default await ' + - // Coffee keywords - 'then unless until loop of by when and or is isnt not', - literal: - // JS literals - 'true false null undefined ' + - // Coffee literals - 'yes no on off', - built_in: - 'npm require console print module global window document' - }; - var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; - var SUBST = { - className: 'subst', - begin: /#\{/, end: /}/, - keywords: KEYWORDS - }; - var EXPRESSIONS = [ - hljs.BINARY_NUMBER_MODE, - hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end: '(\\s*/)?', relevance: 0}}), // a number tries to eat the following slash to prevent treating it as a regexp - { - className: 'string', - variants: [ - { - begin: /'''/, end: /'''/, - contains: [hljs.BACKSLASH_ESCAPE] - }, - { - begin: /'/, end: /'/, - contains: [hljs.BACKSLASH_ESCAPE] - }, - { - begin: /"""/, end: /"""/, - contains: [hljs.BACKSLASH_ESCAPE, SUBST] - }, - { - begin: /"/, end: /"/, - contains: [hljs.BACKSLASH_ESCAPE, SUBST] - } - ] - }, - { - className: 'regexp', - variants: [ - { - begin: '///', end: '///', - contains: [SUBST, hljs.HASH_COMMENT_MODE] - }, - { - begin: '//[gim]*', - relevance: 0 - }, - { - // regex can't start with space to parse x / 2 / 3 as two divisions - // regex can't start with *, and it supports an "illegal" in the main mode - begin: /\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/ - } - ] - }, - { - begin: '@' + JS_IDENT_RE // relevance booster - }, - { - subLanguage: 'javascript', - excludeBegin: true, excludeEnd: true, - variants: [ - { - begin: '```', end: '```', - }, - { - begin: '`', end: '`', - } - ] - } - ]; - SUBST.contains = EXPRESSIONS; - - var TITLE = hljs.inherit(hljs.TITLE_MODE, {begin: JS_IDENT_RE}); - var PARAMS_RE = '(\\(.*\\))?\\s*\\B[-=]>'; - var PARAMS = { - className: 'params', - begin: '\\([^\\(]', returnBegin: true, - /* We need another contained nameless mode to not have every nested - pair of parens to be called "params" */ - contains: [{ - begin: /\(/, end: /\)/, - keywords: KEYWORDS, - contains: ['self'].concat(EXPRESSIONS) - }] - }; - - return { - aliases: ['coffee', 'cson', 'iced'], - keywords: KEYWORDS, - illegal: /\/\*/, - contains: EXPRESSIONS.concat([ - hljs.COMMENT('###', '###'), - hljs.HASH_COMMENT_MODE, - { - className: 'function', - begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, end: '[-=]>', - returnBegin: true, - contains: [TITLE, PARAMS] - }, - { - // anonymous function start - begin: /[:\(,=]\s*/, - relevance: 0, - contains: [ - { - className: 'function', - begin: PARAMS_RE, end: '[-=]>', - returnBegin: true, - contains: [PARAMS] - } - ] - }, - { - className: 'class', - beginKeywords: 'class', - end: '$', - illegal: /[:="\[\]]/, - contains: [ - { - beginKeywords: 'extends', - endsWithParent: true, - illegal: /[:="\[\]]/, - contains: [TITLE] - }, - TITLE - ] - }, - { - begin: JS_IDENT_RE + ':', end: ':', - returnBegin: true, returnEnd: true, - relevance: 0 - } - ]) - }; -}); - -hljs.registerLanguage('cpp', function(hljs) { - var CPP_PRIMITIVE_TYPES = { - className: 'keyword', - begin: '\\b[a-z\\d_]*_t\\b' - }; - - var STRINGS = { - className: 'string', - variants: [ - { - begin: '(u8?|U)?L?"', end: '"', - illegal: '\\n', - contains: [hljs.BACKSLASH_ESCAPE] - }, - { - begin: '(u8?|U)?R"', end: '"', - contains: [hljs.BACKSLASH_ESCAPE] - }, - { - begin: '\'\\\\?.', end: '\'', - illegal: '.' - } - ] - }; - - var NUMBERS = { - className: 'number', - variants: [ - { begin: '\\b(0b[01\']+)' }, - { begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' }, - { begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' } - ], - relevance: 0 - }; - - var PREPROCESSOR = { - className: 'meta', - begin: /#\s*[a-z]+\b/, end: /$/, - keywords: { - 'meta-keyword': - 'if else elif endif define undef warning error line ' + - 'pragma ifdef ifndef include' - }, - contains: [ - { - begin: /\\\n/, relevance: 0 - }, - hljs.inherit(STRINGS, {className: 'meta-string'}), - { - className: 'meta-string', - begin: /<[^\n>]*>/, end: /$/, - illegal: '\\n', - }, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }; - - var FUNCTION_TITLE = hljs.IDENT_RE + '\\s*\\('; - - var CPP_KEYWORDS = { - keyword: 'int float while private char catch import module export virtual operator sizeof ' + - 'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' + - 'unsigned long volatile static protected bool template mutable if public friend ' + - 'do goto auto void enum else break extern using asm case typeid ' + - 'short reinterpret_cast|10 default double register explicit signed typename try this ' + - 'switch continue inline delete alignof constexpr decltype ' + - 'noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary ' + - 'atomic_bool atomic_char atomic_schar ' + - 'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' + - 'atomic_ullong new throw return ' + - 'and or not', - built_in: 'std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' + - 'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' + - 'unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos ' + - 'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' + - 'fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' + - 'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' + - 'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' + - 'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' + - 'vfprintf vprintf vsprintf endl initializer_list unique_ptr', - literal: 'true false nullptr NULL' - }; - - var EXPRESSION_CONTAINS = [ - CPP_PRIMITIVE_TYPES, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - NUMBERS, - STRINGS - ]; - - return { - aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp'], - keywords: CPP_KEYWORDS, - illegal: '', - keywords: CPP_KEYWORDS, - contains: ['self', CPP_PRIMITIVE_TYPES] - }, - { - begin: hljs.IDENT_RE + '::', - keywords: CPP_KEYWORDS - }, - { - // This mode covers expression context where we can't expect a function - // definition and shouldn't highlight anything that looks like one: - // `return some()`, `else if()`, `(x*sum(1, 2))` - variants: [ - {begin: /=/, end: /;/}, - {begin: /\(/, end: /\)/}, - {beginKeywords: 'new throw return else', end: /;/} - ], - keywords: CPP_KEYWORDS, - contains: EXPRESSION_CONTAINS.concat([ - { - begin: /\(/, end: /\)/, - keywords: CPP_KEYWORDS, - contains: EXPRESSION_CONTAINS.concat(['self']), - relevance: 0 - } - ]), - relevance: 0 - }, - { - className: 'function', - begin: '(' + hljs.IDENT_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE, - returnBegin: true, end: /[{;=]/, - excludeEnd: true, - keywords: CPP_KEYWORDS, - illegal: /[^\w\s\*&]/, - contains: [ - { - begin: FUNCTION_TITLE, returnBegin: true, - contains: [hljs.TITLE_MODE], - relevance: 0 - }, - { - className: 'params', - begin: /\(/, end: /\)/, - keywords: CPP_KEYWORDS, - relevance: 0, - contains: [ - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - STRINGS, - NUMBERS, - CPP_PRIMITIVE_TYPES - ] - }, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - PREPROCESSOR - ] - }, - { - className: 'class', - beginKeywords: 'class struct', end: /[{;:]/, - contains: [ - {begin: //, contains: ['self']}, // skip generic stuff - hljs.TITLE_MODE - ] - } - ]), - exports: { - preprocessor: PREPROCESSOR, - strings: STRINGS, - keywords: CPP_KEYWORDS - } - }; -}); - -hljs.registerLanguage('cs', function(hljs) { - var KEYWORDS = { - keyword: - // Normal keywords. - 'abstract as base bool break byte case catch char checked const continue decimal ' + - 'default delegate do double else enum event explicit extern finally fixed float ' + - 'for foreach goto if implicit in int interface internal is lock long ' + - 'object operator out override params private protected public readonly ref sbyte ' + - 'sealed short sizeof stackalloc static string struct switch this try typeof ' + - 'uint ulong unchecked unsafe ushort using virtual void volatile while ' + - 'nameof ' + - // Contextual keywords. - 'add alias ascending async await by descending dynamic equals from get global group into join ' + - 'let on orderby partial remove select set value var where yield', - literal: - 'null false true' - }; - - var VERBATIM_STRING = { - className: 'string', - begin: '@"', end: '"', - contains: [{begin: '""'}] - }; - var VERBATIM_STRING_NO_LF = hljs.inherit(VERBATIM_STRING, {illegal: /\n/}); - var SUBST = { - className: 'subst', - begin: '{', end: '}', - keywords: KEYWORDS - }; - var SUBST_NO_LF = hljs.inherit(SUBST, {illegal: /\n/}); - var INTERPOLATED_STRING = { - className: 'string', - begin: /\$"/, end: '"', - illegal: /\n/, - contains: [{begin: '{{'}, {begin: '}}'}, hljs.BACKSLASH_ESCAPE, SUBST_NO_LF] - }; - var INTERPOLATED_VERBATIM_STRING = { - className: 'string', - begin: /\$@"/, end: '"', - contains: [{begin: '{{'}, {begin: '}}'}, {begin: '""'}, SUBST] - }; - var INTERPOLATED_VERBATIM_STRING_NO_LF = hljs.inherit(INTERPOLATED_VERBATIM_STRING, { - illegal: /\n/, - contains: [{begin: '{{'}, {begin: '}}'}, {begin: '""'}, SUBST_NO_LF] - }); - SUBST.contains = [ - INTERPOLATED_VERBATIM_STRING, - INTERPOLATED_STRING, - VERBATIM_STRING, - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - hljs.C_NUMBER_MODE, - hljs.C_BLOCK_COMMENT_MODE - ]; - SUBST_NO_LF.contains = [ - INTERPOLATED_VERBATIM_STRING_NO_LF, - INTERPOLATED_STRING, - VERBATIM_STRING_NO_LF, - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - hljs.C_NUMBER_MODE, - hljs.inherit(hljs.C_BLOCK_COMMENT_MODE, {illegal: /\n/}) - ]; - var STRING = { - variants: [ - INTERPOLATED_VERBATIM_STRING, - INTERPOLATED_STRING, - VERBATIM_STRING, - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE - ] - }; - - var TYPE_IDENT_RE = hljs.IDENT_RE + '(<' + hljs.IDENT_RE + '(\\s*,\\s*' + hljs.IDENT_RE + ')*>)?(\\[\\])?'; - return { - aliases: ['csharp'], - keywords: KEYWORDS, - illegal: /::/, - contains: [ - hljs.COMMENT( - '///', - '$', - { - returnBegin: true, - contains: [ - { - className: 'doctag', - variants: [ - { - begin: '///', relevance: 0 - }, - { - begin: '' - }, - { - begin: '' - } - ] - } - ] - } - ), - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - { - className: 'meta', - begin: '#', end: '$', - keywords: {'meta-keyword': 'if else elif endif define undef warning error line region endregion pragma checksum'} - }, - STRING, - hljs.C_NUMBER_MODE, - { - beginKeywords: 'class interface', end: /[{;=]/, - illegal: /[^\s:]/, - contains: [ - hljs.TITLE_MODE, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }, - { - beginKeywords: 'namespace', end: /[{;=]/, - illegal: /[^\s:]/, - contains: [ - hljs.inherit(hljs.TITLE_MODE, {begin: '[a-zA-Z](\\.?\\w)*'}), - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }, - { - // Expression keywords prevent 'keyword Name(...)' from being - // recognized as a function definition - beginKeywords: 'new return throw await', - relevance: 0 - }, - { - className: 'function', - begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*\\(', returnBegin: true, end: /[{;=]/, - excludeEnd: true, - keywords: KEYWORDS, - contains: [ - { - begin: hljs.IDENT_RE + '\\s*\\(', returnBegin: true, - contains: [hljs.TITLE_MODE], - relevance: 0 - }, - { - className: 'params', - begin: /\(/, end: /\)/, - excludeBegin: true, - excludeEnd: true, - keywords: KEYWORDS, - relevance: 0, - contains: [ - STRING, - hljs.C_NUMBER_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - } - ] - }; -}); - -hljs.registerLanguage('css', function(hljs) { - var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*'; - var RULE = { - begin: /[A-Z\_\.\-]+\s*:/, returnBegin: true, end: ';', endsWithParent: true, - contains: [ - { - className: 'attribute', - begin: /\S/, end: ':', excludeEnd: true, - starts: { - endsWithParent: true, excludeEnd: true, - contains: [ - { - begin: /[\w-]+\(/, returnBegin: true, - contains: [ - { - className: 'built_in', - begin: /[\w-]+/ - }, - { - begin: /\(/, end: /\)/, - contains: [ - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE - ] - } - ] - }, - hljs.CSS_NUMBER_MODE, - hljs.QUOTE_STRING_MODE, - hljs.APOS_STRING_MODE, - hljs.C_BLOCK_COMMENT_MODE, - { - className: 'number', begin: '#[0-9A-Fa-f]+' - }, - { - className: 'meta', begin: '!important' - } - ] - } - } - ] - }; - - return { - case_insensitive: true, - illegal: /[=\/|'\$]/, - contains: [ - hljs.C_BLOCK_COMMENT_MODE, - { - className: 'selector-id', begin: /#[A-Za-z0-9_-]+/ - }, - { - className: 'selector-class', begin: /\.[A-Za-z0-9_-]+/ - }, - { - className: 'selector-attr', - begin: /\[/, end: /\]/, - illegal: '$' - }, - { - className: 'selector-pseudo', - begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/ - }, - { - begin: '@(font-face|page)', - lexemes: '[a-z-]+', - keywords: 'font-face page' - }, - { - begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing - // because it doesn’t let it to be parsed as - // a rule set but instead drops parser into - // the default mode which is how it should be. - illegal: /:/, // break on Less variables @var: ... - contains: [ - { - className: 'keyword', - begin: /\w+/ - }, - { - begin: /\s/, endsWithParent: true, excludeEnd: true, - relevance: 0, - contains: [ - hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, - hljs.CSS_NUMBER_MODE - ] - } - ] - }, - { - className: 'selector-tag', begin: IDENT_RE, - relevance: 0 - }, - { - begin: '{', end: '}', - illegal: /\S/, - contains: [ - hljs.C_BLOCK_COMMENT_MODE, - RULE, - ] - } - ] - }; -}); - -hljs.registerLanguage('diff', function(hljs) { - return { - aliases: ['patch'], - contains: [ - { - className: 'meta', - relevance: 10, - variants: [ - {begin: /^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/}, - {begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/}, - {begin: /^\-\-\- +\d+,\d+ +\-\-\-\-$/} - ] - }, - { - className: 'comment', - variants: [ - {begin: /Index: /, end: /$/}, - {begin: /={3,}/, end: /$/}, - {begin: /^\-{3}/, end: /$/}, - {begin: /^\*{3} /, end: /$/}, - {begin: /^\+{3}/, end: /$/}, - {begin: /\*{5}/, end: /\*{5}$/} - ] - }, - { - className: 'addition', - begin: '^\\+', end: '$' - }, - { - className: 'deletion', - begin: '^\\-', end: '$' - }, - { - className: 'addition', - begin: '^\\!', end: '$' - } - ] - }; -}); - -hljs.registerLanguage('http', function(hljs) { - var VERSION = 'HTTP/[0-9\\.]+'; - return { - aliases: ['https'], - illegal: '\\S', - contains: [ - { - begin: '^' + VERSION, end: '$', - contains: [{className: 'number', begin: '\\b\\d{3}\\b'}] - }, - { - begin: '^[A-Z]+ (.*?) ' + VERSION + '$', returnBegin: true, end: '$', - contains: [ - { - className: 'string', - begin: ' ', end: ' ', - excludeBegin: true, excludeEnd: true - }, - { - begin: VERSION - }, - { - className: 'keyword', - begin: '[A-Z]+' - } - ] - }, - { - className: 'attribute', - begin: '^\\w', end: ': ', excludeEnd: true, - illegal: '\\n|\\s|=', - starts: {end: '$', relevance: 0} - }, - { - begin: '\\n\\n', - starts: {subLanguage: [], endsWithParent: true} - } - ] - }; -}); - -hljs.registerLanguage('ini', function(hljs) { - var STRING = { - className: "string", - contains: [hljs.BACKSLASH_ESCAPE], - variants: [ - { - begin: "'''", end: "'''", - relevance: 10 - }, { - begin: '"""', end: '"""', - relevance: 10 - }, { - begin: '"', end: '"' - }, { - begin: "'", end: "'" - } - ] - }; - return { - aliases: ['toml'], - case_insensitive: true, - illegal: /\S/, - contains: [ - hljs.COMMENT(';', '$'), - hljs.HASH_COMMENT_MODE, - { - className: 'section', - begin: /^\s*\[+/, end: /\]+/ - }, - { - begin: /^[a-z0-9\[\]_-]+\s*=\s*/, end: '$', - returnBegin: true, - contains: [ - { - className: 'attr', - begin: /[a-z0-9\[\]_-]+/ - }, - { - begin: /=/, endsWithParent: true, - relevance: 0, - contains: [ - { - className: 'literal', - begin: /\bon|off|true|false|yes|no\b/ - }, - { - className: 'variable', - variants: [ - {begin: /\$[\w\d"][\w\d_]*/}, - {begin: /\$\{(.*?)}/} - ] - }, - STRING, - { - className: 'number', - begin: /([\+\-]+)?[\d]+_[\d_]+/ - }, - hljs.NUMBER_MODE - ] - } - ] - } - ] - }; -}); - -hljs.registerLanguage('java', function(hljs) { - var JAVA_IDENT_RE = '[\u00C0-\u02B8a-zA-Z_$][\u00C0-\u02B8a-zA-Z_$0-9]*'; - var GENERIC_IDENT_RE = JAVA_IDENT_RE + '(<' + JAVA_IDENT_RE + '(\\s*,\\s*' + JAVA_IDENT_RE + ')*>)?'; - var KEYWORDS = - 'false synchronized int abstract float private char boolean static null if const ' + - 'for true while long strictfp finally protected import native final void ' + - 'enum else break transient catch instanceof byte super volatile case assert short ' + - 'package default double public try this switch continue throws protected public private ' + - 'module requires exports do'; - - // https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html - var JAVA_NUMBER_RE = '\\b' + - '(' + - '0[bB]([01]+[01_]+[01]+|[01]+)' + // 0b... - '|' + - '0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)' + // 0x... - '|' + - '(' + - '([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?' + - '|' + - '\\.([\\d]+[\\d_]+[\\d]+|[\\d]+)' + - ')' + - '([eE][-+]?\\d+)?' + // octal, decimal, float - ')' + - '[lLfF]?'; - var JAVA_NUMBER_MODE = { - className: 'number', - begin: JAVA_NUMBER_RE, - relevance: 0 - }; - - return { - aliases: ['jsp'], - keywords: KEYWORDS, - illegal: /<\/|#/, - contains: [ - hljs.COMMENT( - '/\\*\\*', - '\\*/', - { - relevance : 0, - contains : [ - { - // eat up @'s in emails to prevent them to be recognized as doctags - begin: /\w+@/, relevance: 0 - }, - { - className : 'doctag', - begin : '@[A-Za-z]+' - } - ] - } - ), - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - { - className: 'class', - beginKeywords: 'class interface', end: /[{;=]/, excludeEnd: true, - keywords: 'class interface', - illegal: /[:"\[\]]/, - contains: [ - {beginKeywords: 'extends implements'}, - hljs.UNDERSCORE_TITLE_MODE - ] - }, - { - // Expression keywords prevent 'keyword Name(...)' from being - // recognized as a function definition - beginKeywords: 'new throw return else', - relevance: 0 - }, - { - className: 'function', - begin: '(' + GENERIC_IDENT_RE + '\\s+)+' + hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true, end: /[{;=]/, - excludeEnd: true, - keywords: KEYWORDS, - contains: [ - { - begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true, - relevance: 0, - contains: [hljs.UNDERSCORE_TITLE_MODE] - }, - { - className: 'params', - begin: /\(/, end: /\)/, - keywords: KEYWORDS, - relevance: 0, - contains: [ - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - hljs.C_NUMBER_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE - ] - }, - JAVA_NUMBER_MODE, - { - className: 'meta', begin: '@[A-Za-z]+' - } - ] - }; -}); - -hljs.registerLanguage('javascript', function(hljs) { - var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; - var KEYWORDS = { - keyword: - 'in of if for while finally var new function do return void else break catch ' + - 'instanceof with throw case default try this switch continue typeof delete ' + - 'let yield const export super debugger as async await static ' + - // ECMAScript 6 modules import - 'import from as' - , - literal: - 'true false null undefined NaN Infinity', - built_in: - 'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' + - 'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' + - 'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' + - 'TypeError URIError Number Math Date String RegExp Array Float32Array ' + - 'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' + - 'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' + - 'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' + - 'Promise' - }; - var EXPRESSIONS; - var NUMBER = { - className: 'number', - variants: [ - { begin: '\\b(0[bB][01]+)' }, - { begin: '\\b(0[oO][0-7]+)' }, - { begin: hljs.C_NUMBER_RE } - ], - relevance: 0 - }; - var SUBST = { - className: 'subst', - begin: '\\$\\{', end: '\\}', - keywords: KEYWORDS, - contains: [] // defined later - }; - var TEMPLATE_STRING = { - className: 'string', - begin: '`', end: '`', - contains: [ - hljs.BACKSLASH_ESCAPE, - SUBST - ] - }; - SUBST.contains = [ - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - TEMPLATE_STRING, - NUMBER, - hljs.REGEXP_MODE - ] - var PARAMS_CONTAINS = SUBST.contains.concat([ - hljs.C_BLOCK_COMMENT_MODE, - hljs.C_LINE_COMMENT_MODE - ]); - - return { - aliases: ['js', 'jsx'], - keywords: KEYWORDS, - contains: [ - { - className: 'meta', - relevance: 10, - begin: /^\s*['"]use (strict|asm)['"]/ - }, - { - className: 'meta', - begin: /^#!/, end: /$/ - }, - hljs.APOS_STRING_MODE, - hljs.QUOTE_STRING_MODE, - TEMPLATE_STRING, - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - NUMBER, - { // object attr container - begin: /[{,]\s*/, relevance: 0, - contains: [ - { - begin: IDENT_RE + '\\s*:', returnBegin: true, - relevance: 0, - contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}] - } - ] - }, - { // "value" container - begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*', - keywords: 'return throw case', - contains: [ - hljs.C_LINE_COMMENT_MODE, - hljs.C_BLOCK_COMMENT_MODE, - hljs.REGEXP_MODE, - { - className: 'function', - begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>', returnBegin: true, - end: '\\s*=>', - contains: [ - { - className: 'params', - variants: [ - { - begin: IDENT_RE - }, - { - begin: /\(\s*\)/, - }, - { - begin: /\(/, end: /\)/, - excludeBegin: true, excludeEnd: true, - keywords: KEYWORDS, - contains: PARAMS_CONTAINS - } - ] - } - ] - }, - { // E4X / JSX - begin: //, - subLanguage: 'xml', - contains: [ - {begin: /<\w+\s*\/>/, skip: true}, - { - begin: /<\w+/, end: /(\/\w+|\w+\/)>/, skip: true, - contains: [ - {begin: /<\w+\s*\/>/, skip: true}, - 'self' - ] - } - ] - } - ], - relevance: 0 - }, - { - className: 'function', - beginKeywords: 'function', end: /\{/, excludeEnd: true, - contains: [ - hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}), - { - className: 'params', - begin: /\(/, end: /\)/, - excludeBegin: true, - excludeEnd: true, - contains: PARAMS_CONTAINS - } - ], - illegal: /\[|%/ - }, - { - begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something` - }, - hljs.METHOD_GUARD, - { // ES6 class - className: 'class', - beginKeywords: 'class', end: /[{;=]/, excludeEnd: true, - illegal: /[:"\[\]]/, - contains: [ - {beginKeywords: 'extends'}, - hljs.UNDERSCORE_TITLE_MODE - ] - }, - { - beginKeywords: 'constructor', end: /\{/, excludeEnd: true - } - ], - illegal: /#(?!!)/ - }; -}); - -hljs.registerLanguage('json', function(hljs) { - var LITERALS = {literal: 'true false null'}; - var TYPES = [ - hljs.QUOTE_STRING_MODE, - hljs.C_NUMBER_MODE - ]; - var VALUE_CONTAINER = { - end: ',', endsWithParent: true, excludeEnd: true, - contains: TYPES, - keywords: LITERALS - }; - var OBJECT = { - begin: '{', end: '}', - contains: [ - { - className: 'attr', - begin: /"/, end: /"/, - contains: [hljs.BACKSLASH_ESCAPE], - illegal: '\\n', - }, - hljs.inherit(VALUE_CONTAINER, {begin: /:/}) - ], - illegal: '\\S' - }; - var ARRAY = { - begin: '\\[', end: '\\]', - contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents - illegal: '\\S' - }; - TYPES.splice(TYPES.length, 0, OBJECT, ARRAY); - return { - contains: TYPES, - keywords: LITERALS, - illegal: '\\S' - }; -}); - -hljs.registerLanguage('julia', function(hljs) { - // Since there are numerous special names in Julia, it is too much trouble - // to maintain them by hand. Hence these names (i.e. keywords, literals and - // built-ins) are automatically generated from Julia v0.6 itself through - // the following scripts for each. - - var KEYWORDS = { - // # keyword generator, multi-word keywords handled manually below - // foreach(println, ["in", "isa", "where"]) - // for kw in Base.REPLCompletions.complete_keyword("") - // if !(contains(kw, " ") || kw == "struct") - // println(kw) - // end - // end - keyword: - 'in isa where ' + - 'baremodule begin break catch ccall const continue do else elseif end export false finally for function ' + - 'global if import importall let local macro module quote return true try using while ' + - // legacy, to be deprecated in the next release - 'type immutable abstract bitstype typealias ', - - // # literal generator - // println("true") - // println("false") - // for name in Base.REPLCompletions.completions("", 0)[1] - // try - // v = eval(Symbol(name)) - // if !(v isa Function || v isa Type || v isa TypeVar || v isa Module || v isa Colon) - // println(name) - // end - // end - // end - literal: - 'true false ' + - 'ARGS C_NULL DevNull ENDIAN_BOM ENV I Inf Inf16 Inf32 Inf64 InsertionSort JULIA_HOME LOAD_PATH MergeSort ' + - 'NaN NaN16 NaN32 NaN64 PROGRAM_FILE QuickSort RoundDown RoundFromZero RoundNearest RoundNearestTiesAway ' + - 'RoundNearestTiesUp RoundToZero RoundUp STDERR STDIN STDOUT VERSION catalan e|0 eu|0 eulergamma golden im ' + - 'nothing pi γ π φ ', - - // # built_in generator: - // for name in Base.REPLCompletions.completions("", 0)[1] - // try - // v = eval(Symbol(name)) - // if v isa Type || v isa TypeVar - // println(name) - // end - // end - // end - built_in: - 'ANY AbstractArray AbstractChannel AbstractFloat AbstractMatrix AbstractRNG AbstractSerializer AbstractSet ' + - 'AbstractSparseArray AbstractSparseMatrix AbstractSparseVector AbstractString AbstractUnitRange AbstractVecOrMat ' + - 'AbstractVector Any ArgumentError Array AssertionError Associative Base64DecodePipe Base64EncodePipe Bidiagonal '+ - 'BigFloat BigInt BitArray BitMatrix BitVector Bool BoundsError BufferStream CachingPool CapturedException ' + - 'CartesianIndex CartesianRange Cchar Cdouble Cfloat Channel Char Cint Cintmax_t Clong Clonglong ClusterManager ' + - 'Cmd CodeInfo Colon Complex Complex128 Complex32 Complex64 CompositeException Condition ConjArray ConjMatrix ' + - 'ConjVector Cptrdiff_t Cshort Csize_t Cssize_t Cstring Cuchar Cuint Cuintmax_t Culong Culonglong Cushort Cwchar_t ' + - 'Cwstring DataType Date DateFormat DateTime DenseArray DenseMatrix DenseVecOrMat DenseVector Diagonal Dict ' + - 'DimensionMismatch Dims DirectIndexString Display DivideError DomainError EOFError EachLine Enum Enumerate ' + - 'ErrorException Exception ExponentialBackOff Expr Factorization FileMonitor Float16 Float32 Float64 Function ' + - 'Future GlobalRef GotoNode HTML Hermitian IO IOBuffer IOContext IOStream IPAddr IPv4 IPv6 IndexCartesian IndexLinear ' + - 'IndexStyle InexactError InitError Int Int128 Int16 Int32 Int64 Int8 IntSet Integer InterruptException ' + - 'InvalidStateException Irrational KeyError LabelNode LinSpace LineNumberNode LoadError LowerTriangular MIME Matrix ' + - 'MersenneTwister Method MethodError MethodTable Module NTuple NewvarNode NullException Nullable Number ObjectIdDict ' + - 'OrdinalRange OutOfMemoryError OverflowError Pair ParseError PartialQuickSort PermutedDimsArray Pipe ' + - 'PollingFileWatcher ProcessExitedException Ptr QuoteNode RandomDevice Range RangeIndex Rational RawFD ' + - 'ReadOnlyMemoryError Real ReentrantLock Ref Regex RegexMatch RemoteChannel RemoteException RevString RoundingMode ' + - 'RowVector SSAValue SegmentationFault SerializationState Set SharedArray SharedMatrix SharedVector Signed ' + - 'SimpleVector Slot SlotNumber SparseMatrixCSC SparseVector StackFrame StackOverflowError StackTrace StepRange ' + - 'StepRangeLen StridedArray StridedMatrix StridedVecOrMat StridedVector String SubArray SubString SymTridiagonal ' + - 'Symbol Symmetric SystemError TCPSocket Task Text TextDisplay Timer Tridiagonal Tuple Type TypeError TypeMapEntry ' + - 'TypeMapLevel TypeName TypeVar TypedSlot UDPSocket UInt UInt128 UInt16 UInt32 UInt64 UInt8 UndefRefError UndefVarError ' + - 'UnicodeError UniformScaling Union UnionAll UnitRange Unsigned UpperTriangular Val Vararg VecElement VecOrMat Vector ' + - 'VersionNumber Void WeakKeyDict WeakRef WorkerConfig WorkerPool ' - }; - - // ref: http://julia.readthedocs.org/en/latest/manual/variables/#allowed-variable-names - var VARIABLE_NAME_RE = '[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*'; - - // placeholder for recursive self-reference - var DEFAULT = { - lexemes: VARIABLE_NAME_RE, keywords: KEYWORDS, illegal: /<\// - }; - - // ref: http://julia.readthedocs.org/en/latest/manual/integers-and-floating-point-numbers/ - var NUMBER = { - className: 'number', - // supported numeric literals: - // * binary literal (e.g. 0x10) - // * octal literal (e.g. 0o76543210) - // * hexadecimal literal (e.g. 0xfedcba876543210) - // * hexadecimal floating point literal (e.g. 0x1p0, 0x1.2p2) - // * decimal literal (e.g. 9876543210, 100_000_000) - // * floating pointe literal (e.g. 1.2, 1.2f, .2, 1., 1.2e10, 1.2e-10) - begin: /(\b0x[\d_]*(\.[\d_]*)?|0x\.\d[\d_]*)p[-+]?\d+|\b0[box][a-fA-F0-9][a-fA-F0-9_]*|(\b\d[\d_]*(\.[\d_]*)?|\.\d[\d_]*)([eEfF][-+]?\d+)?/, - relevance: 0 - }; - - var CHAR = { - className: 'string', - begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/ - }; - - var INTERPOLATION = { - className: 'subst', - begin: /\$\(/, end: /\)/, - keywords: KEYWORDS - }; - - var INTERPOLATED_VARIABLE = { - className: 'variable', - begin: '\\$' + VARIABLE_NAME_RE - }; - - // TODO: neatly escape normal code in string literal - var STRING = { - className: 'string', - contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION, INTERPOLATED_VARIABLE], - variants: [ - { begin: /\w*"""/, end: /"""\w*/, relevance: 10 }, - { begin: /\w*"/, end: /"\w*/ } - ] - }; - - var COMMAND = { - className: 'string', - contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION, INTERPOLATED_VARIABLE], - begin: '`', end: '`' - }; - - var MACROCALL = { - className: 'meta', - begin: '@' + VARIABLE_NAME_RE - }; - - var COMMENT = { - className: 'comment', - variants: [ - { begin: '#=', end: '=#', relevance: 10 }, - { begin: '#', end: '$' } - ] - }; - - DEFAULT.contains = [ - NUMBER, - CHAR, - STRING, - COMMAND, - MACROCALL, - COMMENT, - hljs.HASH_COMMENT_MODE, - { - className: 'keyword', - begin: - '\\b(((abstract|primitive)\\s+)type|(mutable\\s+)?struct)\\b' - }, - {begin: /<:/} // relevance booster - ]; - INTERPOLATION.contains = DEFAULT.contains; - - return DEFAULT; -}); - -hljs.registerLanguage('julia-repl', function(hljs) { - return { - contains: [ - { - className: 'meta', - begin: /^julia>/, - relevance: 10, - starts: { - // end the highlighting if we are on a new line and the line does not have at - // least six spaces in the beginning - end: /^(?![ ]{6})/, - subLanguage: 'julia' - }, - // jldoctest Markdown blocks are used in the Julia manual and package docs indicate - // code snippets that should be verified when the documentation is built. They can be - // either REPL-like or script-like, but are usually REPL-like and therefore we apply - // julia-repl highlighting to them. More information can be found in Documenter's - // manual: https://juliadocs.github.io/Documenter.jl/latest/man/doctests.html - aliases: ['jldoctest'] - } - ] - } -}); - -hljs.registerLanguage('makefile', function(hljs) { - /* Variables: simple (eg $(var)) and special (eg $@) */ - var VARIABLE = { - className: 'variable', - variants: [ - { - begin: '\\$\\(' + hljs.UNDERSCORE_IDENT_RE + '\\)', - contains: [hljs.BACKSLASH_ESCAPE], - }, - { - begin: /\$[@%`]+/} - ] - } - ] - } - ] - }; - return { - aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist'], - case_insensitive: true, - contains: [ - { - className: 'meta', - begin: '', - relevance: 10, - contains: [{begin: '\\[', end: '\\]'}] - }, - hljs.COMMENT( - '', - { - relevance: 10 - } - ), - { - begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', - relevance: 10 - }, - { - begin: /<\?(php)?/, end: /\?>/, - subLanguage: 'php', - contains: [{begin: '/\\*', end: '\\*/', skip: true}] - }, - { - className: 'tag', - /* - The lookahead pattern (?=...) ensures that 'begin' only matches - '|$)', end: '>', - keywords: {name: 'style'}, - contains: [TAG_INTERNALS], - starts: { - end: '', returnEnd: true, - subLanguage: ['css', 'xml'] - } - }, - { - className: 'tag', - // See the comment in the