Showing preview only (3,394K chars total). Download the full file or copy to clipboard to get everything.
Repository: flax-lang/flax
Branch: master
Commit: 9c46e51d8983
Files: 272
Total size: 3.2 MB
Directory structure:
gitextract_y7d5awgq/
├── .github/
│ └── workflows/
│ └── continuous_integration.yml
├── .gitignore
├── .semaphore/
│ └── semaphore.yml
├── LICENSE
├── Makefile
├── README.md
├── appveyor.yml
├── build/
│ ├── a.flx
│ ├── b.flx
│ ├── c.flx
│ ├── d.flx
│ ├── generate_test.py
│ ├── gltest.flx
│ ├── old/
│ │ └── raii_poc.flx
│ ├── run-test.ps1
│ ├── speed-test.py
│ ├── supertiny.flx
│ ├── tester.flx
│ ├── tests/
│ │ ├── anytest.flx
│ │ ├── arraytest.flx
│ │ ├── basic.flx
│ │ ├── classes.flx
│ │ ├── decomposition.flx
│ │ ├── defertest.flx
│ │ ├── fizzbuzz.flx
│ │ ├── forloops.flx
│ │ ├── functions.flx
│ │ ├── generics.flx
│ │ ├── intlimits.flx
│ │ ├── linkedlist.flx
│ │ ├── misc.flx
│ │ ├── operators.flx
│ │ ├── recursiveFib.flx
│ │ ├── scopes.flx
│ │ ├── slices.flx
│ │ ├── unions.flx
│ │ └── using.flx
│ ├── tiniest.flx
│ ├── tmp/
│ │ ├── repro_1.flx
│ │ ├── repro_2.flx
│ │ └── repro_3.flx
│ ├── tmp2/
│ │ ├── a.flx
│ │ ├── b.flx
│ │ └── c.flx
│ └── ultratiny.flx
├── changelog.md
├── external/
│ ├── mpreal/
│ │ └── mpreal.h
│ ├── tinyprocesslib/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── process.cpp
│ │ ├── process_os.cpp
│ │ ├── process_unix.inc
│ │ ├── process_win.inc
│ │ └── tinyprocess.h
│ └── utf8rewind/
│ ├── LICENSE
│ ├── README.md
│ ├── include/
│ │ └── utf8rewind/
│ │ └── utf8rewind.h
│ ├── makefile
│ └── source/
│ ├── internal/
│ │ ├── base.h
│ │ ├── casemapping.c
│ │ ├── casemapping.h
│ │ ├── codepoint.c
│ │ ├── codepoint.h
│ │ ├── composition.c
│ │ ├── composition.h
│ │ ├── database.c
│ │ ├── database.h
│ │ ├── decomposition.c
│ │ ├── decomposition.h
│ │ ├── seeking.c
│ │ ├── seeking.h
│ │ ├── streaming.c
│ │ └── streaming.h
│ ├── unicodedatabase.c
│ ├── unicodedatabase.h
│ └── utf8rewind.c
├── issues.md
├── libs/
│ ├── OpenGL/
│ │ ├── GL.flx
│ │ └── GLUT.flx
│ ├── SDL2/
│ │ ├── Keyboard.flx
│ │ └── SDL.flx
│ ├── libc.flx
│ ├── os.flx
│ └── std/
│ ├── file.flx
│ ├── io.flx
│ ├── limits.flx
│ ├── map.flx
│ ├── math.flx
│ ├── opt.flx
│ ├── print.flx
│ └── set.flx
├── meson.build
├── notes.md
├── programs/
│ └── fic/
│ ├── main.flx
│ └── run.bat
├── roadmap.md
└── source/
├── backend/
│ ├── backend.cpp
│ ├── interp/
│ │ └── driver.cpp
│ ├── llvm/
│ │ ├── jit.cpp
│ │ ├── linker.cpp
│ │ └── translator.cpp
│ └── x64AsmBackend.cpp
├── codegen/
│ ├── alloc.cpp
│ ├── arithmetic.cpp
│ ├── assign.cpp
│ ├── autocasting.cpp
│ ├── builtin.cpp
│ ├── call.cpp
│ ├── classes.cpp
│ ├── codegenstate.cpp
│ ├── constructor.cpp
│ ├── controlflow.cpp
│ ├── destructure.cpp
│ ├── directives.cpp
│ ├── dotop.cpp
│ ├── enums.cpp
│ ├── function.cpp
│ ├── glue/
│ │ ├── any.cpp
│ │ ├── arrays.cpp
│ │ ├── misc.cpp
│ │ ├── saa_common.cpp
│ │ └── strings.cpp
│ ├── literals.cpp
│ ├── logical.cpp
│ ├── loops.cpp
│ ├── misc.cpp
│ ├── operators.cpp
│ ├── raii.cpp
│ ├── ranges.cpp
│ ├── refcounting.cpp
│ ├── sizeof.cpp
│ ├── slice.cpp
│ ├── structs.cpp
│ ├── subscript.cpp
│ ├── toplevel.cpp
│ ├── traits.cpp
│ ├── unions.cpp
│ └── variable.cpp
├── fir/
│ ├── ConstantValue.cpp
│ ├── Function.cpp
│ ├── GlobalValue.cpp
│ ├── IRBlock.cpp
│ ├── IRBuilder.cpp
│ ├── Instruction.cpp
│ ├── Module.cpp
│ ├── Name.cpp
│ ├── Types/
│ │ ├── ArraySliceType.cpp
│ │ ├── ArrayType.cpp
│ │ ├── ClassType.cpp
│ │ ├── DynamicArrayType.cpp
│ │ ├── EnumType.cpp
│ │ ├── FunctionType.cpp
│ │ ├── OpaqueType.cpp
│ │ ├── PointerType.cpp
│ │ ├── PrimitiveType.cpp
│ │ ├── RawUnionType.cpp
│ │ ├── SingleTypes.cpp
│ │ ├── StructType.cpp
│ │ ├── TraitType.cpp
│ │ ├── TupleType.cpp
│ │ ├── Type.cpp
│ │ ├── TypeUtils.cpp
│ │ └── UnionType.cpp
│ ├── Value.cpp
│ └── interp/
│ ├── compiler.cpp
│ ├── interpreter.cpp
│ └── wrappers.cpp
├── frontend/
│ ├── arguments.cpp
│ ├── collector.cpp
│ ├── dependencies.cpp
│ ├── errors.cpp
│ ├── file.cpp
│ ├── import.cpp
│ ├── lexer.cpp
│ ├── parser/
│ │ ├── controlflow.cpp
│ │ ├── expr.cpp
│ │ ├── function.cpp
│ │ ├── literal.cpp
│ │ ├── misc.cpp
│ │ ├── operators.cpp
│ │ ├── toplevel.cpp
│ │ ├── type.cpp
│ │ └── variable.cpp
│ └── pts.cpp
├── include/
│ ├── allocator.h
│ ├── ast.h
│ ├── backend.h
│ ├── backends/
│ │ ├── interp.h
│ │ └── llvm.h
│ ├── codegen.h
│ ├── container.h
│ ├── defs.h
│ ├── errors.h
│ ├── frontend.h
│ ├── gluecode.h
│ ├── ir/
│ │ ├── block.h
│ │ ├── constant.h
│ │ ├── function.h
│ │ ├── instruction.h
│ │ ├── interp.h
│ │ ├── irbuilder.h
│ │ ├── module.h
│ │ ├── type.h
│ │ └── value.h
│ ├── lexer.h
│ ├── memorypool.h
│ ├── parser.h
│ ├── parser_internal.h
│ ├── platform.h
│ ├── polymorph.h
│ ├── precompile.h
│ ├── pts.h
│ ├── repl.h
│ ├── resolver.h
│ ├── sst.h
│ ├── sst_expr.h
│ ├── stcommon.h
│ ├── string_consts.h
│ ├── typecheck.h
│ ├── zfu.h
│ ├── zpr.h
│ └── ztmu.h
├── main.cpp
├── misc/
│ ├── allocator.cpp
│ ├── destructors.cpp
│ ├── identifier.cpp
│ └── mpool.cpp
├── platform/
│ ├── backtrace.cpp
│ ├── compiler.cpp
│ ├── msvcfinder.cpp
│ └── platform.cpp
├── repl/
│ ├── commands.cpp
│ ├── driver.cpp
│ ├── execute.cpp
│ └── history.cpp
└── typecheck/
├── alloc.cpp
├── arithmetic.cpp
├── assign.cpp
├── call.cpp
├── classes.cpp
├── controlflow.cpp
├── defer.cpp
├── destructure.cpp
├── directives.cpp
├── dotop.cpp
├── enums.cpp
├── function.cpp
├── literals.cpp
├── loops.cpp
├── misc.cpp
├── operators.cpp
├── polymorph/
│ ├── driver.cpp
│ ├── instantiator.cpp
│ ├── misc.cpp
│ ├── solver.cpp
│ └── transforms.cpp
├── ranges.cpp
├── resolver/
│ ├── driver.cpp
│ ├── misc.cpp
│ └── resolver.cpp
├── sizeof.cpp
├── slice.cpp
├── special.cpp
├── structs.cpp
├── subscript.cpp
├── toplevel.cpp
├── traits.cpp
├── type.cpp
├── typecheckstate.cpp
├── unions.cpp
├── using.cpp
└── variable.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/continuous_integration.yml
================================================
name: CI
on: [push, pull_request]
jobs:
build-linux:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt -y update
sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y g++-9 llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
- name: build
env:
LLVM_CONFIG: llvm-config-11
CC: gcc-9
CXX: g++-9
run: make -j2 build
- name: jit/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- name: jit/interp
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- name: compile/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
build-macos:
runs-on: macOS-10.15
steps:
- uses: actions/checkout@v1
- name: install dependencies
run: |
brew install mpfr llvm pkg-config
- name: build
env:
LLVM_CONFIG: /usr/local/opt/llvm/bin/llvm-config
run: PATH="$PATH:$(pwd)/llvm/11.0.0/bin" make -j2 build
- name: jit/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- name: jit/interp
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- name: compile/llvm
run: build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
build-windows:
runs-on: windows-2019
env:
MPIR_ROOT_DIR: C:/tmp/lib/mpir
MPFR_ROOT_DIR: C:/tmp/lib/mpfr
LLVM_ROOT_DIR: C:/tmp/lib/llvm
LIBFFI_ROOT_DIR: C:/tmp/lib/libffi
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: seanmiddleditch/gha-setup-ninja@v1
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: actions/checkout@v1
- name: cache libraries
uses: actions/cache@v1.0.0
id: cache-libs
with:
path: C:/tmp/lib
key: cached-libs
- name: download libraries
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
echo "root dirs:" $LLVM_ROOT_DIR
echo "extraction: C:\tmp\lib"
Invoke-WebRequest 'https://github.com/flax-lang/flax/releases/download/win-build-deps/libraries.zip' -OutFile 'libs.zip'
7z x -y -o"C:\tmp\lib" libs.zip
- name: install meson
run: pip install meson
- name: build
run: |
meson --buildtype=release build/meson-rel
ninja -C build/meson-rel
- name: copy stdlib
run: |
New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
- name: jit/llvm
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend llvm --ffi-escape build\tester.flx
- name: jit/interp
run: build\meson-rel\flaxc.exe -sysroot build\sysroot -run -backend interp --ffi-escape build\tester.flx
- name: compile/llvm
run: |
build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
.\tester.exe
================================================
FILE: .gitignore
================================================
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch*
*.pch*
# Makefile dependencies
*.cpp.d
*.c.d
*.h.d
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
*.pdb
# profile data
*.profdata
*.profraw
# overrides:
commit
run
*.sublime-*
build/sysroot
build/meson-*
.modifydates
build/test
build/gltest
build/standalone
*.ll
*.bc
build/plots.txt
build/massive.flx
*.ir
shakefile.hi
shakefile
.shake.database
checker-276
countloc
.shake.lock
bug-repro
.clang_complete
*.code-workspace
.vscode
*.vcxproj.filters
*.vcxproj.user
countloc.bat
builddir
prof.svg
prof_with_square.svg
build/cmake-output
.idea
# CMakeLists.txt
.flax-repl-history
docs/.antlr
codealike.json
build/test
build/tester
build/supertiny
build/gltest
release.fish
macosx.zip
flax.config
flax.creator
flax.creator.user
flax.files
flax.includes
.vs/
build/__pycache__
*.vspx
.cache
compile_flags.txt
================================================
FILE: .semaphore/semaphore.yml
================================================
version: v1.0
name: flax
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: "linux-build"
task:
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
jobs:
- name: build
commands:
- checkout
- sudo echo "deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main" | sudo tee -a /etc/apt/sources.list
- sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt -y update
- sudo apt-get -o Dpkg::Options::="--force-overwrite" --allow-unauthenticated -y install -y llvm-11 llvm-11-dev libllvm11 libmpfr-dev libmpfr6
- CXX=g++-8 CC=gcc-8 LLVM_CONFIG=llvm-config-11 make -j2 build
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend llvm build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape -run -backend interp build/tester.flx
- build/sysroot/usr/local/bin/flaxc -sysroot build/sysroot -profile --ffi-escape build/tester.flx && ./tester
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 zhiayang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
# Makefile for Orion-X3/Orion-X4/mx and derivatives
# Written in 2011
# This makefile is licensed under the WTFPL
WARNINGS := -Wno-unused-parameter -Wno-sign-conversion -Wno-padded -Wno-conversion -Wno-shadow -Wno-missing-noreturn -Wno-unused-macros -Wno-switch-enum -Wno-deprecated -Wno-format-nonliteral -Wno-trigraphs -Wno-unused-const-variable -Wdeprecated-declarations -Werror=return-type
GCCWARNINGS := -Wno-init-list-lifetime
CLANGWARNINGS := -Wno-undefined-func-template -Wno-comma -Wno-nullability-completeness -Wno-redundant-move -Wno-nested-anon-types -Wno-gnu-anonymous-struct -Wno-reserved-id-macro -Wno-extra-semi -Wno-gnu-zero-variadic-macro-arguments -Wno-shift-sign-overflow -Wno-exit-time-destructors -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-documentation-unknown-command -Wno-weak-vtables -Wno-c++98-compat -Wold-style-cast
SYSROOT := build/sysroot
PREFIX := usr/local
OUTPUTBIN := flaxc
OUTPUT := $(SYSROOT)/$(PREFIX)/bin/$(OUTPUTBIN)
CC ?= "clang"
CXX ?= "clang++"
LLVM_CONFIG ?= "llvm-config"
CXXSRC := $(shell find source external/tinyprocesslib -iname "*.cpp")
CXXOBJ := $(CXXSRC:.cpp=.cpp.o)
CXXDEPS := $(CXXSRC:.cpp=.cpp.d)
PRECOMP_HDRS := source/include/precompile.h
PRECOMP_GCH := $(PRECOMP_HDRS:.h=.h.gch)
FLXLIBLOCATION := $(SYSROOT)/$(PREFIX)/lib
FLXSRC := $(shell find libs -iname "*.flx")
NUMFILES := $$(($(words $(CXXSRC))))
DEFINES := -D__USE_MINGW_ANSI_STDIO=1
SANITISE :=
CXXFLAGS += -std=c++17 -fvisibility=hidden -O0 -g -c -Wall -frtti -fno-omit-frame-pointer $(SANITISE) $(DEFINES)
LDFLAGS += $(SANITISE) -fvisibility=hidden
UNAME_IDENT := $(shell uname)
COMPILER_IDENT := $(shell $(CC) --version | head -n 1)
ifeq ("$(UNAME_IDENT)","Darwin")
LIBFFI_CFLAGS := $(shell env PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig pkg-config --cflags libffi)
LIBFFI_LDFLAGS := $(shell env PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig pkg-config --libs libffi)
else
LIBFFI_CFLAGS := $(shell pkg-config --cflags libffi)
LIBFFI_LDFLAGS := $(shell pkg-config --libs libffi)
# on linux, we need to explicitly export our functions
# like __declspec(dllexport) except __attribute__((visibility("default")))
LDFLAGS += -Wl,--export-dynamic
endif
MPFR_CFLAGS := $(shell pkg-config --cflags mpfr)
MPFR_LDFLAGS := $(shell pkg-config --libs mpfr)
CXXFLAGS += $(MPFR_CFLAGS) $(LIBFFI_CFLAGS)
LDFLAGS += $(MPFR_LDFLAGS) $(LIBFFI_LDFLAGS)
ENABLE_CODE_COVERAGE ?= "yes"
ifneq (,$(findstring clang,$(COMPILER_IDENT)))
CXXFLAGS += -Xclang -fcolor-diagnostics $(SANITISE) $(CLANGWARNINGS)
ifeq ("$(ENABLE_CODE_COVERAGE)","yes")
CXXFLAGS += -fprofile-instr-generate -fcoverage-mapping
LDFLAGS += -fprofile-instr-generate -fcoverage-mapping
endif
else
CXXFLAGS += $(GCCWARNINGS)
ifeq ("$(ENABLE_CODE_COVERAGE)","yes")
CXXFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lgcov
endif
endif
UTF8REWIND_AR := external/libutf8rewind.a
FLXFLAGS += -sysroot $(SYSROOT) --ffi-escape
SUPERTINYBIN := build/supertiny
GLTESTBIN := build/gltest
TESTBIN := build/tester
SUPERTINYSRC := build/supertiny.flx
GLTESTSRC := build/gltest.flx
TESTSRC := build/tester.flx
.DEFAULT_GOAL = jit
-include $(CXXDEPS)
-include source/include/precompile.h.d
.PHONY: copylibs jit compile clean build linux ci satest tiny
satest: build
@$(OUTPUT) $(FLXFLAGS) -run build/standalone.flx
tester: build
@$(OUTPUT) $(FLXFLAGS) -run build/tester.flx
ci: test
jit: build
@$(OUTPUT) $(FLXFLAGS) -run -o $(SUPERTINYBIN) $(SUPERTINYSRC)
compile: build
@$(OUTPUT) $(FLXFLAGS) -o $(SUPERTINYBIN) $(SUPERTINYSRC) -lm
test: build
@$(OUTPUT) $(FLXFLAGS) -run -o $(TESTBIN) $(TESTSRC)
repl: build
@$(OUTPUT) $(FLXFLAGS) -repl
gltest: build
@$(OUTPUT) $(FLXFLAGS) -run -framework GLUT -framework OpenGL -lsdl2 -o $(GLTESTBIN) $(GLTESTSRC)
build1:
build: build1 $(OUTPUT) copylibs
# built
build/%.flx: build
@$(OUTPUT) $(FLXFLAGS) -run -profile $@
copylibs: $(FLXSRC)
@mkdir -p $(FLXLIBLOCATION)/flaxlibs
@cp -R libs $(FLXLIBLOCATION)/
@rm -r $(FLXLIBLOCATION)/flaxlibs
@mv $(FLXLIBLOCATION)/libs $(FLXLIBLOCATION)/flaxlibs
$(OUTPUT): $(PRECOMP_GCH) $(CXXOBJ) $(COBJ) $(UTF8REWIND_AR)
@printf "# linking\n"
@mkdir -p $(dir $(OUTPUT))
@$(CXX) -o $@ $(CXXOBJ) $(COBJ) $(LDFLAGS) -Lexternal -L$(shell $(LLVM_CONFIG) --prefix)/lib $(shell $(LLVM_CONFIG) --system-libs --libs core engine native linker bitwriter lto vectorize all-targets object orcjit) -lmpfr -lgmp -lpthread -ldl -lffi -lutf8rewind
%.cpp.o: %.cpp
@$(eval DONEFILES += "CPP")
@printf "# compiling [$(words $(DONEFILES))/$(NUMFILES)] $<\n"
@$(CXX) $(CXXFLAGS) $(WARNINGS) -include source/include/precompile.h -Isource/include -Iexternal -I$(shell $(LLVM_CONFIG) --includedir) -MMD -MP -o $@ $<
%.h.gch: %.h
@printf "# precompiling header $<\n"
@$(CXX) $(CXXFLAGS) $(WARNINGS) -o $@ $< -MMD -MP
$(UTF8REWIND_AR):
@$(MAKE) -C external/utf8rewind all
# haha
clena: clean
clean:
@rm -f $(OUTPUT)
@find source -name "*.o" | xargs rm -f
@find source -name "*.gch*" | xargs rm -f
@find source -name "*.pch*" | xargs rm -f
@find source -name "*.c.m" | xargs rm -f
@find source -name "*.c.d" | xargs rm -f
@find source -name "*.cpp.m" | xargs rm -f
@find source -name "*.cpp.d" | xargs rm -f
================================================
FILE: README.md
================================================
# [Flax](https://flax-lang.github.io)
A low level, general-purpose language with high level syntax and expressibility.
[](http://forthebadge.com)
[](http://forthebadge.com)
[](https://ci.appveyor.com/project/zhiayang/flax/branch/master)
[](https://github.com/flax-lang/flax/actions)
[](https://semaphoreci.com/zhiayang/flax)
-----------------------------------------------
#### Disclaimer ####
I work on Flax in my spare time, and as the lone developer I cannot guarantee continuous development.
I'm no famous artist but this is my magnum opus, so it'll not be abandoned anytime soon.
### Language Goals
- No header files.
- Minimal runtime
- Minimal stupidity
- Clean, expressive syntax
-----------------------------------------------
### Current Features
- Structs, unions, enums
- Arrays (fixed and dynamic), slices
- Pointer manipulation/arithmetic
- Operator overloading
- Generic functions and types
- Type inference (including for generics)
- Full compile-time execution (of arbitrary code)
- Classes, including virtual dispatch and (single) inheritance
-----------------------------------------------
### Language Syntax
- We don't have a proper place that documents everything yet, but most of the basic stuff is probably not gonna change much.
The testing code in `build/tests/` (most of them, anyway — check `tester.flx` to see which ones we call) tests basically 90% of the
language, so that's the syntax reference for now.
- Yes, the syntax is not "officially" defined by a grammar. The reference parser implementation is the One True Definition, for now.
-----------------------------------------------
### Code Sample
```rust
import std::io as _
@entry fn main()
{
println("hello, world!")
}
```
```rust
do {
fn prints<T, U>(m: T, a: [U: ...])
{
for x in a => printf(" %.2d", m * x)
}
printf("set 6:")
let xs = [ 1, 2, 3, 4, 5 ]
prints(3, ...xs)
printf("\n")
}
do {
union option<T>
{
some: T
none
}
let x = option::some("foobar")
let y = option::some(456)
println("x = %, y = %", x as some, y as some)
}
```
-----------------------------------------------
### Building the Flax compiler
#### Dependencies ####
- LLVM 11, mostly due to their obsession with changing the IR interface every damn version
- GMP/MPIR
- MPFR
- libffi
#### macOS / Linux
- The `makefile` is the preferred way to build on UNIX systems.
- LLVM needs to be installed. On macOS, `brew install llvm` should work, and you might need to do some PPA fiddling for Debian-based distros.
- A C++17-compatible compiler should be used.
- Find the `flaxc` executable in `build/sysroot/usr/local/bin`.
- Additionally, the (admittedly limited) standard library will be copied from `./libs` to `./build/sysroot/usr/local/lib/flaxlibs/`.
#### Windows
- Install [meson](https://mesonbuild.com/).
- Run `env MPIR_ROOT_DIR=... LLVM_ROOT_DIR=... meson meson-build-dir` to set the locations for the dependencies (see `meson.build` for the names, there are 4) and configure the build.
- Optionally, pass `--buildtype=release` to build a release-mode compiler (highly recommended).
- Run `ninja -C meson-build-dir`.
- `flaxc.exe` will be found in the build directory.
##### Libraries
- Download the [prebuilt binaries](https://github.com/flax-lang/flax/releases/tag/win-build-deps) for the 4 dependencies, and place them somewhere.
- Note: the folder structure of the libraries should be `(llvm|mpir|mpfr|libffi)/(Release|Debug)/(include|lib)/...`.
-----------------------------------------------
### Building Flax Programs
Since nobody in their right mind is *actually* using this, please pass `-sysroot build/sysroot` to invocations of the compiler -- else the compiler will default to looking somewhere in `/usr/local/lib` for libraries. Speaking of which, standard libraries are looked for in `<sysroot>/<prefix>/lib/flaxlibs/`. Prefix is set to `/usr/local/` by default.
Since version 0.41.2, executables can be generated on all 3 of our supported platforms! For Linux and macOS, all that is required is a working C compiler in the `$PATH`; we call `cc` to link object files.
For Windows, even if you are not building the compiler from source (eg. you are using a released binary), Visual Studio 2017 or newer must still be installed, with the "Desktop development with C++", "MSVC v142 (or whatever)", and "Windows 10 SDK" components. However, we currently find the toolchain through [established means](https://gist.github.com/machinamentum/a2b587a68a49094257da0c39a6c4405f), so that `link.exe` does not have to be in the `%PATH%`, ie. you do not have to call `vcvarsall.bat` before running the compiler.
-----------------------------------------------
### Contributors
Special thanks to the Unofficial Official Language Consultants:
[darkf](https://github.com/darkf), [adrian17](https://github.com/adrian17),
[sim642](https://github.com/sim642), and [ryu0](https://github.com/ryu0).
### Contributing
Feel free to open an issue if you feel that there's any missing feature, or if you found a bug in the compiler. Pull requests are also
welcome.
### Licensing
The Flax compiler itself (this repository) is licensed under the Apache 2.0 license (see `LICENSE` file). For ease of building, some dependencies
are included in the repository itself (under the `external` folder) and compiled together, instead of as a separate library (shared or otherwise).
These are:
1. [mpreal](https://bitbucket.org/advanpix/mpreal), GPL
2. [utf8rewind](https://bitbucket.org/knight666/utf8rewind), MIT
3. [tinyprocesslib](https://gitlab.com/eidheim/tiny-process-library), MIT
================================================
FILE: appveyor.yml
================================================
image: Visual Studio 2019
clone_depth: 50
clone_folder: c:\projects\flax
environment:
global:
MPIR_ROOT_DIR: c:\projects\lib\mpir
MPFR_ROOT_DIR: c:\projects\lib\mpfr
LLVM_ROOT_DIR: c:\projects\lib\llvm
LIBFFI_ROOT_DIR: c:\projects\lib\libffi
cache:
- c:\projects\lib -> appveyor.yml
install:
# Set up the build environment
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
# download our deps.
- ps: "[Net.ServicePointManager]::SecurityProtocol = 'Ssl3, Tls, Tls11, Tls12'"
- ps: >-
If (!(Test-Path c:\projects\lib -PathType Container)) {
Invoke-WebRequest 'https://github.com/flax-lang/flax/releases/download/win-build-deps/libraries.zip' -OutFile 'c:\projects\libs.zip'
7z x -y -oc:\projects\lib c:\projects\libs.zip
}
# Download ninja
- cmd: mkdir C:\ninja-build
- ps: (new-object net.webclient).DownloadFile('https://github.com/mesonbuild/cidata/raw/master/ninja.exe', 'C:\ninja-build\ninja.exe')
- cmd: set PYTHON_ROOT=C:\python37-x64
# Add neccessary paths to PATH variable
- cmd: set PATH=%cd%;C:\ninja-build;%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%
# Install meson
- cmd: pip install meson
build_script:
- ps: meson --buildtype=release build/meson-rel
- ps: ninja -C build/meson-rel
test_script:
- ps: cd c:\projects\flax
- ps: New-Item -Force -Path build\sysroot\usr\local\lib\flaxlibs -ItemType Directory
- ps: Copy-Item -Recurse -Force libs\* build\sysroot\usr\local\lib\flaxlibs\
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend llvm build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape -run -backend interp build\tester.flx
- ps: build\meson-rel\flaxc.exe -sysroot build\sysroot --ffi-escape build\tester.flx
- ps: .\tester.exe
after_test:
- cmd: 7z a windows-x64.zip %APPVEYOR_BUILD_FOLDER%\build\meson-rel\flaxc.exe
- cmd: 7z a windows-x64.zip %APPVEYOR_BUILD_FOLDER%\build\sysroot\usr\local\lib
- cmd: 7z rn windows-x64.zip flaxc.exe sysroot\usr\local\bin\flaxc.exe
- cmd: 7z rn windows-x64.zip lib sysroot\usr\local\lib
artifacts:
- path: windows-x64.zip
deploy:
- provider: GitHub
description: ''
artifact: windows-x64.zip
auth_token:
secure: Sk3O32lE4SgtirIRqI2PWP2tkfCg2Iurz+eFrLN7C9s/nIUCDbxV0T5hjjZqMIw5
on:
APPVEYOR_REPO_TAG: true
================================================
FILE: build/a.flx
================================================
// a.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
// import libc as _
export a
import libc
import std::io as _
// import b
// import d
@entry fn main()
{
print("uwu\n")
}
================================================
FILE: build/b.flx
================================================
// b.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
export a
import libc
================================================
FILE: build/c.flx
================================================
// ultratiny.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
export ultratiny
// import libc as _
import a
@entry fn main()
{
// printf("q = %d\n", 37)
}
================================================
FILE: build/d.flx
================================================
// d.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
export a
import libc
================================================
FILE: build/generate_test.py
================================================
#!/usr/bin/env python3
# taken from github.com/pervognesn/bitwise/ion/generate_test.py
import sys
def gen_test(reps):
template = """
let names(?) = [ "max", "ollie", "coco", "piper", "tim", "bill", "alex", "ron", "isaac", "jim" ]
class Animal(?)
{
init(w: f64)
{
// printf("make animal w = %f\\n", w)
weight = w
name = names(?)[rand() % names(?).length]
}
virtual fn makeNoise()
{
printf("some generic sound\\n")
}
var name: str
var weight: f64
var cute: bool = true
}
class Dog(?) : Animal(?)
{
init() : super(w: 300)
{
// printf("make dog (w = %f)\\n", weight)
}
override fn makeNoise()
{
printf("bark bark (%f)\\n", weight)
}
virtual fn wag()
{
printf("wagging tail of length %d\\n", tail)
}
var tail: int = 37
}
class Dalmation(?) : Dog(?)
{
init() : super()
{
printf("make dalmation\\n")
}
override fn wag()
{
printf("dalmation wags %d\\n", tail)
}
var numSpots: int
}
class LinkedList(?)<T>
{
struct Node
{
var data: T
var prev: &Node
var next: &Node
}
var head: &Node
var tail: &Node
var count: int
init()
{
}
mut fn insert(thing: T)
{
var nn = alloc mut Node (data: thing, prev: null, next: null)
if head == null { head = nn; tail = nn }
else
{
var ot = tail as mut
tail = nn
nn.prev = ot
ot.next = nn
}
count += 1
}
static fn hello() -> T { printf("hi\\n"); return 10 }
}
fn stuff(?)()
{
do {
// don't question.
srand(284811)
// fn test() -> f64 { printf("hi\\n"); return 31.51 }
let dogs = alloc &Dog(?) [5] {
if i % 2 == 1 { it = alloc Dalmation(?) }
else { it = alloc Dog(?) }
}
for dog, i in dogs {
printf("%d: %s - ", i, dog.name)
dog.wag()
}
}
do {
var list: LinkedList(?)!<T: int>
list.insert(10)
list.insert(20)
list.insert(30)
list.insert(40)
var head = list.head
while(head)
{
printf("%d\\n", head.data)
head = head.next
}
}
}
fn genericstuff(?)()
{
do {
fn gincr<A>(x: A) -> A => x + 1
fn apply<B, C>(x: B, f: fn(B) -> C) -> C => f(x)
fn mapstupid<D, E, F>(arr: [D:], f: fn(D) -> E, fa: fn(D, fn(D) -> E) -> F) -> [F]
{
var i = 0
var ret: [F]
while i < arr.length
{
ret.append(fa(arr[i], f))
i += 1
}
return ret
}
printf("set 4:")
let new = mapstupid([ 5, 6, 7, 8, 9 ], gincr, apply)
for it in new { printf(" %d", it) }
printf("\\n")
}
do {
fn map2<T, K, R>(arr: [(T, K):], f: fn(T, K) -> R) -> [R]
{
var i = 0
var ret: [R]
while i < arr.length
{
ret.append(f(arr[i].0, arr[i].1))
i += 1
}
return ret
}
fn add2<A, B>(x: A, y: B) -> A => x + y
printf("set 5:")
let new = map2([ (2, 2), (4, 4), (6, 6), (8, 8), (10, 10) ], add2)
for it in new { printf(" %d", it) }
printf("\\nset (?) done\\n\\n")
}
}
"""
outfile = open("build/massive.flx", "wt")
outfile.write("export massive\n")
outfile.write("import libc as _\n")
outfile.write("ffi fn srand(s: i32)\n")
outfile.write("ffi fn rand() -> i32\n")
# dupes = range(128 * 48)
dupes = range(reps)
for i in dupes:
outfile.write(template.replace("(?)", str(i)) + "\n")
outfile.write("@entry fn main() -> i32 {\n")
for i in dupes:
outfile.write("\tstuff(?)()\n".replace("(?)", str(i)))
outfile.write("\tgenericstuff(?)()\n".replace("(?)", str(i)))
outfile.write("\treturn 0\n}\n")
outfile.close()
if __name__ == '__main__':
globals()[sys.argv[1]](int(sys.argv[2]))
================================================
FILE: build/gltest.flx
================================================
// gltest.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
// import Foundation
import "OpenGL/GL.flx"
import "SDL2/SDL.flx" as _
import libc as _
ffi fn rand() -> i32
fn frand(a: f64, b: f64) -> f64
{
let r = (rand() as f64) / 2147483647.0
let diff = b - a
let x = r * diff
return a + x
}
ffi fn log(a: f64) -> f64
ffi fn sin(a: f64) -> f64
ffi fn fabs(a: f64) -> f64
ffi fn fmin(a: f64, b: f64) -> f64
ffi fn fmax(a: f64, b: f64) -> f64
ffi fn sqrt(a: f64) -> f64
fn clamp(x: f64, lower: f64, upper: f64) -> f64
{
return fmin(upper, fmax(x, lower))
}
public fn main(argc: i32, argv: &&i8) -> int
{
SDL_Init(INIT_EVERYTHING)
let mw = SDL_CreateWindow("test", 805240832, 805240832, 640, 480, 2)
if mw == null
{
printf("omg no\n")
}
else
{
printf("window init: %p\n", mw)
}
let glc = SDL_GL_CreateContext(mw)
SDL_GL_SetAttribute(GL_MULTISAMPLEBUFFERS, 1)
SDL_GL_SetAttribute(GL_MULTISAMPLESAMPLES, 2)
GL::glClearColor(0, 0, 0, 0)
GL::glMatrixMode(GL::GL::PROJECTION)
GL::glLoadIdentity()
GL::gluPerspective(45.0, (640.0 / 480.0), 0.1, 100.0)
GL::glMatrixMode(GL::GL::MODELVIEW)
GL::glLoadIdentity()
GL::glEnableClientState(GL::GL::VERTEX_ARRAY)
GL::glEnableClientState(GL::GL::TEXTURE_COORD_ARRAY)
GL::glEnableClientState(GL::GL::COLOR_ARRAY)
GL::glEnableClientState(GL::GL::NORMAL_ARRAY)
GL::glEnable(GL::GL::MULTISAMPLE)
GL::glEnable(GL::GL::DEPTH_TEST)
GL::glDepthFunc(GL::GL::LESS)
GL::glBlendColor(1.0, 1.0, 1.0, 1.0)
var rx: f64 = 0
var ry: f64 = 0
var rz: f64 = 0
let vertices = [ 0.0, -0.525731, 0.850651,
0.850651, 0.0, 0.525731,
0.850651, 0.0, -0.525731,
-0.850651, 0.0, -0.525731,
-0.850651, 0.0, 0.525731,
-0.525731, 0.850651, 0.0,
0.525731, 0.850651, 0.0,
0.525731, -0.850651, 0.0,
-0.525731, -0.850651, 0.0,
0.0, -0.525731, -0.850651,
0.0, 0.525731, -0.850651,
0.0, 0.525731, 0.850651
]
// var colours: f64[36]
var colours = alloc f64[48]
defer free colours
var i = 0
while i < 48
{
colours[i + 0] = frand(0.3, 0.9)
colours[i + 1] = frand(0.3, 0.9)
colours[i + 2] = frand(0.3, 0.9)
colours[i + 3] = 1.0
i += 4
}
let indices: [u8: 60] = [
1, 2, 6,
1, 7, 2,
3, 4, 5,
4, 3, 8,
6, 5, 11,
5, 6, 10,
9, 10, 2,
10, 9, 3,
7, 8, 9,
8, 7, 0,
11, 0, 1,
0, 11, 4,
6, 2, 10,
1, 6, 11,
3, 5, 10,
5, 4, 11,
2, 7, 9,
7, 1, 0,
3, 9, 8,
4, 8, 0
]
let normals = [
0.000000, -0.417775, 0.675974,
0.675973, 0.000000, 0.417775,
0.675973, -0.000000, -0.417775,
-0.675973, 0.000000, -0.417775,
-0.675973, -0.000000, 0.417775,
-0.417775, 0.675974, 0.000000,
0.417775, 0.675973, -0.000000,
0.417775, -0.675974, 0.000000,
-0.417775, -0.675974, 0.000000,
0.000000, -0.417775, -0.675973,
0.000000, 0.417775, -0.675974,
0.000000, 0.417775, 0.675973
]
var speed = 1.0
var scale = 1.0
var run = true
var srx = 0.0
var sry = 0.0
var srz = 0.0
let stderr = fdopen(2, "a")
while run
{
GL::glClear(GL::GL::COLOR_BUFFER_BIT | GL::GL::DEPTH_BUFFER_BIT)
GL::glClearColor(0.109, 0.109, 0.109, 1.0)
GL::glTranslated(0.0, 0.0, -5.0)
GL::glRotated(rx, frand(0, 1), 0, 0)
GL::glRotated(ry, 0, frand(0, 1), 0)
GL::glRotated(rz, 0, 0, frand(0, 1))
GL::glVertexPointer(3, GL::GL::DOUBLE, 0, vertices.ptr as &void)
GL::glColorPointer(4, GL::GL::DOUBLE, 0, colours.ptr as &void)
GL::glNormalPointer(GL::GL::DOUBLE, 0, normals.ptr as &void)
GL::glDrawElements(GL::GL::TRIANGLES, 60, GL::GL::UNSIGNED_BYTE, indices as &void)
GL::glLoadIdentity()
SDL_GL_SwapWindow(mw)
usleep((1 * 1000) as u32)
rx += srx * speed
ry += sry * speed
rz += srz * speed
var e: Event
while SDL_PollEvent(&e) == 1
{
if e.type == EventType::Quit
{
printf("\nexiting\n")
run = false
}
else if e.type == EventType::KeyUp
{
if (&e as &SDL.KeyboardEvent).keysym.sym == SDL.Key.R
{
srx = frand(-2.5, 2.5)
sry = frand(-2.5, 2.5)
srz = frand(-2.5, 2.5)
}
else if (&e as &SDL.KeyboardEvent).keysym.sym == SDL.Key.F
{
rx = 0
ry = 0
rz = 0
srx = 0
sry = 0
srz = 0
speed = 1.0
glLoadIdentity()
}
}
else if e.type == SDL.EventType.KeyDown
{
let ke = *(&e as &SDL.KeyboardEvent)
if ke.keysym.sym == SDL.Key.Space
{
srx *= 0.9
sry *= 0.9
srz *= 0.9
}
else if ke.keysym.sym == SDL.Key.C { scale -= 0.5 }
else if ke.keysym.sym == SDL.Key.V { scale += 0.5 }
else if ke.keysym.sym == SDL.Key.X { speed += scale }
else if ke.keysym.sym == SDL.Key.Z { speed -= scale }
else if ke.keysym.sym == SDL.Key.D { sry -= scale }
else if ke.keysym.sym == SDL.Key.A { sry += scale }
else if ke.keysym.sym == SDL.Key.Q { srz -= scale }
else if ke.keysym.sym == SDL.Key.E { srz += scale }
else if ke.keysym.sym == SDL.Key.W { srx -= scale }
else if ke.keysym.sym == SDL.Key.S { srx += scale }
fprintf(stderr, " \r> %.2lf / %.2lf : %.2lf, %.2lf, %.2lf\r", speed,
scale, srx, sry, srz)
fflush(stderr)
}
}
/*
todo: enums suck
*/
}
return 0
}
================================================
FILE: build/old/raii_poc.flx
================================================
// raii_poc.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
export ultratiny
import libc as _
import "tests/scopes.flx"
class Foo
{
init(x: int)
{
printf("* create foo %d\n", x)
this.rc = alloc mut int
*this.rc = 1
this.v = x
}
copy(from: &self) { this.v = from.v; this.rc = from.rc; *this.rc += 1; printf("* copy foo %d/rc: %d\n", this.v, *this.rc) }
move(from: &mut self) { this.v = from.v; this.rc = from.rc; from.rc = null; printf("* move foo %d/rc: %d\n", this.v, *this.rc) }
deinit { if(this.rc) => *this.rc -= 1; printf("* delete foo %d/rc: %d\n", this.v, *this.rc) }
var rc: &mut int
var v: int
}
fn bar() -> Foo
{
return Foo(x: 7)
}
fn con(x: Foo)
{
printf("\nconsumed %d, rc: %d\n\n", x.v, *x.rc)
}
@entry fn main()
{
let y = bar()
printf("\ny.value = %d, rc: %d\n\n", y.v, *y.rc)
let x = Foo(x: 13)
printf("\nx.value = %d, rc: %d\n\n", x.v, *x.rc)
con(x)
// test_scopes::doScopeTest("__llvm_jit__build/test")
}
/*
! let x = alloc int { it = ... } fails!!
todo to cleanup semantics:
1. copy and move constructors must call a base class constructor if there is not default one
2. allow omitting the explicit call if the base class has a no-arg constructor (to prevent init() : super() { ... })
3. check if constructing stuff in conditionals will wrongly destruct them!
todo for implementing destructors properly:
2. only classes can contain other classes! (ANY notwithstanding)
3. similar to how class constructors call the superclass constructors, we need to call base destructors also!
4. virtual destructors! need to add it to the vtable!!!!!
*/
================================================
FILE: build/run-test.ps1
================================================
# hmm
Param
(
[string] $buildType,
[string] $theProgram,
[Parameter(ValueFromRemainingArguments=$true)]
[string[]]$extraArgs
)
robocopy "libs" "build\sysroot\usr\local\lib\flaxlibs" /mir /nfl /ndl /njh /njs /nc /ns /np
if($buildType -eq "release") {
$buildDir = "build\meson-rel"
}
if($buildType -eq "debug") {
$buildDir = "build\meson-dbg"
}
if($buildType -eq "debugopt") {
$buildDir = "build\meson-reldbg"
}
ninja -C $buildDir
if($?) {
# cls
& $buildDir\flaxc.exe -Ox -sysroot build\sysroot -run "build\$theProgram.flx" --ffi-escape $extraArgs
}
if($buildType -eq "release") {
copy "$buildDir\flaxc.exe" build\sysroot\usr\local\bin\
}
================================================
FILE: build/speed-test.py
================================================
#!/usr/bin/env python3
import re
import os
import subprocess
import generate_test
import prettytable
from prettytable import PrettyTable
tab = PrettyTable([ "reps", "firs", "total", "lexer", "parser", "typecheck", "codegen" ])
tab.set_style(prettytable.PLAIN_COLUMNS)
tab.align = "l"
counts = range(32, 1025, 32)
# counts = range(32, 64, 32)
plots = open("build/plots.txt", "wt")
for i in counts:
generate_test.gen_test(i)
if os.name == "nt":
flaxc_path = "build/meson-rel/flaxc.exe"
else:
flaxc_path = "build/sysroot/usr/local/bin/flaxc"
output = subprocess.run([ flaxc_path, "-sysroot", "build/sysroot", "-run", "-backend", "none", "build/massive.flx" ],
capture_output = True, text = True).stdout
# rex = re.findall(r"compile took (\d+\.\d+) \(lexer: (\d+\.\d+), parser: (\d+\.\d+), typecheck: (\d+\.\d+), codegen (\d+\.\d+)\) ms(.+)",
# output)
rex = re.compile(r"compile took (\d+\.\d+) \(lexer: (\d+\.\d+), parser: (\d+\.\d+), typecheck: (\d+\.\d+), codegen: (\d+\.\d+)\) ms.*\n(\d+) FIR values generated")
m = rex.search(output)
t_compile = m.group(1)
t_lexer = m.group(2)
t_parser = m.group(3)
t_typecheck = m.group(4)
t_codegen = m.group(5)
n_fvals = m.group(6)
n_lines = 0
with open("build/massive.flx", "r") as f:
for k, l in enumerate(f):
pass
n_lines = k + 1
f.close()
tab.add_row([ n_lines, n_fvals, t_compile, t_lexer, t_parser, t_typecheck, t_codegen ])
print(n_lines, n_fvals, t_compile, t_lexer, t_parser, t_typecheck, t_codegen)
plots.write(str(tab))
plots.close()
================================================
FILE: build/supertiny.flx
================================================
// supertiny.flx
// Copyright (c) 2014 - 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export supertiny
import std::io
import libc as _
// import std::io
// import std::map
import std::opt
@raw union ipv4
{
_: struct {
_: @raw union {
bytes2: [u8: 4]
raw3: u32
}
}
_: struct {
bytes: [u8: 4]
}
_: struct {
raw2: u32
}
raw: u32
}
struct foo
{
x: int
}
let glob = "foozle"[2:]
let glob2 = string("lmao")
@entry fn main()
{
// do {
// var addr: ipv4
// addr.raw3 = 0xff01a8c0;
// printf("%d.%d.%d.%d\n", addr.bytes[0], addr.bytes[1], addr.bytes[2], addr.bytes[3]);
// }
do {
var x: int
var y: int
(x, y) = (30, 40)
(x, y) = (y, x)
printf("%d, %d\n", x, y)
}
do {
printf("%s\n", glob)
}
// fn foo<T>(a: T) -> T
// {
// return a
// }
// do {
// // let q = foo(x: 10)
// printf("hello, world!\n")
// let q = foo!<G: int>(10)
// }
// fn qux() -> int => 30
// let x = std::opt::some!<int>(10)
// let f = foo!<int>(3)
// let q = qux!<int>()
/* do {
var x: @raw union {
bar: f64
foo: i64
}
x.bar = 3.14159
printf("x = %.2lf\n", x.bar)
printf("x = %d\n", x.foo)
} */
}
/*
import std::opt
import std::map
var map: std::map!<int, str>
map.insert(3, "foo")
let r = map.search(3)
libc::printf("map[3] = %s\n", map.search(3) as std::opt::some)
let res = map.remove(3)
libc::printf("map[3]: res = %d, is_none = %d\n", res, map.search(3) is std::opt::none)
*/
/*
class X
{
init(c: int)
{
this.data = c
}
var data: int
}
class Y : X
{
init(c: int) : super(c: c + 30) { }
}
class Z : Y
{
init(c: int) : super(c: c - 90) { }
}
class A
{
init() { }
virtual fn foo(a: &Y) -> &Y
{
std::io::println("A::foo()")
return alloc Y(c: 471)
}
}
class B : A
{
init() : super() { }
override fn foo(a: &X) -> &Z
{
std::io::println("B::foo()")
return alloc Z(c: 748)
}
}
*/
/*
! important stuff to fix !
{
2. splatting tuples into a generic function *will not work*
3. pass the overall location to the polymorph solver.
5. for optional arguments on virtual functions, we need to reach a decision --- do we ban it entirely,
or follow what c++ does, which is to use the default values specified on the static type of the pointer?
note: we are definitely *not* going to handle it at runtime.
6. see the error message when we pass a [T1:] to a [T2:...] without splatting; we should probably give a better
diagnostic, and eg. recommend splatting it, if the internal types match (ie. T1 == T2).
at the very least, the current message complains about casting [T1:] to T2, which isn't really correct.
}
TODO for the immediate time frame (that keeps getting longer and where the real work always gets postponed)
7. move long error messages on spans nearer to the left margin when there's only one span in the error.
9. fix errors (in general?) {
a. the generic solver should basically return only a Span, ie. a location with text.
b. maybe find some way to 'link' two spans together with one message.
c. figure out if/how we should split up errors when there are too many spans in one context.
- do we duplicate the context?
- if not then???
}
16. operator overload errors {
something like this:
failed to resolve candidate for 'operator == (type_1, type_2)'
callsite was here: 'foo == bar'
potential candidates: 'operator == (type_1, type_3)'
ofc potential candidates should be limited to ones where at least one of the types
are similar.
}
17. better errors for ref-counting legality {
when throwing an error due to having a ref-counted type in unsupported places (like in a raw-union), we
should let the compiler show which member made the struct refcounted (because having a RC field in a struct
makes that struct RC), since the 'root cause' could be nested very deep in the type hierarchy somewhere.
eg.
error: reference-counted type 'foo' cannot be a member of a raw-union:
39 | bar: foo
note: 'foo' inherits reference-counting from indirectly containing a field with a reference-counted type:
303 | blabla: string
note: this is the type hierarchy leading from 'foo' leading to the type in question:
(foo <- qux <- some_type_t <- ... <- some_struct <- string)
of course it would be nice if we can selectively print more context and omit stuff in the middle, like this:
10 | struct some_struct {
... | ...
391 | blabla: string
|
something like that. detecting indentation would be a little tricky if we want to correctly indent the
'...' that would appear in the struct body.
actually having a proper API to set up this kind of error message would be a tough one as well...
}
18. figure out how constructors should work with transparent fields {
I think it's currently not worth the effort to support initialising transparent fields in constructors; there's
way too much stuff that needs to change. some findings:
to actually allow it to pass typechecking, we just need to pass the "extended set" of field names to
`verifyStructConstructorArguments`, which ought to suffice. problem is, we call that from the polymorph
engine as well, and that's something i don't really feel like touching at the moment.
^ as a corollary to that, we also need a way to discover all the transparent fields that are accessible at any
point. currently in typecheck/dotop, we currently do an ad-hoc kind of thing, where we search for a particular
name that's needed. should be not-that-difficult to get a list of all accessible things, i hope.
^ we might need to duplicate this to work with ast::StructDefn as well, since the polymorph engine also uses
the same verifyStructConstructorArguments to instantiate types a-la function calls.
we also need some way to actually insert the value into the struct when it's being constructed, which might also
get complicated.
TL;DR: too complicated, not worth the time currently.
}
*/
================================================
FILE: build/tester.flx
================================================
// tester.flx
// Copyright (c) 2014 - 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export tester
import libc
import std::io
import std::limits
import "tests/fizzbuzz.flx"
import "tests/recursiveFib.flx"
import "tests/slices.flx"
import "tests/classes.flx"
import "tests/scopes.flx"
import "tests/defertest.flx"
import "tests/anytest.flx"
import "tests/decomposition.flx"
import "tests/intlimits.flx"
import "tests/generics.flx"
import "tests/linkedlist.flx"
import "tests/forloops.flx"
import "tests/arraytest.flx"
import "tests/functions.flx"
import "tests/unions.flx"
import "tests/using.flx"
import "tests/basic.flx"
fn runTests()
{
// fib
let fibTitle = " *** FIBONACII SEQUENCE *** \n"
let fizzbuzzTitle = " *** FIZZBUZZ *** \n"
let intLimitsTitle = " *** PRINTING INT LIMITS *** \n"
let scopeTitle = "*** SCOPE RESOLUTION REGRESSION TEST ***\n"
let operatorTitle = " *** OPERATOR/TUPLE REGRESSION TEST *** \n"
let arrayTitle = " *** ARRAY REGRESSION TEST *** \n"
let genericsTitle = " *** GENERICS REGRESSION TEST *** \n"
let functionsTitle = " *** FUNCTION REGRESSION TEST *** \n"
let classTitle = " *** CLASS REGRESSION TEST *** \n"
let deferTitle = " *** DEFER SEMANTICS TEST *** \n"
let anyTitle = " *** ANY SEMANTICS TEST *** \n"
let slicesTitle = " *** SLICES REGRESSION TEST *** \n"
let decomposeTitle = " *** DECOMPOSITION REGRESSION TEST *** \n"
let forLoopTitle = " *** FOR LOOP REGRESSION TEST *** \n"
let linkedListTitle = " *** LINKED LIST TEST *** \n"
let unionsTitle = " *** UNIONS TEST *** \n"
let usingTitle = " *** USING TEST *** \n"
let miscTitle = " *** MISCELLANEOUS TESTS *** \n"
let basicTitle = " *** BASIC TESTS *** \n"
let thinLine = "----------------------------------------\n"
let endTitle = "============ TESTS COMPLETE ============\n"
std::io::print("%%", fibTitle, thinLine)
do {
var n = 1
while n < 20
{
std::io::print("%", test_fib::doRecursiveFib(n))
n += 1
if n != 20
{
std::io::print(", ")
}
}
std::io::print("\n\n\n")
}
// fizzbuzz
std::io::print("%%", fizzbuzzTitle, thinLine)
test_fizz::doFizzBuzz(15)
std::io::print("\n\n\n")
// int limits
std::io::print("%%", intLimitsTitle, thinLine)
test_limits::printIntegerLimits()
std::io::print("\n\n\n")
// scopes
std::io::print("%%", scopeTitle, thinLine)
test_scopes::doScopeTest("__llvm_jit__build/test")
std::io::print("\n\n\n")
// operators and tuples (vectors type, mainly)
std::io::print("%%", operatorTitle, thinLine)
// doOperatorTupleTest()
std::io::print("\n\n\n")
// arrays
std::io::print("%%", arrayTitle, thinLine)
test_arrays::doArrayTest()
std::io::print("\n\n\n")
// generics
std::io::print("%%", genericsTitle, thinLine)
test_generics::doGenericsTest()
std::io::print("\n\n\n")
// classes
std::io::print("%%", classTitle, thinLine)
test_classes::doClassTest()
std::io::print("\n\n\n")
// first-class-functions
std::io::print("%%", functionsTitle, thinLine)
test_functions::doFunctionTest()
std::io::print("\n\n\n")
// defer semantics
std::io::print("%%", deferTitle, thinLine)
test_defer::doDeferTest()
std::io::print("\n\n\n")
// any
std::io::print("%%", anyTitle, thinLine)
test_any::doAnyTest()
std::io::print("\n\n\n")
// slices
std::io::print("%%", slicesTitle, thinLine)
test_slices::doSlicesTest()
std::io::print("\n\n\n")
// decomposition
std::io::print("%%", decomposeTitle, thinLine)
test_decomposition::doDecompositionTest()
std::io::print("\n\n\n")
// for-loops
std::io::print("%%", forLoopTitle, thinLine)
test_forloops::doForLoopTest()
std::io::print("\n\n\n")
// linked-list (generics)
std::io::print("%%", linkedListTitle, thinLine)
test_linkedlist::doLinkedListTest()
std::io::print("\n\n\n")
// unions (generics)
std::io::print("%%", unionsTitle, thinLine)
test_unions::doUnionsTest()
std::io::print("\n\n\n")
// using
std::io::print("%%", usingTitle, thinLine)
test_using::doUsingTest()
std::io::print("\n\n\n")
// misc tests
std::io::print("%%", miscTitle, thinLine)
// miscellaneousTests()
std::io::print("\n\n\n")
std::io::print("%%", basicTitle, thinLine)
test_basic::doBasicTest()
std::io::print("\n\n\n")
// fin.
std::io::print("%\n\n\n\n\n", endTitle)
}
@entry fn main() -> int
{
runTests()
std::io::print("\n<< done >>\n")
return 0
}
================================================
FILE: build/tests/anytest.flx
================================================
// anytest.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_any
// import "stdio" as _
import libc as _
var glob: any
struct Large
{
a: i64
b: i64
c: i64
d: i64
e: i64
}
public fn doAnyTest()
{
fn foo(a: any)
{
if(a is Large)
{
printf("a = %d\n", (a as Large).a)
glob = a
}
else
{
printf("not large\n")
}
}
do {
var k: any = any(40)
k = "foo"
printf("k as int = %s\n", k as str)
k = 301
printf("k as int = %d\n", k as int)
printf("typeid(k): %d\n", typeid(k))
}
do {
var x: any = Large(10, 20, 30, 40, 50)
var k = x as Large
k.c = 173
k.a = 631
foo(x)
foo(k)
foo(401.3)
fn bar() -> any => any(10)
printf("bar = %d, qux = %d\n", bar() as int, 30)
printf("a = %d, b = %d, c = %d/%x, d = %d, e = %d\n", k.a, k.b, k.c, (x as Large).c, k.d, k.e)
}
}
================================================
FILE: build/tests/arraytest.flx
================================================
// arraytest.flx
// Copyright (c) 2014 - 2015, zhiayang
// Licensed under the Apache License Version 2.0.
export test_arrays
import libc
public fn doArrayTest()
{
do {
var arr: [[int: 2]: 2] = [ [ 1, 2 ], [ 5, 6 ] ]
arr[1][1] = 400
libc::printf("a[0][0]: %d, a[0][1]: %d, a[1][0]: %d, a[1][1]: %d\n", arr[0][0], arr[0][1], arr[1][0], arr[1][1])
var d: [f64: 4] = [ 1.0, 2.0, 4.0, 8.0 ]
libc::printf("d[0]: %f, d[1]: %f, d[2]: %f, d[3]: %f\n", d[0], d[1], d[2], d[3]);
var arr1: &mut int = @raw alloc mut int [4]
arr1[1] = 97
arr1[2] = 43
libc::printf("arr[1] = %d\n", (arr1 + 1)[0])
libc::printf("arr[2] = %d\n", (3 + arr1)[-1])
free arr1
libc::printf("\n\n")
// var s = alloc[4][4] string("array of array of strings test")
// s[1][2] = "BOO YOU STRING"
// libc::printf("s[1][2] = %s, s[1][2].length = %ld\n", s[1][2], s[1][2].length)
// free s
}
libc::printf("\n")
dynamicArrays()
}
fn foldl<T>(arr: [T:], x: T, f: fn(T, T) -> T) -> T
{
if arr.length == 0 => return x
return foldl(arr[1:], f(x, arr[0]), f)
}
fn foldr<T>(arr: [T:], x: T, f: fn(T, T) -> T) -> T
{
if arr.length == 0 => return x
return f(foldr(arr[:$-1], arr[0], f), x)
}
fn f(a: int, b: int) -> int
{
return a * b
}
fn setup(max: int) -> [int]
{
var arr: [int]
var i = 1
while i <= max
{
arr.append(i)
i += 1
}
return arr
}
fn dynamicArrays()
{
do {
libc::printf("PRE X\n")
var x: [string]
libc::printf("POST X\n")
var y = alloc string [5]
var i = 0
x.append(string("aaa") + string("AAA"))
x.append(string("BBB") + string("bbb"))
x.append(string("ccc") + string("CCC"))
x.append(string("DDD") + string("ddd"))
x.append(string("eee") + string("EEE"))
x += y
let k = x
var z = k.clone()
libc::printf("z.length = %d\n", z.length)
z[9] = string("LAST ELEMENT")
libc::printf("z <= x: %d\n", z <= x)
while i < z.length
{
libc::printf("z[%ld] = %s // %ld\n", i, z[i], z[i].refcount)
i += 1
}
libc::printf("z.back() = %s, length = %ld, cap = %ld\n", z[z.length - 1], z.length, z.capacity)
libc::printf("x == k ? %d\n", x == k)
let fib = setup(5)
let sum = foldl(fib, 1, f)
libc::printf("sum = %d\n", sum)
}
}
/*
MAKE:
110 / 195
SHAKE:
107 / 191
FMODULES:
95 / 166
96 / 167
*/
================================================
FILE: build/tests/basic.flx
================================================
// basic.flx
// Copyright (c) 2019, zhiayang, Apache License 2.0.
export test_basic
import libc as _
import std::io as _
// TODO: reorganise these tests if possible
// eg. move them to a more appropriate file? I think some of these might fit.
public fn doBasicTest()
{
// put a default argument here so we can test that.
fn print_array<T>(xs: [T:])
{
for x in xs => print("% ", x)
println()
}
// test logical operators
do {
fn t() -> bool { print("T "); return true }
fn f() -> bool { print("F "); return false }
if t() || f() => println("yes")
if t() && f() => println("no")
printf("\n\n")
}
// test tuple assignment
do {
var (a, b) = (10, 20)
println("a = %, b = %", a, b)
(b, a) = (a, b)
println("swapped: a = %, b = %\n", a, b)
}
// test assignment & appending
do {
do {
var xs: [str] = [ "foo", "bar" ]
xs += "qux"
var ys: [i64] = [ 1, 2, 3, 4 ]
ys += 5 as i64
print_array(xs)
print_array(ys)
}
println()
do {
var xs: [str] = [ "foo", "bar" ]
xs += [ "pepega", "kekw" ]
var ys: [i64] = [ 1, 2, 3, 4 ]
ys += [ 5, 6, 7, 8 ]
print_array(xs)
print_array(ys)
}
println()
do {
var s = string("some string")
s += "_appendage"
var t = string("an underscore: ")
t += '_'
println("s = %", s)
println("t = %", t)
}
}
println()
// test + on non-arithmetics
do {
let a = string("hello ") + "world"
println("a = %", a)
let b = string("an asterisk: ") + '*'
println("b = %\n", b)
let c: [int] = [ 2, 3, 5, 7 ]
let d: [int] = [ 11, 13, 17, 19 ]
print_array(c + d)
}
println()
// test builtin functions on aggregate data types
do {
var a: [int] = [ 2, 3, 5, 7 ]
print("% : ", a.pop())
print_array(a)
var b: [int: 3] = [ 1, 4, 9 ]
// drop to printf for %p support
printf("b.ptr = %p, b.length = %d\n\n", b.ptr, b.length)
var s = string("thank you ございました")
println("\"%\".count = % (expect 16)\n", s, s.count)
var r = 0...10 step 2
for i in r => print("% ", i)
println("\nstart: %, end: %, step: %", r.begin, r.end, r.step)
var c: any = 30
println("c.typeid = %, c.refcount = %", c.id, c.refcount)
enum E: u32
{
case ONE = 100
case TWO = 200
}
var e = E::TWO
println("e.index = %, e.value = %, e.name = %", e.index, e.value, e.name)
}
println()
// other strange things
do {
struct Foozle
{
x: fn(int) -> int
fn foo() -> int
{
return x(30)
}
}
fn triple(x: int) -> int => x * 3
let f = Foozle(x: triple)
println("f = %", f.foo())
let g = triple
println("g(76) = %", g(76))
}
println()
}
// well just a test.
#run println("** hello, world!")
================================================
FILE: build/tests/classes.flx
================================================
// classes.flx
// Copyright (c) 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export test_classes
import libc as _
ffi fn srand(s: i32)
ffi fn rand() -> i32
let names = [ "max", "ollie", "coco", "piper", "tim", "bill", "alex", "ron", "isaac", "jim" ]
class Animal
{
init(w: f64)
{
// printf("make animal w = %f\n", w)
weight = w
name = names[rand() % names.length]
}
virtual fn makeNoise()
{
printf("some generic sound\n")
}
var name: str
var weight: f64
var cute: bool = true
}
class Dog : Animal
{
init() : super(w: 300)
{
// printf("make dog (w = %f)\n", weight)
}
override fn makeNoise()
{
printf("bark bark (%f)\n", weight)
}
virtual fn wag()
{
printf("wagging tail of length %d\n", tail)
}
var tail: int = 37
}
class Dalmation : Dog
{
init() : super()
{
printf("make dalmation\n")
}
override fn wag()
{
printf("dalmation wags %d\n", tail)
}
var numSpots: int
}
public fn doClassTest()
{
do {
// don't question.
srand(2848131)
let dogs = alloc &Dog [10] {
if i % 3 == 1 => it = alloc Dalmation
else => it = alloc Dog
if i % 2 == 1 => (it as mut).tail = i + 1 * 3
}
for dog, i in dogs {
printf("%d: %s: \t", i, dog.name)
dog.wag()
}
}
}
================================================
FILE: build/tests/decomposition.flx
================================================
// decomposition.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_decomposition
import libc as _
public fn doDecompositionTest()
{
do {
printf("\n\n>> tuple decomposition\n")
let tup = (10, 20, 30)
let (x, &y, _) = tup
printf("x = %d, y = %d\n", x, y == null)
let (a, (b, c, _, _)) = ("a", (30, 40, 50, 60))
printf("a = '%s', b = %d, c = %d\n", a, b, c)
}
do {
printf("\n>> array decomposition\n")
var arr = [ 2, 3, 5, 7, 11, 13, 17 ]
var [ a, &b, &c, ... &x ] = arr
*(b as mut) = 30
printf("a = %d, b = %d, c = %d, d = %d, e = %d (x.length = %d)\n", a, *b, c == null, x[0], x[1], x.length)
do {
var arr2: [str]
arr2.append("hello")
arr2.append("world")
arr2.append("bouys")
let [ a, ... &b ] = arr2
// can bind directly, if you're that kind of person...
let [ ... &c ] = arr2
printf("a = %s, b = %d, c = %d\n", a, b.length, c.length)
}
do {
printf("\n>> string decomposition\n")
let longstring = "In the event of unexpected shutdown, all personnel are to evacuate the area immediately.\n\n"
let [ a, b, c, ... &chars ] = longstring
printf("a = '%c', b = '%c', c = '%c'\n", a, b, c)
// this should not, and thankfully, does not, work.
// chars[3] = char("$")
var k = 0
while k < chars.length
{
printf("%c", chars[k])
k += 1
}
}
}
}
================================================
FILE: build/tests/defertest.flx
================================================
// defer.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_defer
import libc as _
public fn doDeferTest()
{
bar()
}
fn foo(x: int) -> int
{
printf("calling foo %d\n", x)
return 2 * x
}
fn bar() -> int
{
// numbered by *correct* order of appearance.
// defer should execute after the return.
foo(1)
defer foo(3)
return foo(2)
}
================================================
FILE: build/tests/fizzbuzz.flx
================================================
// fizzbuzz.flx
// Copyright (c) 2014 - 2015, zhiayang
// Licensed under the Apache License Version 2.0.
export test_fizz
import libc
public fn doFizzBuzz(num: int)
{
var i = 0
while i <= num
{
libc::printf("%02d: ", i)
if i % 3 == 0
{
libc::printf("Fizz")
}
if i % 5 == 0
{
libc::printf("Buzz")
}
if i % 5 != 0 && i % 3 != 0
{
libc::printf("%d", i)
}
libc::printf("\n")
i += 1
}
}
================================================
FILE: build/tests/forloops.flx
================================================
// forloops.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_forloops
import libc as _
public fn doForLoopTest()
{
do {
printf("\n>> ranges\n")
let r1 = 0 ... 3
let r2 = 0 ..< 1
printf("r1.l = %d, r1.u = %d\n", r1.begin, r1.end)
printf("r2.l = %d, r2.u = %d\n\n", r2.begin, r2.end)
for i, j in r1
{
printf("%d: i = %d\n", j, i)
}
}
do {
printf("\n>> for-in array\n")
let x = [ (1, "a"), (2, "b"), (3, "c"), (4, "d") ]
let fixed: [(int, int): 3] = [ (10, 2), (7, 3), (3, 2) ]
for (a, b), i in x
{
printf("%d: %d / %s\n", i, a, b)
}
}
do {
printf("\n>> for-in string\n")
for c, i in "woohoo"
{
printf("%d: '%c', ", i, c)
}
printf("\n")
}
}
================================================
FILE: build/tests/functions.flx
================================================
// functions.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_functions
import libc as _
fn foo(a: int) { printf("foo: %d\n", a) }
fn bar(a: int) { printf("bar: %d\n", a) }
fn qux() { ("qux\n") }
class SomeClass
{
init() { }
fn foo(a: int) { printf("foo in class: %d\n", a) }
static fn bar(a: int) { printf("static bar in class: %d\n", a) }
}
namespace SomeNS
{
fn foo(a: int) { printf("foo in namespace: %d\n", a) }
class NestedClass
{
init() { }
fn foo(a: int) { printf("foo in nested class: %d\n", a) }
static fn bar(a: int) { printf("static bar in nested class: %d\n", a) }
// fn mgen<T>(a: T) -> T { printf("method generic: %p // %d\n", self, a) }
// static fn smgen<T>(a: T) -> T { printf("static generic: %d\n", a) }
}
// fn ngen<T>(a: T) -> T { printf("namespace generic: %p // %d\n", a) }
}
fn gen<T>(a: T) -> T
{
if(typeid(a) == typeid(int)) => printf("int: %d\n", a)
else if(typeid(a) == typeid(f64)) => printf("float: %lf\n", a)
return a + 1
}
fn et(a: int)
{
printf(" %d", a)
}
fn et1(a: int) -> int
{
printf(" %d", a)
return a
}
class SomeStruct
{
init() { }
var f: fn(&SomeStruct, int) -> int
fn fun(a: string) -> int
{
printf("method: %s\n", a)
return 40
}
static fn sfn(self: &SomeStruct, a: int) -> int
{
printf("static: %d\n", a);
return a;
}
}
public fn doFunctionTest()
{
var f = qux
f()
var g = foo
g(10)
g = bar
g(20)
printf("each test:")
let arr = (alloc int[4])[:].ptr
arr[0] = 11
arr[1] = 22
arr[2] = 33
arr[3] = 44
each(arr, 4, et)
printf("\n\nscope test\n")
do {
g = SomeClass::bar
g(10)
g = SomeNS::NestedClass::bar
g(20)
g = SomeNS::foo
g(30)
}
printf("\nmethod test\n")
do {
var method = SomeClass::foo
let sc = SomeClass()
method(&sc, 40)
var method2 = SomeNS::NestedClass::foo
let nc = SomeNS::NestedClass()
method2(&nc, 50)
}
// printf("\ngeneric test\n")
// do {
// var gf: [(int) -> int] = gen
// var gff: [(f64) -> f64] = gen
// gf(100)
// gff(3.1415926536)
// // gf = SomeNS.ngen
// gf(200)
// // reassignment
// printf("\nclass test\n")
// do {
// var gf2: [(int) -> int] = et1
// printf("et:"); gf2(300); printf("\n")
// gf2 = gen
// gf2(400)
// var s = SomeStruct()
// let gf3 = SomeStruct.sfn
// gf3(&s, 500)
// s.f = gf3
// let gf4 = s.f
// gf4(&s, 600)
// printf("\ngeneric member test\n")
// let gf5: [(int) -> int] = SomeNS.NestedClass.smgen
// gf5(10)
// var gf6: [(SomeNS.NestedClass*, int) -> int]
// gf6 = SomeNS.NestedClass.mgen
// let nc = SomeNS.NestedClass()
// gf6(&nc, 10)
// printf("\ndirect field calling\n")
// let res1 = s.f(&s, 10)
// }
// }
}
fn each(arr: &int, length: int, f: fn(int) -> void)
{
var i = 0
while i < length
{
f(arr[i])
i += 1
}
}
================================================
FILE: build/tests/generics.flx
================================================
// generics.flx
// Copyright (c) 2014 - 2015, zhiayang
// Licensed under the Apache License Version 2.0.
export test_generics
import libc as _
public fn doGenericsTest()
{
// some normal FP stuff
fn map<T, U>(arr: [T:], fun: fn(T) -> U) -> [U]
{
var ret: [U]
for it in arr => ret.append(fun(it))
return ret
}
do {
printf("set 1:")
fn twice<K>(a: K) -> K => a * 2
let new = map(fun: twice, arr: [ 1, 2, 3, 4, 5 ])
for it in new { printf(" %d", it) }
printf("\n")
}
do {
printf("set 2:")
fn twice(a: str) -> string => string(a) + string(a)
let new = map([ "a", "b", "c", "d", "e" ], twice)
for it in new => printf(" %s", it)
printf("\n")
}
do {
printf("set 3:")
fn square<T, U>(a: T) -> U => (a * a)
let new: [f64] = map([ 7.3, 8.7, 9.1, 10.4, 11.6 ], square)
for it in new { printf(" %.2f", it) }
printf("\n")
}
do {
fn gincr<A>(x: A) -> A => x + 1
fn apply<B, C>(x: B, f: fn(B) -> C) -> C => f(x)
fn mapstupid<D, E, F>(arr: [D:], f: fn(D) -> E, fa: fn(D, fn(D) -> E) -> F) -> [F]
{
var i = 0
var ret: [F]
while i < arr.length
{
ret.append(fa(arr[i], f))
i += 1
}
return ret
}
printf("set 4:")
let new = mapstupid([ 5, 6, 7, 8, 9 ], gincr, apply)
for it in new { printf(" %d", it) }
printf("\n")
}
do {
fn map2<T, K, R>(arr: [(T, K):], f: fn(T, K) -> R) -> [R]
{
var i = 0
var ret: [R]
while i < arr.length
{
ret.append(f(arr[i].0, arr[i].1))
i += 1
}
return ret
}
fn add2<A, B>(x: A, y: B) -> A => x + y
printf("set 5:")
let new = map2([ (2, 2), (4, 4), (6, 6), (8, 8), (10, 10) ], add2)
for it in new { printf(" %d", it) }
printf("\n")
}
do {
fn prints<T, U>(m: T, a: [U: ...])
{
for x in a => printf(" %.2d", m * x)
}
printf("set 6:")
let xs = [ 1, 2, 3, 4, 5 ]
prints(3, ...xs)
printf("\n")
}
}
================================================
FILE: build/tests/intlimits.flx
================================================
// intlimits.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_limits
import libc
import std::limits
public fn printIntegerLimits()
{
libc::printf(" i8::min = %hhd\t\t\t i8::max = %hhd\n", std::limits::int8::min, std::limits::int8::max);
libc::printf("i16::min = %hd\t\t\ti16::max = %hd\n", std::limits::int16::min, std::limits::int16::max);
libc::printf("i32::min = %d\t\t\ti32::max = %d\n", std::limits::int32::min, std::limits::int32::max);
libc::printf("i64::min = %lld\ti64::max = %lld\n", std::limits::int64::min, std::limits::int64::max);
libc::printf("\n")
libc::printf(" u8::min = %hhu\t\t\t\t u8::max = %hhu\n", std::limits::uint8::min, std::limits::uint8::max);
libc::printf("u16::min = %hu\t\t\t\tu16::max = %hu\n", std::limits::uint16::min, std::limits::uint16::max);
libc::printf("u32::min = %u\t\t\t\tu32::max = %u\n", std::limits::uint32::min, std::limits::uint32::max);
libc::printf("u64::min = %llu\t\t\t\tu64::max = %llu\n", std::limits::uint64::min, std::limits::uint64::max);
}
================================================
FILE: build/tests/linkedlist.flx
================================================
// linkedlist.flx
// Copyright (c) 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export test_linkedlist
import libc as _
class LinkedList<T>
{
struct Node
{
prev: &Node
next: &Node
data: T
}
var head: &Node
var tail: &Node
var count: int
init(data: T)
{
printf("called init\n")
}
mut fn insert(thing: T)
{
var nn = alloc mut Node (data: thing, prev: null, next: null)
if head == null { head = nn; tail = nn }
else
{
var ot = tail as mut
tail = nn
nn.prev = ot
ot.next = nn
}
count += 1
}
static fn hello() { printf("hi\n"); }
}
public fn doLinkedListTest()
{
do {
var list = LinkedList(data: 41)
LinkedList!<int>::hello()
var list2 = LinkedList(data: "foo")
list2.insert("hello")
list2.insert("world")
list.insert(10)
list.insert(20)
list.insert(30)
list.insert(40)
do {
var head = list.head
while(head)
{
printf("%d\n", head.data)
head = head.next
}
}
do {
var head = list2.head
while(head)
{
printf("%s\n", head.data)
head = head.next
}
}
}
}
================================================
FILE: build/tests/misc.flx
================================================
// misc.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
class TestingClass
{
init(x: int)
{
self.thing = x
}
var thing: int
}
extension TestingClass : StringConvertible, Equatable
{
fn toString() -> string { "hello" }
operator == (a: TestingClass) -> bool
{
return self.thing == a.thing
}
}
fn cts<T : StringConvertible>(thing: T) -> string
{
return thing.toString()
}
fn pt<T>(a: T, b: &T) -> T
{
return a
}
fn vt<T>(b: T[...])
{
var i = 0
while i < b.length
{
printf("%d\n", b[i])
i += 1
}
}
fn vt2<T>(a: T, b: int[...])
{
// do something.
variadicTest(a, b)
}
@nomangle fn mtest(k: int, g: int)
{
printf("(%d, %d)\n", k, g)
let x = TestingClass(10)
let y = TestingClass(20)
let g = 10
pt(10, &g)
vt(10, 30, 40, 50, 60)
vt2("hi", 1, 2, 3, 4)
printf("%d, (%s, %s, %s, %s)\n", x == y, cts(k), cts(x), cts(g), cts(y))
}
// although it would be possible to move the slipshod array system into a generic Array<> thing, once it's implemented
// sidenote: oh look, it works for arbitrary types.
// sometimes, i'm impressed by the things i've implemented.
// i think this form of varargs should *stay*, since it's basically a compiler primitive.
// once we have an Array<> type, then it'd be as simple as having the Array<T> class define an initialiser with T[...],
// since we can forward LLVarArrays effortlessly. then it's as easy as let arr = Array(b), and you can have all the Array<> class
// niceties with varargs, without compromising freestanding functionality.
// imho it's not worth it to have the compiler do the same thing as with String, because 1. String is not generic, and 2. varargs isn't
// a "core" language feature, so to speak.
public fn variadicTest(a: string, b: int[...])
{
printf("%s: [", a)
var i = 0
while i < b.length
{
printf("%d", b[i])
i += 1
if i != b.length { printf(", ") }
}
printf("]\n")
}
extension string
{
// static fn withRaw(r: int8*) -> string
// {
// var s: string
// let len = strlen(r)
// s.raw = malloc(len + 8 + 1)
// }
}
public fn miscellaneousTests()
{
mtest(10, 41)
do {
var bar = (10, 20)
var foo: &&(&&(&&(float, float)[10])[3])
}
do {
var g = "439"
let k = g.toInteger()
printf("%s, %d\n", g, k)
}
do {
printf("'4' is digit: %d\n", char("5").isDigit())
}
do {
struct winsize
{
var row: u16
var col: u16
var xpixel: u16
var ypixel: u16
}
var ws: winsize
ioctl(1, 1074295912 as u64, &ws)
printf("terminal size: %hdx%hd (chars), %hdx%hd (pixels)\n", ws.col, ws.row, ws.xpixel, ws.ypixel)
}
do {
fn test() -> string
{
return "hello!"
}
let s = string("hello")
string("hello").raw
printf("test = %p %d\n", test().raw, i64(10))
}
do {
if let k = 30; k > 27
{
printf("(if-let) k > 27\n")
}
}
do {
enum SomeEnum
{
case Up
case Down
case Left
case Right
}
struct Foop
{
var x: int
}
class Barf
{
static var y: int = 40
static var fkr: int
{
get { 30 }
}
fn foo() -> f64
{
43.1
}
}
let e = SomeEnum.Down
let f = Foop(10)
let barf = Barf()
let fo = barf.foo
printf("f.x = %d, b.c = %d, fo = %d\n", f.x, 3, Barf.y)
let tup = ("a", (30, 40, 50, 60))
let k = tup.1.1
printf("k = %d\n", k)
let s = "some string \
broken over \
multiple lines"
printf("s = %s\n", s)
printf("%d, %.7lf\n", k, +3.000141);
}
do {
fn foo<T>(a: T[], b: T) { }
fn bar<T>(a: T, b: T[]) { }
bar(10, [ ])
foo([ ], 20)
var z: int[:]
struct Test
{
var a: int
var b: int
}
let ta = Test(10, 10)
let tb = Test(10, 10)
printf("> %d / %d / %d <\n", sizeof(Test), sizeof(ta), sizeof(&ta))
printf("ta == tb: %d\n", ta == tb)
}
variadicTest("ints", 10, 20, 30, 40, 50, 60)
}
================================================
FILE: build/tests/operators.flx
================================================
// operators.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
import Math
import Foundation
class CPTest
{
var readwrite: int
{
get { printf("READ\n"); return 31 }
set { printf("WRITE: %d\n", value) }
}
}
public fn doOperatorTupleTest()
{
do {
let g: i8 = 100
printf("g is: %d\n", g)
}
do {
let m = (fa(), fb())
printf("m is [(%f, %f, %f), (%f, %f, %f)]\n", m.0.x, m.0.y, m.0.z, m.1.x, m.1.y, m.1.z)
let dot = m.0 • m.1
printf("dot = %f\n", dot);
let v1 = Math.Vector3(1.0, 2.0, 4.0)
let v2 = Math.Vector3(3.0, 6.0, 9.0)
var v = v1 + v2
printf("v: (%f, %f, %f)\n", v.x, v.y, v.z)
v += v1
v = v1 + v2 + v1
let vv = 3 * v
printf("v: (%f, %f, %f)\n", v.x, v.y, v.z)
printf("vv: (%f, %f, %f)\n", vv.x, vv.y, vv.z)
let cross = m.0 ⨯ m.1
printf("cross = (%f, %f, %f)\n", cross.x, cross.y, cross.z)
let crossn = m.1 ⨯ m.0
printf("crossn = (%f, %f, %f)\n", crossn.x, crossn.y, crossn.z)
}
do {
// var args = alloc[10] Any
// args[0] = "HELLO"
// #(args + 1) = 40
// args[2] = "GOODBYE"
}
do {
let v1 = Math.Vector2(1.0, 4.0)
let v2 = Math.Vector2(3.0, 7.0)
let vr = v1 ⨯ v2
printf("(%.2f), vr = %.2f\n", v1 • v2, vr)
var lol: string = "HELLO"
printf("%c\n", lol[1])
printf("lol[2]: %c // %s\n", lol[1], lol)
}
}
fn fa() -> Math.Vector3
{
var ret: Math.Vector3
ret.x = 1
ret.y = 2
ret.z = 3
return ret
}
fn fb() -> Math.Vector3
{
var ret: Math.Vector3
ret.x = 4
ret.y = 5
ret.z = 6
return ret
}
================================================
FILE: build/tests/recursiveFib.flx
================================================
// recursiveFib.flx
// Copyright (c) 2014 - 2015, zhiayang
// Licensed under the Apache License Version 2.0.
export test_fib
fn doRecursiveFib(n: int, v: int, prev: int) -> int
{
if n == 0 { return prev }
if n == 1 { return v }
return doRecursiveFib(n - 1, v + prev, v)
}
public fn doRecursiveFib(n: int) -> int
{
return doRecursiveFib(n, 1, 0)
}
================================================
FILE: build/tests/scopes.flx
================================================
// scopes.flx
// Copyright (c) 2014 - 2015, zhiayang
// Licensed under the Apache License Version 2.0.
export test_scopes
import libc as _
import std::math
@operator[prefix, 900, √]
operator prefix √ (x: f64) -> f64 { return math::sqrt(x) }
class Orr
{
init() { }
static var Another = 76
var bar: int = 371
}
class Something
{
init() { }
fn somefoo() -> Orr => Orr()
static var Or: Orr
var oor: int = 400
class Inside
{
init() { }
fn insideFoo() -> int => 10
static fn staticInside() -> int => 23
static var Another = 511
}
enum InsideEnum : i64
{
case None
case Single
case Double
case Triple
case Quadruple
case Quintuple
case Hextuple
}
}
enum OutsideEnum : i64
{
case Zero
case One
case Two
case Three
case Four
}
enum StrongEnum : i64
{
case Red
case Green
case Blue
}
class Sheep
{
init() { }
var thing: int = 43
var foo: Something
static var afoo: Something
}
namespace n1
{
namespace n2
{
var m: Sheep
var tup: (str, int)
fn nest() -> (str, int)
{
printf("nested\n");
return ("TUPLE ONE", 591)
}
class DeepClass
{
init() { }
class DeeperClass
{
init() { }
static fn deepStatic() -> int => 23
}
}
}
}
public fn doScopeTest(argv: str)
{
let p = 64.4 ÷ 4.1
let m = √(41.5)
let mmx = Something::Inside::Another
let another = 4
let foo = Something()
let mm = foo.somefoo().bar
let gg = (4, 100.39)
printf("gg.0: %d, gg.1: %.2f\n", (4, 50).0, gg.1)
printf("[%d]\n", foo.oor)
printf("p: %f, g: %d, m: %d, %.14f\n\n", p, another, mmx, math::π)
let x1: int = OutsideEnum::Three as int
let x2: int = Something::InsideEnum::Quadruple as int
let x3 = n1::n2::DeepClass::DeeperClass()
printf("x1: %d, x2: %d, x3: %d\n", x1, x2, n1::n2::DeepClass::DeeperClass::deepStatic())
n1::n2::m.foo.oor = 968
printf("oor = %d\n", n1::n2::m.foo.oor)
let t1 = n1::n2::m.foo.somefoo().bar
let t2 = n1::n2::nest().0.length
n1::n2::tup.0 = "HELLO, WORLD!" //string("HELLO, WORLD") + "!"
printf("tup: %s\n", n1::n2::tup.0)
printf("t1 = %d, t2 = %d\n", t1, t2)
printf("afoo: %d\n", Sheep::afoo.somefoo().bar)
}
================================================
FILE: build/tests/slices.flx
================================================
// slices.flx
// Copyright (c) 2014 - 2016, zhiayang
// Licensed under the Apache License Version 2.0.
export test_slices
import libc
public fn doSlicesTest()
{
do {
var arr = [ 2, 3, 5, 7, 11, 13, 17 ]
let slice = arr[:]
libc::printf("-- %d, %d, %d, %d, %d, %d, %d --\n", slice[0], slice[1], slice[2], slice[3], slice[4], slice[5], slice[6])
let s = "Hello, world!"
libc::printf("original: %s\nslice: %.*s\n", s, s[3:10].length, s[3:10])
}
}
@entry fn main()
{
doSlicesTest()
}
================================================
FILE: build/tests/unions.flx
================================================
// unions.flx
// Copyright (c) 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export test_unions
import libc as _
union option<T>
{
some: T
none
}
@raw union ipv4
{
_: struct {
_: @raw union {
bytes2: [u8: 4]
raw3: u32
}
}
_: struct {
bytes: [u8: 4]
}
_: struct {
raw2: u32
}
raw: u32
}
public fn doUnionsTest()
{
do {
let x = option::some("foobar")
let y = option::some(456)
printf("x = %s, y = %d\n", x as option!<str>::some, y as option!<int>::some)
}
do {
union Bar
{
some: str
other: int
none
}
let q = Bar::some("hello")
let v = Bar::other(30)
let m = Bar::none
printf("q = %s, v = %d\n", q as Bar::some, v as Bar::other)
}
do {
var addr: ipv4
addr.raw3 = 0xff01a8c0;
printf("%d.%d.%d.%d\n", addr.bytes[0], addr.bytes[1], addr.bytes[2], addr.bytes[3]);
}
}
================================================
FILE: build/tests/using.flx
================================================
// using.flx
// Copyright (c) 2017, zhiayang
// Licensed under the Apache License Version 2.0.
export test_using
import libc as _
public fn doUsingTest()
{
do {
enum Foo: int
{
case Alpha = 10
case Bravo = 20
case Charlie = 30
}
using Foo as _
printf("a = %d, b = %d, c = %d\n", Alpha.value, Bravo.value, Charlie.value)
using Foo as f
printf("a = %d, b = %d, c = %d\n", 3 * f::Alpha.value, 3 * f::Bravo.value, 3 * f::Charlie.value)
}
do {
class xxx<T>
{
init() { }
var k: T
enum Foo: int
{
case Alpha = 71
case Bravo = 72
case Charlie = 73
}
}
using xxx!<int>::Foo as _
printf("a = %d, b = %d, c = %d\n", Alpha.value, Bravo.value, Charlie.value)
}
do {
union Option<T>
{
some: T
none
}
using Option as _
let x = some(381)
let y = some("hi")
printf("x = %d, y = %s\n", x as some, y as some)
}
do {
union Option<T>
{
some: T
none
}
using Option!<T: int> as _
using Option!<str> as _
let x = some(30)
let y = some("bye")
printf("x = %d, y = %s\n", x as some, y as some)
}
}
================================================
FILE: build/tiniest.flx
================================================
// tiniest.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
import libc
class wrapper<T>
{
init()
{
}
static fn method<U>(a: T, b: U)
{
libc::printf("t = %d, u = %d\n", typeid(a), typeid(b));
}
}
@entry fn main()
{
wrapper::method(1, "asdf")
libc::printf("hello, world\n")
}
================================================
FILE: build/tmp/repro_1.flx
================================================
// repro_1.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
/*
import libc as _
// import repro_2 as _
import repro_2
import std::limits as lim
using repro_2 as _
@entry fn main()
{
class Foozle
{
init() { }
static fn alpha() { }
class Flub
{
init() { }
static fn beta() { }
static fn omega() { printf("owo\n") }
};
}
printf("four = %d\n", Foo::FOUR.value);
printf("hello\n");
using Foozle::Flub as Flubzle
Flubzle::omega();
printf("%d\n", Bar::bla(3));
printf("lmao\n");
let x = lim::int16::max;
printf("x = %x\n", x);
// let c = "a" + "b"
}
*/
import libc
import repro_3
// using libc as _
@entry fn main2()
{
// std::io::println("owo")
// owo::println("owo")
// uwu::owo::foozle()
// printf("owo\n")
repro_3::foozle(10)
}
================================================
FILE: build/tmp/repro_2.flx
================================================
// repro_2.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
public enum Foo: i32
{
case ONE = 1
case TWO = 2
case FOUR = 4
}
public class Bar
{
init() { }
static fn bla(x: int) -> int => x * x
}
================================================
FILE: build/tmp/repro_3.flx
================================================
// repro_3.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
// public import libc as _
import libc
fn foozle(x: int, y: int) -> int
{
return x * y
}
public fn foozle(x: int)
{
foozle(x, x + 2)
// libc::printf("asdf %d\n", foozle(x, x + 2));
}
================================================
FILE: build/tmp2/a.flx
================================================
// a.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
import libc as _
@entry fn main()
{
// let x = bazzle() * 2
// foozle(3)
var i = 0
while true
{
defer { i += 1 }
if i < -30 => break
else if i > 10 => break
printf("i = %d\n", i)
}
}
================================================
FILE: build/tmp2/b.flx
================================================
// b.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
<<<<<<< Updated upstream
public import c as _
public fn bazzle() -> int => 30
=======
public let INIT_TIMER: u32 = 0x00000001
public let INIT_AUDIO: u32 = 0x00000010
>>>>>>> Stashed changes
================================================
FILE: build/tmp2/c.flx
================================================
// c.flx
// Copyright (c) 2020, zhiayang
// Licensed under the Apache License Version 2.0.
<<<<<<< Updated upstream
export c
ffi fn printf(fmt: &i8, ...) -> int
public fn foozle(x: int)
{
printf("hello, world! (%d)\n", x)
}
=======
>>>>>>> Stashed changes
================================================
FILE: build/ultratiny.flx
================================================
// ultratiny.flx
// Copyright (c) 2019, zhiayang
// Licensed under the Apache License Version 2.0.
export ultratiny
import libc as _
import std::io as _
// import std::math
@compiler_support["raii_trait::drop"] trait Drop { fn deinit() }
@compiler_support["raii_trait::copy"] trait Copy { fn copy(other: &self) }
@compiler_support["raii_trait::move"] trait Move { fn move(other: &mut self) }
class Foo1
{
init() { }
deinit { printf("killed base\n"); }
}
class Foo : Foo1, Drop, Copy, Move
{
var data: int
init(x: int) : super()
{
printf("of make (%d)\n", x)
this.data = x
}
// fn deinit()
// {
// printf("is kill (%d)\n", data)
// }
fn copy(other: &self)
{
this.data = other.data
printf("am copy (%d)\n", data)
}
fn move(other: &mut self)
{
this.data = other.data
other.data = 0
printf("be move (%d)\n", data)
}
}
class Bar
{
var data: int
init(x: int)
{
this.data = x
}
}
fn one() -> Foo
{
return Foo(x: 33)
}
fn two(x: Foo)
{
printf("x.data = %d\n", x.data)
}
@entry fn main()
{
let q = one()
q.data = 17
two(q)
printf("q = %d\n", q)
}
/*
raii traits checklist:
problem with deinit: in any given class implementation, the user-defined deinit *needs* to call both:
(a) the inline destructor for the class
(b) the user-defined destructor for the base class
(c) the inline destructor for the base class
so this is a bunch of work that isn't done? also, in the base class case, the derived class cannot properly
define a deinit() function, because of redefinitions. what's the solution?
(1) everything becomes virtual (ew)
(2) method hiding (also ew)
(3) ???
3. remove the copy/move/destruct stuff from FIR?
*/
================================================
FILE: changelog.md
================================================
# Partial Changelog
### 2018-12-09 `(1350296)`
- fix a refcounting bug where things were getting freed too early. the cause of this bug is when we transitioned to the lvalue system, around
`24addf2`, when we added arguments to the refcounting stack; we forgot to include a corresponding increment in the call argument codegen, which
has since been rectified.
---
### 2018-12-08 `(201a2ce)`
- allow `::` to refer to the topmost scope, like in C++
- allow `^` at any location in the scope path to refer to the parent scope -- eg. `::qux::^::foo::^::bar` (naturally will fail at the root scope!)
- for some reason, added a more verbose error message when you try to use a value as a type -- it searches up the tree for an actual type with the name,
and tells you how to refer to it -- using the parent-scope specifier mentioned above.
---
### 2018-12-07 `(621aea2)`
- add location info to `pts` types -- which will soon need to be carried over to `fir` -- probably some kind of `TypeLocator` struct that I have in mind.
- abstract away which `hash_map` we use -- preliminary tests show `ska::flat_hash_map` gives us a ~9% perf improvement across-the-board -- using the
`massive.flx` and associated test framework.
---
### 2018-12-06 `(aa33f64)`
- add a flag to call `abort()` on error -- now the default behaviour is to `exit(-1)`.
---
### 2018-12-06 `(f04726c)`
- fixed our `std::map` implementation a bit
- calls to `malloc` should go through our new malloc wrapper which checks for `null` returns
- hoist `make_lval` similar to `alloca` -- was causing stack overflow issues!
- apply type transforms (`poly/transforms.cpp`) in reverse, duh! surprised we didn't run into this sooner.
- fix an oversight where we allowed variables to be 'used' in nested functions (due to the scoping rules implicitly), and let it slip to llvm-land (!)
---
### 2018-12-05 `(3119634)`
- fixed a bug where we failed to infer union types -- was just checking the wrong thing.
- add a check for unwrapping (with `as`) union values to variants with no values (eg. `opt::none`)
- fixed a bug where we were not checking for duplicates when adding unresolved generic defns and operator overloads.
---
### 2018-12-04 `(2dbb858)`
- fix omission of floating-point comparison ops (oops)
- further patches to merge-block-elision
- fix ir-block error when doing multiple logical operators (`&&` and `||`)
- `is` check parses its rhs-operand the same way as `as` now (aka properly!)
- add the concept of `realScope`, which is the original scope of a definition -- aka where it got defined. we need this idea because we can call `ast::typecheck()` from *any* scope, usually when instantiating generics
- clean up string output to use `::` for scopes instead of `.`
- change the criteria of finding an existing definition (for generic things) to only match the last N items of the current
state with the stored state -- instead of the previous vice-versa situation. (ie. the current state can be smaller than the stored state)
- add a distance penalty for resolving a generic function, also add a check where we don't re-add a function twice (eg. when recursively calling a
generic function)
- `ast::Block`s now push an anonymous scope -- no idea why they didn't. fixes a pretty massive bug where bodies of an if statement shared the same scope
- probably some other misc fixes i forgot
---
### 2018-12-02 `(05b3953)`
- fix a using bug (`d1a0efe`)
- clean up the generated IR blocks, and implement 'merge-block-elision' properly (`76481a2`)
- fix implicit method calls (that i forgot to fix after refactoring the self-handling previously)
---
### 2018-12-01 `(076e176)`
- allow `export`-ing a path, eg. `std::limits`. this is different from namespacing the entire file (unlike C++), because we would then
get `limits::std::...` instead
- allow `import`-ing a path as well, so we can do `import std::limits as foo::bar::qux`.
- `import`s of string paths (eg. `import "foo/bar"`) no longer append an `.flx` extension automatically!
---
### 2018-11-06 `(59f8469)`
- flip the declaration of `ffi-as` so the external name is after `as` -- and now as a string literal (because your external names might have
flax-illegal characters inside)
---
### 2018-11-06 `(a2721fc)`
- declare foreign functions `as` something -- useful for OpenGL especially, (1) to deduplicate the `gl` prefix, and (2) to allow overloading of all
the different `glVertex<N><T>` where `N = 2, 3, 4`, `T = i, f, d` or something.
---
### 2018-11-06 `(e2f235b)`
- `public` and `private` imports, where the former re-exports things and the latter is the default behaviour.
---
### 2018-11-05 `(494a01e)`
- static access now uses `::` instead of `.`, along the veins of C++ and Rust.
- polymorph instantiations now take the form of `Foo!<...>` (the exclamation mark) -- making it less likely to be ambiguous.
- polymorph arguments can now be positional, meaning `Foo!<int>` instead of `Foo!<T: int>`. The rules are similar to that of funtion calls
-- no positional arguments after named arguments.
---
### 2018-10-28 `(0b937a5)`
- add chained comparison operators, eg. `10 < x < 30` would *succinctly* check for `x` between 10 and 30.
- consequently, changed the precedence for all six comparison operators (`==`, `!=`, `<`, `<=`, `>`, and `>=`) to be the same (500)
---
### 2018-10-28 `(f7fd4e6)`
- using unions -- including both generic and instantiated unions
- vastly improved (i'd say) inference for variants of unions (when accessing them implicitly)
---
### 2018-10-27 `(e365997)`
- infer polymorphs with union variants (except singleton variants)
- clean up some of the `TypecheckState` god object
- fixed a number of related bugs regarding namespaced generics
- give polymorphic types a `TypeParamMap_t` if there was a `type_infer`
---
### 2018-10-05 `(9de42cb)`
- major revamp of the generic solver -- the algorithm is mostly unchanged, but the interface and stuff is reworked.
- finally implemented the iterative solver
- variadic generics work
- took out tuple splatting for now.
---
### 2018-07-31 `(efc961e)`
- generic unions, but they're quite verbose.
---
### 2018-07-29 `(e475e99)`
- add tagged union types, including support for `is` and `as` to check and unwrap respectively
- infer type parameters for a type from a constructor call
---
### 2018-07-23 `(c89c809)`
- fix the recursive instantiation of generic functions.
---
### 2018-07-23 `(ff2a45a)`
- no longer stack allocate for arguments
- new lvalue/rvalue system in the IRBuilder, to make our lives slightly easier; we no longer need to pass a value/pointer pair,
and we handle the thing in the translator -- not very complicated.
- add `$` as an alias for `.length` when in a subscript or slicing context, similar to how D does it.
- we currently have a bug where we cannot recursively instantiate a generic function.
---
### 2018-07-16 `(fdc65d7)`
- factor the any-making/getting stuff into functions for less IR mess.
- fix a massive bug in `alloc` where we never called the user-code, or set the length.
- add stack-allocs for arguments so we can take their address. might be in poor taste, we'll see.
- enable more tests in `tester.flx`.
---
### 2018-07-15 `(70d78b4)`
- fix string-literal-backslash bug.
- clean up some of the old cruft lying around.
- we can just make our own function called `char` that takes a slice and returns the first character. no compile-time guarantees,
but until we figure out something better it's better than nothing.
---
### 2018-07-15 `(0e53fce)`
- fix the bug where we were dealing incorrectly with non-generic types nested inside generic types.
- fix calling variadic functions with no variadic args (by inserting an empty thing varslice in the generated arg list)
- fix 0-cost casting between signed/unsigned ints causing overload failure.
---
### 2018-07-15 `(7e8322d)`
- add `is` to streamline checking the `typeid` of `any` types.
---
### 2018-06-10 `(d1284a9)`
- fix a bug wrt. scopes; refcount decrementing now happens at every block scope (not just loops) -- added a new `BlockPoint` thing to convey this.
- fix a massive bug where `else-if` cases were never even being evaluated.
- `stdio.flx`!
---
### 2018-06-10 `(1aade5f)`
- replace the individual IR stuff for strings and dynamic arrays with their SAA equivalents.
- add an `any` type -- kinda works like pre-rewrite. contains 32-byte internal buffer to store SAA types without additional heap allocations,
types larger than 32-bytes get heap-allocated.
- add `typeid()` to deal with the `any` types.
---
### 2018-06-10 `(8ab9dad)`
- finally add the check for accessing `refcount` when the pointer is `null`; now we return `0` instead of crashing.
---
### 2018-06-10 `(8d9c0d2)`
- fix a bug where we added generic versions for operators twice. (this caused an assertion to fire)
---
### 2018-06-10 `(aa8f9a9)`
- fixed a bug wrt. passing generic stuff to generic functions -- now we check only for a subset of the generic stack instead of the whole thing
when checking for existing stuff.
---
### 2018-06-08 `(e530c81)`
- remove mpfr from our code
---
### 2018-06-03 `(ef6326c)`
- actually fix the bug. we were previously *moving out* of arrays in a destructuring binding, which is definitely not what we want.
now we increment the refcount before passing it off to the binding, so we don't prematurely free.
---
### 2018-06-03 `(4d0aa96)`
- fix a massive design flaw wrt. arrays -- they now no longer modify the refcount of their elements. only when they are completely freed,
then we run a decrement loop (once!) over the elements.
- this should fix the linux crash as well. note: classes test fails, so we've turned that off for now.
---
### 2018-06-03 `(c060a50)`
- fix a recursion bug with checking for placeholders
- fix a bug where we would try to do implicit field access on non-field stuff -- set a flag during typechecking so we know.
- add more tests.
---
### 2018-06-02 `(a86608b)`
- fix a parsing bug involving closing braces and namespaces.
---
### 2018-06-02 `(e35c883)`
- still no iterative solver, but made the error output slightly better.
- also, if we're assigning the result to something with a concrete type, allow the inference thing to work with that
information as well.
---
### 2018-05-31 `(dbc7cd2)`
- pretty much complete implementation of the generic type solver for arbitrary levels of nesting.
- one final detail is the lack of the iterative solver; that's trivial though and i'll do that on the weekend.
---
### 2018-05-28 `(1e41f88)`
- fix a couple of bugs relating to SAA types and their refouncting pointers
- fix a thing where single-expr functions weren't handling `doBlockEndThings` properly.
- start drilling holes for the generic inference stuff
---
### 2018-05-27 `(337a6a5)`
- eliminate `exitless_error`, and made everything that used to use it use our new error system.
---
### 2018-05-27 `(e479ba2)`
- overhaul the error output system for non-trivial cases (it's awesome), remove `HighlightOptions` because we now have `SpanError`.
- make osx travis use `tester.flx` so we stop having the CI say failed.
---
### 2018-05-27 `(6385652)`
- sort the candidates by line number, and don't print too many of the fake margin/gutter things.
- change typecache (thanks adrian) to be better.
---
### 2018-05-27 `(ce9f113)`
- magnificently beautiful and informative errors for function call overload failure.
---
### 2018-05-18 `(80d5297)`
- fix a couple of unrelated bugs
- varidic arrays are now slice-based instead of dynarray-based
- variadic functions work, mostly. not thoroughly tested (nothing ever is)
---
### 2018-05-03 `(65b25b3)`
- parse the variadic type as `[T: ...]`
- allow `[as T: x, y, ... z]` syntax for specifying explicitly that the element type should be `T`.
---
### 2018-05-03 `(25dadf0)`
- remove `char` type; everything is now `i8`, and `isCharType()` just checks if its an `i8`
- constructor syntax for builtin types, and strings from slices and/or ptr+data
- fix a couple of mutability bugs here and there with the new gluecode.
---
### 2018-05-01 `(f3a06c3)`
- actually add the instructions and stuff, fix a couple of bugs
- `fir::ConstantString` is now actually a slice.
- move as many of the dynamic array stuff to the new `SAA` functions as possible.
- increase length when appending
---
### 2018-05-01 `(0ceb391)`
- strings now behave like dynamic arrays
- new concept of `SAA`, string-array-analogues (for now just strings and arrays lol) that have the `{ ptr, len, cap, refptr }` pattern.
---
### 2018-04-30 `(312b94a)`
- check generic things when looking for duplicate definitions (to the best of our abilities)
- actually make generic constructors work properly instead of by random chance
---
### 2018-04-30 `(1734444)`
- generic functions work
- made error reporting slightly better, though now it becames a little messy.
---
### 2018-04-20 `(c911408)`
- actually make generic types work, because we never tested them properly last time.
- fixed a bug in `pts::NamedType` that didn't take the generic mapping into account -- also fixed related issue in the parser
---
### 2018-04-20 `(860b61e)`
- move to a `TCResult` thing for typechecking returns, cleans up generic types a bunch
- fix a bug where we couldn't define generic types inside of a scope (eg. in a function)
---
### 2018-04-14 `(1b85906)`
- make init methods always mutable, for obvious reasons. Also, virtual stuff still works and didn't break, which is a plus.
---
### 2018-04-14 `(7107d5e)`
- remove all code with side effects (mostly `eat()` stuff in the parser) from within asserts.
---
### 2018-04-14 `(e9ebbb0)`
- fix type-printing for the new array syntax (finally)
- string literals now have a type of `[char:]`, with the appropriate implicit casts in place from `string` and to `&i8`
- add implicit casting for tuple types if their elements can also be implicitly casted (trivial)
- fix an issue re: constant slices in the llvm translator backend (everything was null)
- distinguish appending and construct-from-two-ing for strings in the runtime-glue-code; will probably use `realloc` to implement mutating via append for
strings once we get the shitty refcount madness sorted out.
---
### 2018-04-09 `(81a0eb7)`
- add `[mut T:]` syntax for specifying mutable slices; otherwise they will be immutable. If using type inference, then they'll be inferred depending on
what is sliced.
---
### 2018-04-08 `(f824a97)`
- overhaul the mutability system to be similar to Rust; now, pointers can indicate whether the memory they point to is mutable, and `let` vs `var` only
determines whether the variable itself can be modified. Use `&mut T` for the new thing.
- allow `mut` to be used with methods; if it is present, then a mutable `self` is passed in, otherwise an immutable `self` is passed.
- add casting to `mut`: `foo as mut` or `foo as !mut` to cast an immutable pointer/slice to a mutable one, and vice versa.
- distinguish mutable and non-mutable slices, some rules about which things become mutable when sliced and which don't.
---
### 2018-04-07 `(ec9adb2)`
- add generic types for structs -- presumably works for classes and stuff as well.
- fix bug where we couldn't do methods in structs.
- fix bug where we treated variable declarations inside method bodies as field declarations
- fix bug where we were infinite-looping on method/field stuff on structs
---
### 2018-03-05 `(d9133a8)`
- change type syntax to be `[T]` for dynamic arrays, `[T:]` for slices, and `[T: N]` for fixed arrays
- change strings to return `[char:]` instead of making a copy of the string. This allows mutation... at your own risk (for literal strings??)
- add `str` as an alias for the aforementioned `[char:]`
---
### 2018-03-04 `(b48e10f)`
- change `alloc` syntax to be like this: `alloc TYPE (ARGS...) [N, M, ...] { BODY }`, where, importantly, `BODY` is code that will be run on each element in
the allocated array, with bindings `it` (mutable, for obvious reasons), and `i` (immutable, again obviously) representing the current element and the index
respectively.
- unfortunately what we said about how `&T[]` parses was completely wrong; it parses as `&(T[])` instead.
---
### 2018-02-27 `(b89aa2c)`
- fix how we did refcounts for arrays; instead of being 8 bytes behind the data pointer like we were doing for strings, they're now just stored in a separate
pointer in the dynamic array struct itself. added code in appropriate places to detect null-ness of this pointer, as well as allocating + freeing it
appropriately.
- add for loops with tuple destructuring (in theory arbitrary destructuring, since we use the existing framework for such things).
- add iteration count binding for for-loops; `for (a, b), it in foo { it == 1, 2, ... }`
---
### 2018-02-19 `(3eb36eb)`
- fix the completely uncaught disaster of mismatched comparison ops in binary arithmetic
- fix bug where we were double-offsetting the indices in insertvalue and extractvalue (for classes)
- fix certain cases in codegen where our `TypeDefn` wasn't code-generated yet, leading to a whole host of failures. // ! STILL NOT ROBUST
- fix typo in operator for division, causing it not to work properly (typoed `-` instead of `/`)
- change pointer syntax to use `&T` vs `T*`. fyi, `&T[]` parses intuitively as `(&T)[]`; use `&(T[])` to get `T[]*` of old
- change syntax of `alloc` (some time ago actually) to allow passing arguments to constructors; new syntax is `alloc(T, arg1, arg2, ...) [N1, N2, ...]`
---
### 2018-02-19 `(6dc5ed5)`
- fix the behaviour of foreach loops such that they don't unnecessarily make values (and in the case of classes, call the constructor) for the loop variable
---
### 2018-02-19 `(f7568e9)`
- add dynamic dispatch for virtual methods (WOO)
- probably fix some low-key bugs somewhere
---
### 2018-02-19 `(7268a2c)`
- enforce calling superclass constructor (via `init(...) : super(...)`) in class constructor definitions
- fix semantics, by calling superclass inline-init function in derived-class inline-init function
- refactor code internally to pull stuff out more.
---
### 2018-02-17 `(ba4de52)`
- re-worked method detection (whether we're in a method or a normal function) to handle the edge case of nested function defs (specifically in a method)
- make base-class declarations visible in derived classes, including via implicit-self
- method hiding detection -- it is illegal to have a method in a derived class with the same signature as a method in the base class (without virtual)
---
### 2018-02-15 `(e885c8f)`
- fix regression wrt. scoping and telporting in dot-ops (ref `rants.md` dated 30/11/17)
---
### 2018-02-11 `(c94a6c1)`
- add `using ENUM as X`, where `X` can also be `_`.
---
### 2018-02-11 `(8123b13)`
- add `using X as _` that works like import -- it copies the entities in `X` to the current scope.
---
### 2018-02-11 `(1830146)`
- add `using X as Y` (but where `Y` currently cannot be `_`, and `X` must be a namespace of some kind)
---
### 2018-02-10 `(23b51a5)`
- fix edge cases in dot operator, where `Some_Namespace.1234` would just typecheck 'correctly' and return `1234` as the value; we now report an error.
---
### 2018-01-28 `(00586be)`
- add barebones inheritance on classes. Barebones-ness is explained in `rants.md`
---
### 2018-01-21 `(f7a72b6)`
- fix variable decompositions
- enable the decomposition test we had.
- disable searching beyond the current scope when resolving definitions, if we already found at least one thing here. Previous behaviour was wrong, and
screwed up shadowing things (would complain about ambiguous references, since we searched further up than we should've)
---
### 2018-01-21 `(1be1271)`
- fix emitting `bool` in IR that was never caught because we never had a function taking `bool` args, thus we never mangled it.
- add class constructors; all arguments must be named, and can only call declared init functions.
---
### 2018-01-20 `(c6a204a)`
- add order-independent type usage, a-la functions. This allows `A` to refer to `B` and `A` to simultaneously refer to `B`.
- fix detection (rather add it) of recursive definitions, eg. `struct A { var x: A }`, or `struct A { var x: B }; struct B { var x: A }`
- add `sizeof` operator
---
### 2018-01-19 `(b7fb307)`
- add static fields in classes, with working initialisers
---
### 2018-01-14 `(81faedb)`
- add error backtrace, but at a great cost...
---
### 2018-01-14 `(b4dabf6)`
- add splatting for single values, to fill up single-level tuple destructures, eg. `let (a, b) = ...10; a == b == 10`
---
### 2018-01-14 `(597b1f2)`
- add array and tuple decomposition, and allow them to nest to arbitrarily ridiculous levels.
---
### 2018-01-14 `(f8d983c)`
- allow assignment to tuples containing lvalues, to enable the tuple-swap idiom eg. `(a, b) = (b, a)`
---
### 2018-01-13 `(e91b4a2)`
- add splatting of tuples in function calls; can have multiple tuples
---
### 2018-01-12 `(9e3356d)`
- improve robustness by making range literals `(X...Y)` parse as binary operators instead of hacky postfix unary ops.
---
### 2018-01-07`(7cb117f)`
- fix a bug that prevented parsing of function types taking 0 parameters, ie. `() -> T`
---
### 2018-01-07`(4eaae34)`
- fix custom unary operators for certain cases (`@` was not being done properly, amongst other things)
---
### 2018-01-07 `(d06e235)`
- add named arguments for all function calls, including methods, but excluding fn-pointer calls
---
### 2018-01-07 `(d0f8c93)`
- fix some bugs re: the previous commit.
---
### 2018-01-06 `(ec728cd)`
- add constructor syntax for types (as previously discussed), where you can do some fields with names, or all fields positionally.
---
### 2018-01-06 `(ec7b2f3)`
- fix false assertion (assert index > 0) for InsertValue by index in FIR. Index can obviously be 0 for the first element.
---
### 2017-12-31 `(3add15b)`
- fix implicit casting arguments to overloaded operators
- add ability to overload unicode symbols as operators
---
### 2017-12-31 `(d2f8dbd)`
- add ability to overload prefix operators
- internally, move Operator to be a string type to make our lives easier with overloading.
---
### 2017-12-31 `(dcc28ba)`
- fix member access on structs that were passed as arguments (ie. 'did not have pointer' -- solved by using ExtractValue in such cases)
- fix method calling (same thing as above) -- but this time we need to use ImmutAlloc, because we need a `this` pointer
- add basic operator overloading for binary, non-assigment operators.
---
### 2017-12-29 `(45e818e)`
- check for, and error on, duplicate module imports.
---
### 2017-12-17 `(5a9aa9e)`
- add deferred statements and blocks
---
### 2017-12-16 `(80a6619)`
- add single-expression functions with `fn foo(a: T) -> T => a * 2`
---
### 2017-12-10 `(3b438c2)`
- add support for reverse ranges (negative steps, start > end)
---
### 2017-12-10 `(f3f8dbb)`
- add ranges
- add foreach loops on ranges, arrays, and strings
- add '=>' syntax for single-statement blocks, eg. `if x == 0 => x += 4`
---
### 2017-12-08 `(dacc809)`
- fix lexing/parsing of negative numerical literals
---
### 2017-12-07 `(ca3ae4b)`
- better type inference/support for empty array literals
- implicit conversion from pointers to booleans for null checking
---
### 2017-12-03 `(5be4db1)`
- fix runtime glue code for arrays wrt. reference counting
---
### 2017-12-02 `(e3a2b55)`
- add alloc and dealloc
- add dynamic array operators (`pop()`, `back()`)
---
### 2017-11-19 `(b7c6f74)`
- add enums
---
### 2017-10-22 `(408260c)`
- add classes
================================================
FILE: external/mpreal/mpreal.h
================================================
/*
MPFR C++: Multi-precision floating point number class for C++.
Based on MPFR library: http://mpfr.org
Project homepage: http://www.holoborodko.com/pavel/mpfr
Contact e-mail: pavel@holoborodko.com
Copyright (c) 2008-2015 Pavel Holoborodko
Contributors:
Dmitriy Gubanov, Konstantin Holoborodko, Brian Gladman,
Helmut Jarausch, Fokko Beekhof, Ulrich Mutze, Heinz van Saanen,
Pere Constans, Peter van Hoof, Gael Guennebaud, Tsai Chia Cheng,
Alexei Zubanov, Jauhien Piatlicki, Victor Berger, John Westwood,
Petr Aleksandrov, Orion Poplawski, Charles Karney, Arash Partow,
Rodney James, Jorge Leitao.
Licensing:
(A) MPFR C++ is under GNU General Public License ("GPL").
(B) Non-free licenses may also be purchased from the author, for users who
do not want their programs protected by the GPL.
The non-free licenses are for users that wish to use MPFR C++ in
their products but are unwilling to release their software
under the GPL (which would require them to release source code
and allow free redistribution).
Such users can purchase an unlimited-use license from the author.
Contact us for more details.
GNU General Public License ("GPL") copyright permissions statement:
**************************************************************************
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MPREAL_H__
#define __MPREAL_H__
#include <string>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <cfloat>
#include <cmath>
#include <cstring>
#include <limits>
#include <cstdint>
#include <complex>
#include <algorithm>
// Options
#define MPREAL_HAVE_MSVC_DEBUGVIEW // Enable Debugger Visualizer for "Debug" builds in MSVC.
#define MPREAL_HAVE_DYNAMIC_STD_NUMERIC_LIMITS // Enable extended std::numeric_limits<mpfr::mpreal> specialization.
// Meaning that "digits", "round_style" and similar members are defined as functions, not constants.
// See std::numeric_limits<mpfr::mpreal> at the end of the file for more information.
// Library version
#define MPREAL_VERSION_MAJOR 3
#define MPREAL_VERSION_MINOR 6
#define MPREAL_VERSION_PATCHLEVEL 2
#define MPREAL_VERSION_STRING "3.6.2"
// disable deprecated warnings for mpfr.
#ifdef _MSC_VER
#pragma warning(push, 0)
#pragma warning(disable: 4996)
#else
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
// Detect compiler using signatures from http://predef.sourceforge.net/
#if defined(__GNUC__) && defined(__INTEL_COMPILER)
#define IsInf(x) isinf(x) // Intel ICC compiler on Linux
#elif defined(_MSC_VER) // Microsoft Visual C++
#define IsInf(x) (!_finite(x))
#else
#define IsInf(x) std::isinf(x) // GNU C/C++ (and/or other compilers), just hope for C99 conformance
#endif
// A Clang feature extension to determine compiler features.
#ifndef __has_feature
#define __has_feature(x) 0
#endif
// Detect support for r-value references (move semantic). Borrowed from Eigen.
#if (__has_feature(cxx_rvalue_references) || \
defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L || \
(defined(_MSC_VER) && _MSC_VER >= 1600))
#define MPREAL_HAVE_MOVE_SUPPORT
// Use fields in mpfr_t structure to check if it was initialized / set dummy initialization
#define mpfr_is_initialized(x) (0 != (x)->_mpfr_d)
#define mpfr_set_uninitialized(x) ((x)->_mpfr_d = 0 )
#endif
// Detect support for explicit converters.
#if (__has_feature(cxx_explicit_conversions) || \
(defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC_MINOR >= 5) || __cplusplus >= 201103L || \
(defined(_MSC_VER) && _MSC_VER >= 1800))
#define MPREAL_HAVE_EXPLICIT_CONVERTERS
#endif
#define MPFR_USE_INTMAX_T // Enable 64-bit integer types - should be defined before mpfr.h
#if defined(MPREAL_HAVE_MSVC_DEBUGVIEW) && defined(_MSC_VER) && defined(_DEBUG)
#define MPREAL_MSVC_DEBUGVIEW_CODE DebugView = toString();
#define MPREAL_MSVC_DEBUGVIEW_DATA std::string DebugView;
#else
#define MPREAL_MSVC_DEBUGVIEW_CODE
#define MPREAL_MSVC_DEBUGVIEW_DATA
#endif
#include <mpfr.h>
#if (MPFR_VERSION < MPFR_VERSION_NUM(3,0,0))
#include <cstdlib> // Needed for random()
#endif
// Less important options
#define MPREAL_DOUBLE_BITS_OVERFLOW (-1) // Triggers overflow exception during conversion to double if mpreal
// cannot fit in MPREAL_DOUBLE_BITS_OVERFLOW bits
// = -1 disables overflow checks (default)
// Fast replacement for mpfr_set_zero(x, +1):
// (a) uses low-level data members, might not be compatible with new versions of MPFR
// (b) sign is not set, add (x)->_mpfr_sign = 1;
#define mpfr_set_zero_fast(x) ((x)->_mpfr_exp = __MPFR_EXP_ZERO)
#if defined(__GNUC__)
#define MPREAL_PERMISSIVE_EXPR __extension__
#else
#define MPREAL_PERMISSIVE_EXPR
#endif
namespace mpfr {
class mpreal {
private:
mpfr_t mp;
public:
// Get default rounding mode & precision
inline static mp_rnd_t get_default_rnd() { return (mp_rnd_t)(mpfr_get_default_rounding_mode()); }
inline static mp_prec_t get_default_prec() { return mpfr_get_default_prec(); }
// Constructors && type conversions
mpreal();
mpreal(const mpreal& u);
mpreal(const mpf_t u);
mpreal(const mpz_t u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const mpq_t u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const double u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const long double u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const unsigned long long int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const long long int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const unsigned long int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const unsigned int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const long int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const int u, mp_prec_t prec = mpreal::get_default_prec(), mp_rnd_t mode = mpreal::get_default_rnd());
// Construct mpreal from mpfr_t structure.
// shared = true allows to avoid deep copy, so that mpreal and 'u' share the same data & pointers.
mpreal(const mpfr_t u, bool shared = false);
mpreal(const char* s, mp_prec_t prec = mpreal::get_default_prec(), int base = 10, mp_rnd_t mode = mpreal::get_default_rnd());
mpreal(const std::string& s, mp_prec_t prec = mpreal::get_default_prec(), int base = 10, mp_rnd_t mode = mpreal::get_default_rnd());
~mpreal();
#ifdef MPREAL_HAVE_MOVE_SUPPORT
mpreal& operator=(mpreal&& v) noexcept;
mpreal(mpreal&& u) noexcept;
#endif
// Operations
// =
// +, -, *, /, ++, --, <<, >>
// *=, +=, -=, /=,
// <, >, ==, <=, >=
// =
mpreal& operator=(const mpreal& v);
mpreal& operator=(const mpf_t v);
mpreal& operator=(const mpz_t v);
mpreal& operator=(const mpq_t v);
mpreal& operator=(const long double v);
mpreal& operator=(const double v);
mpreal& operator=(const unsigned long int v);
mpreal& operator=(const unsigned long long int v);
mpreal& operator=(const long long int v);
mpreal& operator=(const unsigned int v);
mpreal& operator=(const long int v);
mpreal& operator=(const int v);
mpreal& operator=(const char* s);
mpreal& operator=(const std::string& s);
template <typename real_t> mpreal& operator= (const std::complex<real_t>& z);
// +
mpreal& operator+=(const mpreal& v);
mpreal& operator+=(const mpf_t v);
mpreal& operator+=(const mpz_t v);
mpreal& operator+=(const mpq_t v);
mpreal& operator+=(const long double u);
mpreal& operator+=(const double u);
mpreal& operator+=(const unsigned long int u);
mpreal& operator+=(const unsigned int u);
mpreal& operator+=(const long int u);
mpreal& operator+=(const int u);
mpreal& operator+=(const long long int u);
mpreal& operator+=(const unsigned long long int u);
mpreal& operator-=(const long long int u);
mpreal& operator-=(const unsigned long long int u);
mpreal& operator*=(const long long int u);
mpreal& operator*=(const unsigned long long int u);
mpreal& operator/=(const long long int u);
mpreal& operator/=(const unsigned long long int u);
const mpreal operator+() const;
mpreal& operator++ ();
const mpreal operator++ (int);
// -
mpreal& operator-=(const mpreal& v);
mpreal& operator-=(const mpz_t v);
mpreal& operator-=(const mpq_t v);
mpreal& operator-=(const long double u);
mpreal& operator-=(const double u);
mpreal& operator-=(const unsigned long int u);
mpreal& operator-=(const unsigned int u);
mpreal& operator-=(const long int u);
mpreal& operator-=(const int u);
const mpreal operator-() const;
friend const mpreal operator-(const unsigned long int b, const mpreal& a);
friend const mpreal operator-(const unsigned int b, const mpreal& a);
friend const mpreal operator-(const long int b, const mpreal& a);
friend const mpreal operator-(const int b, const mpreal& a);
friend const mpreal operator-(const double b, const mpreal& a);
mpreal& operator-- ();
const mpreal operator-- (int);
// *
mpreal& operator*=(const mpreal& v);
mpreal& operator*=(const mpz_t v);
mpreal& operator*=(const mpq_t v);
mpreal& operator*=(const long double v);
mpreal& operator*=(const double v);
mpreal& operator*=(const unsigned long int v);
mpreal& operator*=(const unsigned int v);
mpreal& operator*=(const long int v);
mpreal& operator*=(const int v);
// /
mpreal& operator/=(const mpreal& v);
mpreal& operator/=(const mpz_t v);
mpreal& operator/=(const mpq_t v);
mpreal& operator/=(const long double v);
mpreal& operator/=(const double v);
mpreal& operator/=(const unsigned long int v);
mpreal& operator/=(const unsigned int v);
mpreal& operator/=(const long int v);
mpreal& operator/=(const int v);
friend const mpreal operator/(const unsigned long int b, const mpreal& a);
friend const mpreal operator/(const unsigned int b, const mpreal& a);
friend const mpreal operator/(const long int b, const mpreal& a);
friend const mpreal operator/(const int b, const mpreal& a);
friend const mpreal operator/(const double b, const mpreal& a);
//<<= Fast Multiplication by 2^u
mpreal& operator<<=(const unsigned long int u);
mpreal& operator<<=(const unsigned int u);
mpreal& operator<<=(const long int u);
mpreal& operator<<=(const int u);
//>>= Fast Division by 2^u
mpreal& operator>>=(const unsigned long int u);
mpreal& operator>>=(const unsigned int u);
mpreal& operator>>=(const long int u);
mpreal& operator>>=(const int u);
// Type Conversion operators
bool toBool ( ) const;
long toLong (mp_rnd_t mode = GMP_RNDZ) const;
unsigned long toULong (mp_rnd_t mode = GMP_RNDZ) const;
long long toLLong (mp_rnd_t mode = GMP_RNDZ) const;
unsigned long long toULLong (mp_rnd_t mode = GMP_RNDZ) const;
float toFloat (mp_rnd_t mode = GMP_RNDN) const;
double toDouble (mp_rnd_t mode = GMP_RNDN) const;
long double toLDouble (mp_rnd_t mode = GMP_RNDN) const;
#if defined (MPREAL_HAVE_EXPLICIT_CONVERTERS)
explicit operator bool () const { return toBool(); }
explicit operator int () const { return int(toLong()); }
explicit operator long () const { return toLong(); }
explicit operator long long () const { return toLLong(); }
explicit operator unsigned () const { return unsigned(toULong()); }
explicit operator unsigned long () const { return toULong(); }
explicit operator unsigned long long () const { return toULLong(); }
explicit operator float () const { return toFloat(); }
explicit operator double () const { return toDouble(); }
explicit operator long double () const { return toLDouble(); }
#endif
// Get raw pointers so that mpreal can be directly used in raw mpfr_* functions
::mpfr_ptr mpfr_ptr();
::mpfr_srcptr mpfr_ptr() const;
::mpfr_srcptr mpfr_srcptr() const;
// Convert mpreal to string with n significant digits in base b
// n = -1 -> convert with the maximum available digits
std::string toString(int n = -1, int b = 10, mp_rnd_t mode = mpreal::get_default_rnd()) const;
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
std::string toString(const std::string& format) const;
#endif
std::ostream& output(std::ostream& os) const;
// Math Functions
friend const mpreal sqr (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sqrt(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sqrt(const unsigned long int v, mp_rnd_t rnd_mode);
friend const mpreal cbrt(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal root(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode);
friend const mpreal pow (const mpreal& a, const mpreal& b, mp_rnd_t rnd_mode);
friend const mpreal pow (const mpreal& a, const mpz_t b, mp_rnd_t rnd_mode);
friend const mpreal pow (const mpreal& a, const unsigned long int b, mp_rnd_t rnd_mode);
friend const mpreal pow (const mpreal& a, const long int b, mp_rnd_t rnd_mode);
friend const mpreal pow (const unsigned long int a, const mpreal& b, mp_rnd_t rnd_mode);
friend const mpreal pow (const unsigned long int a, const unsigned long int b, mp_rnd_t rnd_mode);
friend const mpreal fabs(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal abs(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal dim(const mpreal& a, const mpreal& b, mp_rnd_t rnd_mode);
friend inline const mpreal mul_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode);
friend inline const mpreal mul_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode);
friend inline const mpreal div_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode);
friend inline const mpreal div_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode);
friend int cmpabs(const mpreal& a,const mpreal& b);
friend const mpreal log (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal log2 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal logb (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal log10(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal exp (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal exp2 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal exp10(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal log1p(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal expm1(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal cos(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sin(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal tan(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sec(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal csc(const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal cot(const mpreal& v, mp_rnd_t rnd_mode);
friend int sin_cos(mpreal& s, mpreal& c, const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal acos (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal asin (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal atan (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal atan2 (const mpreal& y, const mpreal& x, mp_rnd_t rnd_mode);
friend const mpreal acot (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal asec (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal acsc (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal cosh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sinh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal tanh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal sech (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal csch (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal coth (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal acosh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal asinh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal atanh (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal acoth (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal asech (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal acsch (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal hypot (const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
friend const mpreal fac_ui (unsigned long int v, mp_prec_t prec, mp_rnd_t rnd_mode);
friend const mpreal eint (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal gamma (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal tgamma (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal lngamma (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal lgamma (const mpreal& v, int *signp, mp_rnd_t rnd_mode);
friend const mpreal zeta (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal erf (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal erfc (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal besselj0 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal besselj1 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal besseljn (long n, const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal bessely0 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal bessely1 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal besselyn (long n, const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal fma (const mpreal& v1, const mpreal& v2, const mpreal& v3, mp_rnd_t rnd_mode);
friend const mpreal fms (const mpreal& v1, const mpreal& v2, const mpreal& v3, mp_rnd_t rnd_mode);
friend const mpreal agm (const mpreal& v1, const mpreal& v2, mp_rnd_t rnd_mode);
friend const mpreal sum (const mpreal tab[], const unsigned long int n, int& status, mp_rnd_t rnd_mode);
friend int sgn(const mpreal& v); // returns -1 or +1
// MPFR 2.4.0 Specifics
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
friend int sinh_cosh (mpreal& s, mpreal& c, const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal li2 (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal fmod (const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
friend const mpreal rec_sqrt (const mpreal& v, mp_rnd_t rnd_mode);
// MATLAB's semantic equivalents
friend const mpreal rem (const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode); // Remainder after division
friend const mpreal mod (const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode); // Modulus after division
#endif
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
friend const mpreal digamma (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal ai (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal urandom (gmp_randstate_t& state, mp_rnd_t rnd_mode); // use gmp_randinit_default() to init state, gmp_randclear() to clear
#endif
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,1,0))
friend const mpreal grandom (gmp_randstate_t& state, mp_rnd_t rnd_mode); // use gmp_randinit_default() to init state, gmp_randclear() to clear
friend const mpreal grandom (unsigned int seed);
#endif
// Uniformly distributed random number generation in [0,1] using
// Mersenne-Twister algorithm by default.
// Use parameter to setup seed, e.g.: random((unsigned)time(NULL))
// Check urandom() for more precise control.
friend const mpreal random(unsigned int seed);
// Exponent and mantissa manipulation
friend const mpreal frexp (const mpreal& v, mp_exp_t* exp);
friend const mpreal ldexp (const mpreal& v, mp_exp_t exp);
friend const mpreal scalbn(const mpreal& v, mp_exp_t exp);
// Splits mpreal value into fractional and integer parts.
// Returns fractional part and stores integer part in n.
friend const mpreal modf(const mpreal& v, mpreal& n);
// Constants
// don't forget to call mpfr_free_cache() for every thread where you are using const-functions
friend const mpreal const_log2 (mp_prec_t prec, mp_rnd_t rnd_mode);
friend const mpreal const_pi (mp_prec_t prec, mp_rnd_t rnd_mode);
friend const mpreal const_euler (mp_prec_t prec, mp_rnd_t rnd_mode);
friend const mpreal const_catalan (mp_prec_t prec, mp_rnd_t rnd_mode);
// returns +inf iff sign>=0 otherwise -inf
friend const mpreal const_infinity(int sign, mp_prec_t prec);
// Output/ Input
friend std::ostream& operator<<(std::ostream& os, const mpreal& v);
friend std::istream& operator>>(std::istream& is, mpreal& v);
// Integer Related Functions
friend const mpreal rint (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal ceil (const mpreal& v);
friend const mpreal floor(const mpreal& v);
friend const mpreal round(const mpreal& v);
friend const mpreal trunc(const mpreal& v);
friend const mpreal rint_ceil (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal rint_floor (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal rint_round (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal rint_trunc (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal frac (const mpreal& v, mp_rnd_t rnd_mode);
friend const mpreal remainder ( const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
friend const mpreal remquo (long* q, const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
// Miscellaneous Functions
friend const mpreal nexttoward (const mpreal& x, const mpreal& y);
friend const mpreal nextabove (const mpreal& x);
friend const mpreal nextbelow (const mpreal& x);
// use gmp_randinit_default() to init state, gmp_randclear() to clear
friend const mpreal urandomb (gmp_randstate_t& state);
// MPFR < 2.4.2 Specifics
#if (MPFR_VERSION <= MPFR_VERSION_NUM(2,4,2))
friend const mpreal random2 (mp_size_t size, mp_exp_t exp);
#endif
// Instance Checkers
friend bool isnan (const mpreal& v);
friend bool isinf (const mpreal& v);
friend bool isfinite (const mpreal& v);
friend bool isnum (const mpreal& v);
friend bool iszero (const mpreal& v);
friend bool isint (const mpreal& v);
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
friend bool isregular(const mpreal& v);
#endif
// Set/Get instance properties
inline mp_prec_t get_prec() const;
inline void set_prec(mp_prec_t prec, mp_rnd_t rnd_mode = get_default_rnd()); // Change precision with rounding mode
// Aliases for get_prec(), set_prec() - needed for compatibility with std::complex<mpreal> interface
inline mpreal& setPrecision(int Precision, mp_rnd_t RoundingMode = get_default_rnd());
inline int getPrecision() const;
// Set mpreal to +/- inf, NaN, +/-0
mpreal& setInf (int Sign = +1);
mpreal& setNan ();
mpreal& setZero (int Sign = +1);
mpreal& setSign (int Sign, mp_rnd_t RoundingMode = get_default_rnd());
//Exponent
mp_exp_t get_exp();
int set_exp(mp_exp_t e);
int check_range (int t, mp_rnd_t rnd_mode = get_default_rnd());
int subnormalize (int t, mp_rnd_t rnd_mode = get_default_rnd());
// Inexact conversion from float
inline bool fits_in_bits(double x, int n);
// Set/Get global properties
static void set_default_prec(mp_prec_t prec);
static void set_default_rnd(mp_rnd_t rnd_mode);
static mp_exp_t get_emin (void);
static mp_exp_t get_emax (void);
static mp_exp_t get_emin_min (void);
static mp_exp_t get_emin_max (void);
static mp_exp_t get_emax_min (void);
static mp_exp_t get_emax_max (void);
static int set_emin (mp_exp_t exp);
static int set_emax (mp_exp_t exp);
// Efficient swapping of two mpreal values - needed for std algorithms
friend void swap(mpreal& x, mpreal& y);
friend const mpreal fmax(const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
friend const mpreal fmin(const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode);
private:
// Human friendly Debug Preview in Visual Studio.
// Put one of these lines:
//
// mpfr::mpreal=<DebugView> ; Show value only
// mpfr::mpreal=<DebugView>, <mp[0]._mpfr_prec,u>bits ; Show value & precision
//
// at the beginning of
// [Visual Studio Installation Folder]\Common7\Packages\Debugger\autoexp.dat
MPREAL_MSVC_DEBUGVIEW_DATA
// "Smart" resources deallocation. Checks if instance initialized before deletion.
void clear(::mpfr_ptr);
};
//////////////////////////////////////////////////////////////////////////
// Exceptions
class conversion_overflow : public std::exception {
public:
std::string why() { return "inexact conversion from floating point"; }
};
//////////////////////////////////////////////////////////////////////////
// Constructors & converters
// Default constructor: creates mp number and initializes it to 0.
inline mpreal::mpreal()
{
mpfr_init2(mpfr_ptr(), mpreal::get_default_prec());
mpfr_set_zero_fast(mpfr_ptr());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const mpreal& u)
{
mpfr_init2(mpfr_ptr(),mpfr_get_prec(u.mpfr_srcptr()));
mpfr_set (mpfr_ptr(),u.mpfr_srcptr(),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
#ifdef MPREAL_HAVE_MOVE_SUPPORT
inline mpreal::mpreal(mpreal&& other) noexcept
{
mpfr_set_uninitialized(mpfr_ptr()); // make sure "other" holds no pointer to actual data
mpfr_swap(mpfr_ptr(), other.mpfr_ptr());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal& mpreal::operator=(mpreal&& other) noexcept
{
mpfr_swap(mpfr_ptr(), other.mpfr_ptr());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
#endif
inline mpreal::mpreal(const mpfr_t u, bool shared)
{
if(shared)
{
std::memcpy(mpfr_ptr(), u, sizeof(mpfr_t));
}
else
{
mpfr_init2(mpfr_ptr(), mpfr_get_prec(u));
mpfr_set (mpfr_ptr(), u, mpreal::get_default_rnd());
}
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const mpf_t u)
{
mpfr_init2(mpfr_ptr(),(mp_prec_t) mpf_get_prec(u)); // (gmp: mp_bitcnt_t) unsigned long -> long (mpfr: mp_prec_t)
mpfr_set_f(mpfr_ptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const mpz_t u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2(mpfr_ptr(), prec);
mpfr_set_z(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const mpq_t u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2(mpfr_ptr(), prec);
mpfr_set_q(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const double u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2(mpfr_ptr(), prec);
#if (MPREAL_DOUBLE_BITS_OVERFLOW > -1)
if(fits_in_bits(u, MPREAL_DOUBLE_BITS_OVERFLOW))
{
mpfr_set_d(mpfr_ptr(), u, mode);
}else
throw conversion_overflow();
#else
mpfr_set_d(mpfr_ptr(), u, mode);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const long double u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_ld(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const unsigned long long int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_uj(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const long long int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_sj(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const unsigned long int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_ui(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const unsigned int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_ui(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const long int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_si(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const int u, mp_prec_t prec, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_si(mpfr_ptr(), u, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const char* s, mp_prec_t prec, int base, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_str(mpfr_ptr(), s, base, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mpreal::mpreal(const std::string& s, mp_prec_t prec, int base, mp_rnd_t mode)
{
mpfr_init2 (mpfr_ptr(), prec);
mpfr_set_str(mpfr_ptr(), s.c_str(), base, mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline void mpreal::clear(::mpfr_ptr x)
{
#ifdef MPREAL_HAVE_MOVE_SUPPORT
if(mpfr_is_initialized(x))
#endif
mpfr_clear(x);
}
inline mpreal::~mpreal()
{
clear(mpfr_ptr());
}
// internal namespace needed for template magic
namespace internal{
// Use SFINAE to restrict arithmetic operations instantiation only for numeric types
// This is needed for smooth integration with libraries based on expression templates, like Eigen.
// TODO: Do the same for boolean operators.
template <typename ArgumentType> struct result_type {};
template <> struct result_type<mpreal> {typedef mpreal type;};
template <> struct result_type<mpz_t> {typedef mpreal type;};
template <> struct result_type<mpq_t> {typedef mpreal type;};
template <> struct result_type<long double> {typedef mpreal type;};
template <> struct result_type<double> {typedef mpreal type;};
template <> struct result_type<unsigned long int> {typedef mpreal type;};
template <> struct result_type<unsigned int> {typedef mpreal type;};
template <> struct result_type<long int> {typedef mpreal type;};
template <> struct result_type<int> {typedef mpreal type;};
template <> struct result_type<long long> {typedef mpreal type;};
template <> struct result_type<unsigned long long> {typedef mpreal type;};
}
// + Addition
template <typename Rhs>
inline const typename internal::result_type<Rhs>::type
operator+(const mpreal& lhs, const Rhs& rhs){ return mpreal(lhs) += rhs; }
template <typename Lhs>
inline const typename internal::result_type<Lhs>::type
operator+(const Lhs& lhs, const mpreal& rhs){ return mpreal(rhs) += lhs; }
// - Subtraction
template <typename Rhs>
inline const typename internal::result_type<Rhs>::type
operator-(const mpreal& lhs, const Rhs& rhs){ return mpreal(lhs) -= rhs; }
template <typename Lhs>
inline const typename internal::result_type<Lhs>::type
operator-(const Lhs& lhs, const mpreal& rhs){ return mpreal(lhs) -= rhs; }
// * Multiplication
template <typename Rhs>
inline const typename internal::result_type<Rhs>::type
operator*(const mpreal& lhs, const Rhs& rhs){ return mpreal(lhs) *= rhs; }
template <typename Lhs>
inline const typename internal::result_type<Lhs>::type
operator*(const Lhs& lhs, const mpreal& rhs){ return mpreal(rhs) *= lhs; }
// / Division
template <typename Rhs>
inline const typename internal::result_type<Rhs>::type
operator/(const mpreal& lhs, const Rhs& rhs){ return mpreal(lhs) /= rhs; }
template <typename Lhs>
inline const typename internal::result_type<Lhs>::type
operator/(const Lhs& lhs, const mpreal& rhs){ return mpreal(lhs) /= rhs; }
//////////////////////////////////////////////////////////////////////////
// sqrt
const mpreal sqrt(const unsigned int v, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal sqrt(const long int v, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal sqrt(const int v, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal sqrt(const long double v, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal sqrt(const double v, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
// abs
inline const mpreal abs(const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd());
//////////////////////////////////////////////////////////////////////////
// pow
const mpreal pow(const mpreal& a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const mpreal& a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const mpreal& a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const mpreal& a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const mpreal& b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const mpreal& b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const mpreal& b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const mpreal& b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const mpreal& b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned long int a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned long int a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned long int a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned long int a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned long int a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const unsigned long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const unsigned int a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const unsigned long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long int a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const unsigned long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const int a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const long double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const unsigned long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const long double a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const double b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const unsigned long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const unsigned int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const long int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
const mpreal pow(const double a, const int b, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
inline const mpreal mul_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
inline const mpreal mul_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
inline const mpreal div_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
inline const mpreal div_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode = mpreal::get_default_rnd());
//////////////////////////////////////////////////////////////////////////
// Estimate machine epsilon for the given precision
// Returns smallest eps such that 1.0 + eps != 1.0
inline mpreal machine_epsilon(mp_prec_t prec = mpreal::get_default_prec());
// Returns smallest eps such that x + eps != x (relative machine epsilon)
inline mpreal machine_epsilon(const mpreal& x);
// Gives max & min values for the required precision,
// minval is 'safe' meaning 1 / minval does not overflow
// maxval is 'safe' meaning 1 / maxval does not underflow
inline mpreal minval(mp_prec_t prec = mpreal::get_default_prec());
inline mpreal maxval(mp_prec_t prec = mpreal::get_default_prec());
// 'Dirty' equality check 1: |a-b| < min{|a|,|b|} * eps
inline bool isEqualFuzzy(const mpreal& a, const mpreal& b, const mpreal& eps);
// 'Dirty' equality check 2: |a-b| < min{|a|,|b|} * eps( min{|a|,|b|} )
inline bool isEqualFuzzy(const mpreal& a, const mpreal& b);
// 'Bitwise' equality check
// maxUlps - a and b can be apart by maxUlps binary numbers.
inline bool isEqualUlps(const mpreal& a, const mpreal& b, int maxUlps);
//////////////////////////////////////////////////////////////////////////
// Convert precision in 'bits' to decimal digits and vice versa.
// bits = ceil(digits*log[2](10))
// digits = floor(bits*log[10](2))
inline mp_prec_t digits2bits(int d);
inline int bits2digits(mp_prec_t b);
//////////////////////////////////////////////////////////////////////////
// min, max
const mpreal (max)(const mpreal& x, const mpreal& y);
const mpreal (min)(const mpreal& x, const mpreal& y);
//////////////////////////////////////////////////////////////////////////
// Implementation
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Operators - Assignment
inline mpreal& mpreal::operator=(const mpreal& v)
{
if (this != &v)
{
mp_prec_t tp = mpfr_get_prec( mpfr_srcptr());
mp_prec_t vp = mpfr_get_prec(v.mpfr_srcptr());
if(tp != vp){
clear(mpfr_ptr());
mpfr_init2(mpfr_ptr(), vp);
}
mpfr_set(mpfr_ptr(), v.mpfr_srcptr(), mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
return *this;
}
inline mpreal& mpreal::operator=(const mpf_t v)
{
mpfr_set_f(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const mpz_t v)
{
mpfr_set_z(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const mpq_t v)
{
mpfr_set_q(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const long double v)
{
mpfr_set_ld(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const double v)
{
#if (MPREAL_DOUBLE_BITS_OVERFLOW > -1)
if(fits_in_bits(v, MPREAL_DOUBLE_BITS_OVERFLOW))
{
mpfr_set_d(mpfr_ptr(),v,mpreal::get_default_rnd());
}else
throw conversion_overflow();
#else
mpfr_set_d(mpfr_ptr(),v,mpreal::get_default_rnd());
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const unsigned long int v)
{
mpfr_set_ui(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const unsigned int v)
{
mpfr_set_ui(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const unsigned long long int v)
{
mpfr_set_uj(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const long long int v)
{
mpfr_set_sj(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const long int v)
{
mpfr_set_si(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const int v)
{
mpfr_set_si(mpfr_ptr(), v, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator=(const char* s)
{
// Use other converters for more precise control on base & precision & rounding:
//
// mpreal(const char* s, mp_prec_t prec, int base, mp_rnd_t mode)
// mpreal(const std::string& s,mp_prec_t prec, int base, mp_rnd_t mode)
//
// Here we assume base = 10 and we use precision of target variable.
mpfr_t t;
mpfr_init2(t, mpfr_get_prec(mpfr_srcptr()));
if(0 == mpfr_set_str(t, s, 10, mpreal::get_default_rnd()))
{
mpfr_set(mpfr_ptr(), t, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
clear(t);
return *this;
}
inline mpreal& mpreal::operator=(const std::string& s)
{
// Use other converters for more precise control on base & precision & rounding:
//
// mpreal(const char* s, mp_prec_t prec, int base, mp_rnd_t mode)
// mpreal(const std::string& s,mp_prec_t prec, int base, mp_rnd_t mode)
//
// Here we assume base = 10 and we use precision of target variable.
mpfr_t t;
mpfr_init2(t, mpfr_get_prec(mpfr_srcptr()));
if(0 == mpfr_set_str(t, s.c_str(), 10, mpreal::get_default_rnd()))
{
mpfr_set(mpfr_ptr(), t, mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
}
clear(t);
return *this;
}
template <typename real_t>
inline mpreal& mpreal::operator= (const std::complex<real_t>& z)
{
*this = z.real();
return *this;
}
//////////////////////////////////////////////////////////////////////////
// + Addition
inline mpreal& mpreal::operator+=(const mpreal& v)
{
mpfr_add(mpfr_ptr(), mpfr_srcptr(), v.mpfr_srcptr(), mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const mpf_t u)
{
*this += mpreal(u);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const mpz_t u)
{
mpfr_add_z(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const mpq_t u)
{
mpfr_add_q(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+= (const long double u)
{
*this += mpreal(u);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+= (const double u)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpfr_add_d(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
#else
*this += mpreal(u);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const unsigned long int u)
{
mpfr_add_ui(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const unsigned int u)
{
mpfr_add_ui(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const long int u)
{
mpfr_add_si(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const int u)
{
mpfr_add_si(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator+=(const long long int u) { *this += mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator+=(const unsigned long long int u){ *this += mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator-=(const long long int u) { *this -= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator-=(const unsigned long long int u){ *this -= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator*=(const long long int u) { *this *= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator*=(const unsigned long long int u){ *this *= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator/=(const long long int u) { *this /= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline mpreal& mpreal::operator/=(const unsigned long long int u){ *this /= mpreal(u); MPREAL_MSVC_DEBUGVIEW_CODE; return *this; }
inline const mpreal mpreal::operator+()const { return mpreal(*this); }
inline const mpreal operator+(const mpreal& a, const mpreal& b)
{
mpreal c(0, (std::max)(mpfr_get_prec(a.mpfr_ptr()), mpfr_get_prec(b.mpfr_ptr())));
mpfr_add(c.mpfr_ptr(), a.mpfr_srcptr(), b.mpfr_srcptr(), mpreal::get_default_rnd());
return c;
}
inline mpreal& mpreal::operator++()
{
return *this += 1;
}
inline const mpreal mpreal::operator++ (int)
{
mpreal x(*this);
*this += 1;
return x;
}
inline mpreal& mpreal::operator--()
{
return *this -= 1;
}
inline const mpreal mpreal::operator-- (int)
{
mpreal x(*this);
*this -= 1;
return x;
}
//////////////////////////////////////////////////////////////////////////
// - Subtraction
inline mpreal& mpreal::operator-=(const mpreal& v)
{
mpfr_sub(mpfr_ptr(),mpfr_srcptr(),v.mpfr_srcptr(),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const mpz_t v)
{
mpfr_sub_z(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const mpq_t v)
{
mpfr_sub_q(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const long double v)
{
*this -= mpreal(v);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const double v)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpfr_sub_d(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
#else
*this -= mpreal(v);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const unsigned long int v)
{
mpfr_sub_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const unsigned int v)
{
mpfr_sub_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const long int v)
{
mpfr_sub_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator-=(const int v)
{
mpfr_sub_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline const mpreal mpreal::operator-()const
{
mpreal u(*this);
mpfr_neg(u.mpfr_ptr(),u.mpfr_srcptr(),mpreal::get_default_rnd());
return u;
}
inline const mpreal operator-(const mpreal& a, const mpreal& b)
{
mpreal c(0, (std::max)(mpfr_get_prec(a.mpfr_ptr()), mpfr_get_prec(b.mpfr_ptr())));
mpfr_sub(c.mpfr_ptr(), a.mpfr_srcptr(), b.mpfr_srcptr(), mpreal::get_default_rnd());
return c;
}
inline const mpreal operator-(const double b, const mpreal& a)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
mpfr_d_sub(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
#else
mpreal x(b, mpfr_get_prec(a.mpfr_ptr()));
x -= a;
return x;
#endif
}
inline const mpreal operator-(const unsigned long int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
mpfr_ui_sub(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator-(const unsigned int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
mpfr_ui_sub(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator-(const long int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
mpfr_si_sub(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator-(const int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
mpfr_si_sub(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
//////////////////////////////////////////////////////////////////////////
// * Multiplication
inline mpreal& mpreal::operator*= (const mpreal& v)
{
mpfr_mul(mpfr_ptr(),mpfr_srcptr(),v.mpfr_srcptr(),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const mpz_t v)
{
mpfr_mul_z(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const mpq_t v)
{
mpfr_mul_q(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const long double v)
{
*this *= mpreal(v);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const double v)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpfr_mul_d(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
#else
*this *= mpreal(v);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const unsigned long int v)
{
mpfr_mul_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const unsigned int v)
{
mpfr_mul_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const long int v)
{
mpfr_mul_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator*=(const int v)
{
mpfr_mul_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline const mpreal operator*(const mpreal& a, const mpreal& b)
{
mpreal c(0, (std::max)(mpfr_get_prec(a.mpfr_ptr()), mpfr_get_prec(b.mpfr_ptr())));
mpfr_mul(c.mpfr_ptr(), a.mpfr_srcptr(), b.mpfr_srcptr(), mpreal::get_default_rnd());
return c;
}
//////////////////////////////////////////////////////////////////////////
// / Division
inline mpreal& mpreal::operator/=(const mpreal& v)
{
mpfr_div(mpfr_ptr(),mpfr_srcptr(),v.mpfr_srcptr(),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const mpz_t v)
{
mpfr_div_z(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const mpq_t v)
{
mpfr_div_q(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const long double v)
{
*this /= mpreal(v);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const double v)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpfr_div_d(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
#else
*this /= mpreal(v);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const unsigned long int v)
{
mpfr_div_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const unsigned int v)
{
mpfr_div_ui(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const long int v)
{
mpfr_div_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator/=(const int v)
{
mpfr_div_si(mpfr_ptr(),mpfr_srcptr(),v,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline const mpreal operator/(const mpreal& a, const mpreal& b)
{
mpreal c(0, (std::max)(mpfr_get_prec(a.mpfr_srcptr()), mpfr_get_prec(b.mpfr_srcptr())));
mpfr_div(c.mpfr_ptr(), a.mpfr_srcptr(), b.mpfr_srcptr(), mpreal::get_default_rnd());
return c;
}
inline const mpreal operator/(const unsigned long int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_ui_div(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator/(const unsigned int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_ui_div(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator/(const long int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_si_div(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator/(const int b, const mpreal& a)
{
mpreal x(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_si_div(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
}
inline const mpreal operator/(const double b, const mpreal& a)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
mpreal x(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_d_div(x.mpfr_ptr(), b, a.mpfr_srcptr(), mpreal::get_default_rnd());
return x;
#else
mpreal x(0, mpfr_get_prec(a.mpfr_ptr()));
x /= a;
return x;
#endif
}
//////////////////////////////////////////////////////////////////////////
// Shifts operators - Multiplication/Division by power of 2
inline mpreal& mpreal::operator<<=(const unsigned long int u)
{
mpfr_mul_2ui(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator<<=(const unsigned int u)
{
mpfr_mul_2ui(mpfr_ptr(),mpfr_srcptr(),static_cast<unsigned long int>(u),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator<<=(const long int u)
{
mpfr_mul_2si(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator<<=(const int u)
{
mpfr_mul_2si(mpfr_ptr(),mpfr_srcptr(),static_cast<long int>(u),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator>>=(const unsigned long int u)
{
mpfr_div_2ui(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator>>=(const unsigned int u)
{
mpfr_div_2ui(mpfr_ptr(),mpfr_srcptr(),static_cast<unsigned long int>(u),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator>>=(const long int u)
{
mpfr_div_2si(mpfr_ptr(),mpfr_srcptr(),u,mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::operator>>=(const int u)
{
mpfr_div_2si(mpfr_ptr(),mpfr_srcptr(),static_cast<long int>(u),mpreal::get_default_rnd());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline const mpreal operator<<(const mpreal& v, const unsigned long int k)
{
return mul_2ui(v,k);
}
inline const mpreal operator<<(const mpreal& v, const unsigned int k)
{
return mul_2ui(v,static_cast<unsigned long int>(k));
}
inline const mpreal operator<<(const mpreal& v, const long int k)
{
return mul_2si(v,k);
}
inline const mpreal operator<<(const mpreal& v, const int k)
{
return mul_2si(v,static_cast<long int>(k));
}
inline const mpreal operator>>(const mpreal& v, const unsigned long int k)
{
return div_2ui(v,k);
}
inline const mpreal operator>>(const mpreal& v, const long int k)
{
return div_2si(v,k);
}
inline const mpreal operator>>(const mpreal& v, const unsigned int k)
{
return div_2ui(v,static_cast<unsigned long int>(k));
}
inline const mpreal operator>>(const mpreal& v, const int k)
{
return div_2si(v,static_cast<long int>(k));
}
// mul_2ui
inline const mpreal mul_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode)
{
mpreal x(v);
mpfr_mul_2ui(x.mpfr_ptr(),v.mpfr_srcptr(),k,rnd_mode);
return x;
}
// mul_2si
inline const mpreal mul_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode)
{
mpreal x(v);
mpfr_mul_2si(x.mpfr_ptr(),v.mpfr_srcptr(),k,rnd_mode);
return x;
}
inline const mpreal div_2ui(const mpreal& v, unsigned long int k, mp_rnd_t rnd_mode)
{
mpreal x(v);
mpfr_div_2ui(x.mpfr_ptr(),v.mpfr_srcptr(),k,rnd_mode);
return x;
}
inline const mpreal div_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode)
{
mpreal x(v);
mpfr_div_2si(x.mpfr_ptr(),v.mpfr_srcptr(),k,rnd_mode);
return x;
}
//////////////////////////////////////////////////////////////////////////
//Relational operators
// WARNING:
//
// Please note that following checks for double-NaN are guaranteed to work only in IEEE math mode:
//
// isnan(b) = (b != b)
// isnan(b) = !(b == b) (we use in code below)
//
// Be cautions if you use compiler options which break strict IEEE compliance (e.g. -ffast-math in GCC).
// Use std::isnan instead (C++11).
inline bool operator > (const mpreal& a, const mpreal& b ){ return (mpfr_greater_p(a.mpfr_srcptr(),b.mpfr_srcptr()) != 0 ); }
inline bool operator > (const mpreal& a, const unsigned long int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) > 0 ); }
inline bool operator > (const mpreal& a, const unsigned int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) > 0 ); }
inline bool operator > (const mpreal& a, const long int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) > 0 ); }
inline bool operator > (const mpreal& a, const int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) > 0 ); }
inline bool operator > (const mpreal& a, const long double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_ld(a.mpfr_srcptr(),b) > 0 ); }
inline bool operator > (const mpreal& a, const double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_d (a.mpfr_srcptr(),b) > 0 ); }
inline bool operator >= (const mpreal& a, const mpreal& b ){ return (mpfr_greaterequal_p(a.mpfr_srcptr(),b.mpfr_srcptr()) != 0 ); }
inline bool operator >= (const mpreal& a, const unsigned long int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator >= (const mpreal& a, const unsigned int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator >= (const mpreal& a, const long int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator >= (const mpreal& a, const int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator >= (const mpreal& a, const long double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_ld(a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator >= (const mpreal& a, const double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_d (a.mpfr_srcptr(),b) >= 0 ); }
inline bool operator < (const mpreal& a, const mpreal& b ){ return (mpfr_less_p(a.mpfr_srcptr(),b.mpfr_srcptr()) != 0 ); }
inline bool operator < (const mpreal& a, const unsigned long int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) < 0 ); }
inline bool operator < (const mpreal& a, const unsigned int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) < 0 ); }
inline bool operator < (const mpreal& a, const long int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) < 0 ); }
inline bool operator < (const mpreal& a, const int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) < 0 ); }
inline bool operator < (const mpreal& a, const long double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_ld(a.mpfr_srcptr(),b) < 0 ); }
inline bool operator < (const mpreal& a, const double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_d (a.mpfr_srcptr(),b) < 0 ); }
inline bool operator <= (const mpreal& a, const mpreal& b ){ return (mpfr_lessequal_p(a.mpfr_srcptr(),b.mpfr_srcptr()) != 0 ); }
inline bool operator <= (const mpreal& a, const unsigned long int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator <= (const mpreal& a, const unsigned int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator <= (const mpreal& a, const long int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator <= (const mpreal& a, const int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator <= (const mpreal& a, const long double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_ld(a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator <= (const mpreal& a, const double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_d (a.mpfr_srcptr(),b) <= 0 ); }
inline bool operator == (const mpreal& a, const mpreal& b ){ return (mpfr_equal_p(a.mpfr_srcptr(),b.mpfr_srcptr()) != 0 ); }
inline bool operator == (const mpreal& a, const unsigned long int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) == 0 ); }
inline bool operator == (const mpreal& a, const unsigned int b ){ return !isnan(a) && (mpfr_cmp_ui(a.mpfr_srcptr(),b) == 0 ); }
inline bool operator == (const mpreal& a, const long int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) == 0 ); }
inline bool operator == (const mpreal& a, const int b ){ return !isnan(a) && (mpfr_cmp_si(a.mpfr_srcptr(),b) == 0 ); }
inline bool operator == (const mpreal& a, const long double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_ld(a.mpfr_srcptr(),b) == 0 ); }
inline bool operator == (const mpreal& a, const double b ){ return !isnan(a) && (b == b) && (mpfr_cmp_d (a.mpfr_srcptr(),b) == 0 ); }
inline bool operator != (const mpreal& a, const mpreal& b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const unsigned long int b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const unsigned int b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const long int b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const int b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const long double b ){ return !(a == b); }
inline bool operator != (const mpreal& a, const double b ){ return !(a == b); }
inline bool isnan (const mpreal& op){ return (mpfr_nan_p (op.mpfr_srcptr()) != 0 ); }
inline bool isinf (const mpreal& op){ return (mpfr_inf_p (op.mpfr_srcptr()) != 0 ); }
inline bool isfinite (const mpreal& op){ return (mpfr_number_p (op.mpfr_srcptr()) != 0 ); }
inline bool iszero (const mpreal& op){ return (mpfr_zero_p (op.mpfr_srcptr()) != 0 ); }
inline bool isint (const mpreal& op){ return (mpfr_integer_p(op.mpfr_srcptr()) != 0 ); }
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
inline bool isregular(const mpreal& op){ return (mpfr_regular_p(op.mpfr_srcptr()));}
#endif
//////////////////////////////////////////////////////////////////////////
// Type Converters
inline bool mpreal::toBool ( ) const { return mpfr_zero_p (mpfr_srcptr()) == 0; }
inline long mpreal::toLong (mp_rnd_t mode) const { return mpfr_get_si (mpfr_srcptr(), mode); }
inline unsigned long mpreal::toULong (mp_rnd_t mode) const { return mpfr_get_ui (mpfr_srcptr(), mode); }
inline float mpreal::toFloat (mp_rnd_t mode) const { return mpfr_get_flt(mpfr_srcptr(), mode); }
inline double mpreal::toDouble (mp_rnd_t mode) const { return mpfr_get_d (mpfr_srcptr(), mode); }
inline long double mpreal::toLDouble(mp_rnd_t mode) const { return mpfr_get_ld (mpfr_srcptr(), mode); }
inline long long mpreal::toLLong (mp_rnd_t mode) const { return mpfr_get_sj (mpfr_srcptr(), mode); }
inline unsigned long long mpreal::toULLong (mp_rnd_t mode) const { return mpfr_get_uj (mpfr_srcptr(), mode); }
inline ::mpfr_ptr mpreal::mpfr_ptr() { return mp; }
inline ::mpfr_srcptr mpreal::mpfr_ptr() const { return mp; }
inline ::mpfr_srcptr mpreal::mpfr_srcptr() const { return mp; }
template <class T>
inline std::string toString(T t, std::ios_base & (*f)(std::ios_base&))
{
std::ostringstream oss;
oss << f << t;
return oss.str();
}
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
inline std::string mpreal::toString(const std::string& format) const
{
char *s = NULL;
std::string out;
if( !format.empty() )
{
if(!(mpfr_asprintf(&s, format.c_str(), mpfr_srcptr()) < 0))
{
out = std::string(s);
mpfr_free_str(s);
}
}
return out;
}
#endif
inline std::string mpreal::toString(int n, int b, mp_rnd_t mode) const
{
// TODO: Add extended format specification (f, e, rounding mode) as it done in output operator
(void)b;
(void)mode;
#if (MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0))
std::ostringstream format;
int digits = (n >= 0) ? n : 1 + bits2digits(mpfr_get_prec(mpfr_srcptr()));
format << "%." << digits << "RNg";
return toString(format.str());
#else
char *s, *ns = NULL;
size_t slen, nslen;
mp_exp_t exp;
std::string out;
if(mpfr_inf_p(mp))
{
if(mpfr_sgn(mp)>0) return "+Inf";
else return "-Inf";
}
if(mpfr_zero_p(mp)) return "0";
if(mpfr_nan_p(mp)) return "NaN";
s = mpfr_get_str(NULL, &exp, b, 0, mp, mode);
ns = mpfr_get_str(NULL, &exp, b, (std::max)(0,n), mp, mode);
if(s!=NULL && ns!=NULL)
{
slen = strlen(s);
nslen = strlen(ns);
if(nslen<=slen)
{
mpfr_free_str(s);
s = ns;
slen = nslen;
}
else {
mpfr_free_str(ns);
}
// Make human eye-friendly formatting if possible
if (exp>0 && static_cast<size_t>(exp)<slen)
{
if(s[0]=='-')
{
// Remove zeros starting from right end
char* ptr = s+slen-1;
while (*ptr=='0' && ptr>s+exp) ptr--;
if(ptr==s+exp) out = std::string(s,exp+1);
else out = std::string(s,exp+1)+'.'+std::string(s+exp+1,ptr-(s+exp+1)+1);
//out = string(s,exp+1)+'.'+string(s+exp+1);
}
else
{
// Remove zeros starting from right end
char* ptr = s+slen-1;
while (*ptr=='0' && ptr>s+exp-1) ptr--;
if(ptr==s+exp-1) out = std::string(s,exp);
else out = std::string(s,exp)+'.'+std::string(s+exp,ptr-(s+exp)+1);
//out = string(s,exp)+'.'+string(s+exp);
}
}else{ // exp<0 || exp>slen
if(s[0]=='-')
{
// Remove zeros starting from right end
char* ptr = s+slen-1;
while (*ptr=='0' && ptr>s+1) ptr--;
if(ptr==s+1) out = std::string(s,2);
else out = std::string(s,2)+'.'+std::string(s+2,ptr-(s+2)+1);
//out = string(s,2)+'.'+string(s+2);
}
else
{
// Remove zeros starting from right end
char* ptr = s+slen-1;
while (*ptr=='0' && ptr>s) ptr--;
if(ptr==s) out = std::string(s,1);
else out = std::string(s,1)+'.'+std::string(s+1,ptr-(s+1)+1);
//out = string(s,1)+'.'+string(s+1);
}
// Make final string
if(--exp)
{
if(exp>0) out += "e+"+mpfr::toString<mp_exp_t>(exp,std::dec);
else out += "e"+mpfr::toString<mp_exp_t>(exp,std::dec);
}
}
mpfr_free_str(s);
return out;
}else{
return "conversion error!";
}
#endif
}
//////////////////////////////////////////////////////////////////////////
// I/O
inline std::ostream& mpreal::output(std::ostream& os) const
{
std::ostringstream format;
const std::ios::fmtflags flags = os.flags();
format << ((flags & std::ios::showpos) ? "%+" : "%");
if (os.precision() >= 0)
format << '.' << os.precision() << "R*"
<< ((flags & std::ios::floatfield) == std::ios::fixed ? 'f' :
(flags & std::ios::floatfield) == std::ios::scientific ? 'e' :
'g');
else
format << "R*e";
char *s = NULL;
if(!(mpfr_asprintf(&s, format.str().c_str(),
mpfr::mpreal::get_default_rnd(),
mpfr_srcptr())
< 0))
{
os << std::string(s);
mpfr_free_str(s);
}
return os;
}
inline std::ostream& operator<<(std::ostream& os, const mpreal& v)
{
return v.output(os);
}
inline std::istream& operator>>(std::istream &is, mpreal& v)
{
// TODO: use cout::hexfloat and other flags to setup base
std::string tmp;
is >> tmp;
mpfr_set_str(v.mpfr_ptr(), tmp.c_str(), 10, mpreal::get_default_rnd());
return is;
}
//////////////////////////////////////////////////////////////////////////
// Bits - decimal digits relation
// bits = ceil(digits*log[2](10))
// digits = floor(bits*log[10](2))
inline mp_prec_t digits2bits(int d)
{
const double LOG2_10 = 3.3219280948873624;
return mp_prec_t(std::ceil( d * LOG2_10 ));
}
inline int bits2digits(mp_prec_t b)
{
const double LOG10_2 = 0.30102999566398119;
return int(std::floor( b * LOG10_2 ));
}
//////////////////////////////////////////////////////////////////////////
// Set/Get number properties
inline int sgn(const mpreal& op)
{
return mpfr_sgn(op.mpfr_srcptr());
}
inline mpreal& mpreal::setSign(int sign, mp_rnd_t RoundingMode)
{
mpfr_setsign(mpfr_ptr(), mpfr_srcptr(), (sign < 0 ? 1 : 0), RoundingMode);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline int mpreal::getPrecision() const
{
return int(mpfr_get_prec(mpfr_srcptr()));
}
inline mpreal& mpreal::setPrecision(int Precision, mp_rnd_t RoundingMode)
{
mpfr_prec_round(mpfr_ptr(), Precision, RoundingMode);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::setInf(int sign)
{
mpfr_set_inf(mpfr_ptr(), sign);
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::setNan()
{
mpfr_set_nan(mpfr_ptr());
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mpreal& mpreal::setZero(int sign)
{
#if (MPFR_VERSION >= MPFR_VERSION_NUM(3,0,0))
mpfr_set_zero(mpfr_ptr(), sign);
#else
mpfr_set_si(mpfr_ptr(), 0, (mpfr_get_default_rounding_mode)());
setSign(sign);
#endif
MPREAL_MSVC_DEBUGVIEW_CODE;
return *this;
}
inline mp_prec_t mpreal::get_prec() const
{
return mpfr_get_prec(mpfr_srcptr());
}
inline void mpreal::set_prec(mp_prec_t prec, mp_rnd_t rnd_mode)
{
mpfr_prec_round(mpfr_ptr(),prec,rnd_mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
}
inline mp_exp_t mpreal::get_exp ()
{
return mpfr_get_exp(mpfr_srcptr());
}
inline int mpreal::set_exp (mp_exp_t e)
{
int x = mpfr_set_exp(mpfr_ptr(), e);
MPREAL_MSVC_DEBUGVIEW_CODE;
return x;
}
inline const mpreal frexp(const mpreal& v, mp_exp_t* exp)
{
mpreal x(v);
*exp = x.get_exp();
x.set_exp(0);
return x;
}
inline const mpreal ldexp(const mpreal& v, mp_exp_t exp)
{
mpreal x(v);
// rounding is not important since we are just increasing the exponent (= exact operation)
mpfr_mul_2si(x.mpfr_ptr(), x.mpfr_srcptr(), exp, mpreal::get_default_rnd());
return x;
}
inline const mpreal scalbn(const mpreal& v, mp_exp_t exp)
{
return ldexp(v, exp);
}
inline mpreal machine_epsilon(mp_prec_t prec)
{
/* the smallest eps such that 1 + eps != 1 */
return machine_epsilon(mpreal(1, prec));
}
inline mpreal machine_epsilon(const mpreal& x)
{
/* the smallest eps such that x + eps != x */
if( x < 0)
{
return nextabove(-x) + x;
}else{
return nextabove( x) - x;
}
}
// minval is 'safe' meaning 1 / minval does not overflow
inline mpreal minval(mp_prec_t prec)
{
/* min = 1/2 * 2^emin = 2^(emin - 1) */
return mpreal(1, prec) << mpreal::get_emin()-1;
}
// maxval is 'safe' meaning 1 / maxval does not underflow
inline mpreal maxval(mp_prec_t prec)
{
/* max = (1 - eps) * 2^emax, eps is machine epsilon */
return (mpreal(1, prec) - machine_epsilon(prec)) << mpreal::get_emax();
}
inline bool isEqualUlps(const mpreal& a, const mpreal& b, int maxUlps)
{
return abs(a - b) <= machine_epsilon((max)(abs(a), abs(b))) * maxUlps;
}
inline bool isEqualFuzzy(const mpreal& a, const mpreal& b, const mpreal& eps)
{
return abs(a - b) <= eps;
}
inline bool isEqualFuzzy(const mpreal& a, const mpreal& b)
{
return isEqualFuzzy(a, b, machine_epsilon((max)(1, (min)(abs(a), abs(b)))));
}
//////////////////////////////////////////////////////////////////////////
// C++11 sign functions.
inline mpreal copysign(const mpreal& x, const mpreal& y, mp_rnd_t rnd_mode = mpreal::get_default_rnd())
{
mpreal rop(0, mpfr_get_prec(x.mpfr_ptr()));
mpfr_setsign(rop.mpfr_ptr(), x.mpfr_srcptr(), mpfr_signbit(y.mpfr_srcptr()), rnd_mode);
return rop;
}
inline bool signbit(const mpreal& x)
{
return mpfr_signbit(x.mpfr_srcptr());
}
inline const mpreal modf(const mpreal& v, mpreal& n)
{
mpreal f(v);
// rounding is not important since we are using the same number
mpfr_frac (f.mpfr_ptr(),f.mpfr_srcptr(),mpreal::get_default_rnd());
mpfr_trunc(n.mpfr_ptr(),v.mpfr_srcptr());
return f;
}
inline int mpreal::check_range (int t, mp_rnd_t rnd_mode)
{
return mpfr_check_range(mpfr_ptr(),t,rnd_mode);
}
inline int mpreal::subnormalize (int t,mp_rnd_t rnd_mode)
{
int r = mpfr_subnormalize(mpfr_ptr(),t,rnd_mode);
MPREAL_MSVC_DEBUGVIEW_CODE;
return r;
}
inline mp_exp_t mpreal::get_emin (void)
{
return mpfr_get_emin();
}
inline int mpreal::set_emin (mp_exp_t exp)
{
return mpfr_set_emin(exp);
}
inline mp_exp_t mpreal::get_emax (void)
{
return mpfr_get_emax();
}
inline int mpreal::set_emax (mp_exp_t exp)
{
return mpfr_set_emax(exp);
}
inline mp_exp_t mpreal::get_emin_min (void)
{
return mpfr_get_emin_min();
}
inline mp_exp_t mpreal::get_emin_max (void)
{
return mpfr_get_emin_max();
}
inline mp_exp_t mpreal::get_emax_min (void)
{
return mpfr_get_emax_min();
}
inline mp_exp_t mpreal::get_emax_max (void)
{
return mpfr_get_emax_max();
}
//////////////////////////////////////////////////////////////////////////
// Mathematical Functions
//////////////////////////////////////////////////////////////////////////
#define MPREAL_UNARY_MATH_FUNCTION_BODY(f) \
mpreal y(0, mpfr_get_prec(x.mpfr_srcptr())); \
mpfr_##f(y.mpfr_ptr(), x.mpfr_srcptr(), r); \
return y;
inline const mpreal sqr (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd())
{ MPREAL_UNARY_MATH_FUNCTION_BODY(sqr ); }
inline const mpreal sqrt (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd())
{ MPREAL_UNARY_MATH_FUNCTION_BODY(sqrt); }
inline const mpreal sqrt(const unsigned long int x, mp_rnd_t r)
{
mpreal y;
mpfr_sqrt_ui(y.mpfr_ptr(), x, r);
return y;
}
inline const mpreal sqrt(const unsigned int v, mp_rnd_t rnd_mode)
{
return sqrt(static_cast<unsigned long int>(v),rnd_mode);
}
inline const mpreal sqrt(const long int v, mp_rnd_t rnd_mode)
{
if (v>=0) return sqrt(static_cast<unsigned long int>(v),rnd_mode);
else return mpreal().setNan(); // NaN
}
inline const mpreal sqrt(const int v, mp_rnd_t rnd_mode)
{
if (v>=0) return sqrt(static_cast<unsigned long int>(v),rnd_mode);
else return mpreal().setNan(); // NaN
}
inline const mpreal root(const mpreal& x, unsigned long int k, mp_rnd_t r = mpreal::get_default_rnd())
{
mpreal y(0, mpfr_get_prec(x.mpfr_srcptr()));
mpfr_root(y.mpfr_ptr(), x.mpfr_srcptr(), k, r);
return y;
}
inline const mpreal dim(const mpreal& a, const mpreal& b, mp_rnd_t r = mpreal::get_default_rnd())
{
mpreal y(0, mpfr_get_prec(a.mpfr_srcptr()));
mpfr_dim(y.mpfr_ptr(), a.mpfr_srcptr(), b.mpfr_srcptr(), r);
return y;
}
inline int cmpabs(const mpreal& a,const mpreal& b)
{
return mpfr_cmpabs(a.mpfr_ptr(), b.mpfr_srcptr());
}
inline int sin_cos(mpreal& s, mpreal& c, const mpreal& v, mp_rnd_t rnd_mode = mpreal::get_default_rnd())
{
return mpfr_sin_cos(s.mpfr_ptr(), c.mpfr_ptr(), v.mpfr_srcptr(), rnd_mode);
}
inline const mpreal sqrt (const long double v, mp_rnd_t rnd_mode) { return sqrt(mpreal(v),rnd_mode); }
inline const mpreal sqrt (const double v, mp_rnd_t rnd_mode) { return sqrt(mpreal(v),rnd_mode); }
inline const mpreal cbrt (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(cbrt ); }
inline const mpreal fabs (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(abs ); }
inline const mpreal abs (const mpreal& x, mp_rnd_t r) { MPREAL_UNARY_MATH_FUNCTION_BODY(abs ); }
inline const mpreal log (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(log ); }
inline const mpreal log2 (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(log2 ); }
inline const mpreal log10 (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(log10); }
inline const mpreal exp (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(exp ); }
inline const mpreal exp2 (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(exp2 ); }
inline const mpreal exp10 (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(exp10); }
inline const mpreal cos (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(cos ); }
inline const mpreal sin (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(sin ); }
inline const mpreal tan (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(tan ); }
inline const mpreal sec (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(sec ); }
inline const mpreal csc (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(csc ); }
inline const mpreal cot (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(cot ); }
inline const mpreal acos (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(acos ); }
inline const mpreal asin (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(asin ); }
inline const mpreal atan (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(atan ); }
inline const mpreal logb (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { return log2 (abs(x),r); }
inline const mpreal acot (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return atan (1/v, r); }
inline const mpreal asec (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return acos (1/v, r); }
inline const mpreal acsc (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return asin (1/v, r); }
inline const mpreal acoth (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return atanh(1/v, r); }
inline const mpreal asech (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return acosh(1/v, r); }
inline const mpreal acsch (const mpreal& v, mp_rnd_t r = mpreal::get_default_rnd()) { return asinh(1/v, r); }
inline const mpreal cosh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(cosh ); }
inline const mpreal sinh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(sinh ); }
inline const mpreal tanh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(tanh ); }
inline const mpreal sech (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(sech ); }
inline const mpreal csch (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(csch ); }
inline const mpreal coth (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(coth ); }
inline const mpreal acosh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(acosh); }
inline const mpreal asinh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(asinh); }
inline const mpreal atanh (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(atanh); }
inline const mpreal log1p (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(log1p ); }
inline const mpreal expm1 (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(expm1 ); }
inline const mpreal eint (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(eint ); }
inline const mpreal gamma (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(gamma ); }
inline const mpreal tgamma (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(gamma ); }
inline const mpreal lngamma (const mpreal& x, mp_rnd_t r = mpreal::get_default_rnd()) { MPREAL_UNARY_MATH_FUNCTION_BODY(lngamma); }
inline const mpreal zeta (const mpreal& x, mp_rnd_t r = mpreal::get_default
gitextract_y7d5awgq/
├── .github/
│ └── workflows/
│ └── continuous_integration.yml
├── .gitignore
├── .semaphore/
│ └── semaphore.yml
├── LICENSE
├── Makefile
├── README.md
├── appveyor.yml
├── build/
│ ├── a.flx
│ ├── b.flx
│ ├── c.flx
│ ├── d.flx
│ ├── generate_test.py
│ ├── gltest.flx
│ ├── old/
│ │ └── raii_poc.flx
│ ├── run-test.ps1
│ ├── speed-test.py
│ ├── supertiny.flx
│ ├── tester.flx
│ ├── tests/
│ │ ├── anytest.flx
│ │ ├── arraytest.flx
│ │ ├── basic.flx
│ │ ├── classes.flx
│ │ ├── decomposition.flx
│ │ ├── defertest.flx
│ │ ├── fizzbuzz.flx
│ │ ├── forloops.flx
│ │ ├── functions.flx
│ │ ├── generics.flx
│ │ ├── intlimits.flx
│ │ ├── linkedlist.flx
│ │ ├── misc.flx
│ │ ├── operators.flx
│ │ ├── recursiveFib.flx
│ │ ├── scopes.flx
│ │ ├── slices.flx
│ │ ├── unions.flx
│ │ └── using.flx
│ ├── tiniest.flx
│ ├── tmp/
│ │ ├── repro_1.flx
│ │ ├── repro_2.flx
│ │ └── repro_3.flx
│ ├── tmp2/
│ │ ├── a.flx
│ │ ├── b.flx
│ │ └── c.flx
│ └── ultratiny.flx
├── changelog.md
├── external/
│ ├── mpreal/
│ │ └── mpreal.h
│ ├── tinyprocesslib/
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── process.cpp
│ │ ├── process_os.cpp
│ │ ├── process_unix.inc
│ │ ├── process_win.inc
│ │ └── tinyprocess.h
│ └── utf8rewind/
│ ├── LICENSE
│ ├── README.md
│ ├── include/
│ │ └── utf8rewind/
│ │ └── utf8rewind.h
│ ├── makefile
│ └── source/
│ ├── internal/
│ │ ├── base.h
│ │ ├── casemapping.c
│ │ ├── casemapping.h
│ │ ├── codepoint.c
│ │ ├── codepoint.h
│ │ ├── composition.c
│ │ ├── composition.h
│ │ ├── database.c
│ │ ├── database.h
│ │ ├── decomposition.c
│ │ ├── decomposition.h
│ │ ├── seeking.c
│ │ ├── seeking.h
│ │ ├── streaming.c
│ │ └── streaming.h
│ ├── unicodedatabase.c
│ ├── unicodedatabase.h
│ └── utf8rewind.c
├── issues.md
├── libs/
│ ├── OpenGL/
│ │ ├── GL.flx
│ │ └── GLUT.flx
│ ├── SDL2/
│ │ ├── Keyboard.flx
│ │ └── SDL.flx
│ ├── libc.flx
│ ├── os.flx
│ └── std/
│ ├── file.flx
│ ├── io.flx
│ ├── limits.flx
│ ├── map.flx
│ ├── math.flx
│ ├── opt.flx
│ ├── print.flx
│ └── set.flx
├── meson.build
├── notes.md
├── programs/
│ └── fic/
│ ├── main.flx
│ └── run.bat
├── roadmap.md
└── source/
├── backend/
│ ├── backend.cpp
│ ├── interp/
│ │ └── driver.cpp
│ ├── llvm/
│ │ ├── jit.cpp
│ │ ├── linker.cpp
│ │ └── translator.cpp
│ └── x64AsmBackend.cpp
├── codegen/
│ ├── alloc.cpp
│ ├── arithmetic.cpp
│ ├── assign.cpp
│ ├── autocasting.cpp
│ ├── builtin.cpp
│ ├── call.cpp
│ ├── classes.cpp
│ ├── codegenstate.cpp
│ ├── constructor.cpp
│ ├── controlflow.cpp
│ ├── destructure.cpp
│ ├── directives.cpp
│ ├── dotop.cpp
│ ├── enums.cpp
│ ├── function.cpp
│ ├── glue/
│ │ ├── any.cpp
│ │ ├── arrays.cpp
│ │ ├── misc.cpp
│ │ ├── saa_common.cpp
│ │ └── strings.cpp
│ ├── literals.cpp
│ ├── logical.cpp
│ ├── loops.cpp
│ ├── misc.cpp
│ ├── operators.cpp
│ ├── raii.cpp
│ ├── ranges.cpp
│ ├── refcounting.cpp
│ ├── sizeof.cpp
│ ├── slice.cpp
│ ├── structs.cpp
│ ├── subscript.cpp
│ ├── toplevel.cpp
│ ├── traits.cpp
│ ├── unions.cpp
│ └── variable.cpp
├── fir/
│ ├── ConstantValue.cpp
│ ├── Function.cpp
│ ├── GlobalValue.cpp
│ ├── IRBlock.cpp
│ ├── IRBuilder.cpp
│ ├── Instruction.cpp
│ ├── Module.cpp
│ ├── Name.cpp
│ ├── Types/
│ │ ├── ArraySliceType.cpp
│ │ ├── ArrayType.cpp
│ │ ├── ClassType.cpp
│ │ ├── DynamicArrayType.cpp
│ │ ├── EnumType.cpp
│ │ ├── FunctionType.cpp
│ │ ├── OpaqueType.cpp
│ │ ├── PointerType.cpp
│ │ ├── PrimitiveType.cpp
│ │ ├── RawUnionType.cpp
│ │ ├── SingleTypes.cpp
│ │ ├── StructType.cpp
│ │ ├── TraitType.cpp
│ │ ├── TupleType.cpp
│ │ ├── Type.cpp
│ │ ├── TypeUtils.cpp
│ │ └── UnionType.cpp
│ ├── Value.cpp
│ └── interp/
│ ├── compiler.cpp
│ ├── interpreter.cpp
│ └── wrappers.cpp
├── frontend/
│ ├── arguments.cpp
│ ├── collector.cpp
│ ├── dependencies.cpp
│ ├── errors.cpp
│ ├── file.cpp
│ ├── import.cpp
│ ├── lexer.cpp
│ ├── parser/
│ │ ├── controlflow.cpp
│ │ ├── expr.cpp
│ │ ├── function.cpp
│ │ ├── literal.cpp
│ │ ├── misc.cpp
│ │ ├── operators.cpp
│ │ ├── toplevel.cpp
│ │ ├── type.cpp
│ │ └── variable.cpp
│ └── pts.cpp
├── include/
│ ├── allocator.h
│ ├── ast.h
│ ├── backend.h
│ ├── backends/
│ │ ├── interp.h
│ │ └── llvm.h
│ ├── codegen.h
│ ├── container.h
│ ├── defs.h
│ ├── errors.h
│ ├── frontend.h
│ ├── gluecode.h
│ ├── ir/
│ │ ├── block.h
│ │ ├── constant.h
│ │ ├── function.h
│ │ ├── instruction.h
│ │ ├── interp.h
│ │ ├── irbuilder.h
│ │ ├── module.h
│ │ ├── type.h
│ │ └── value.h
│ ├── lexer.h
│ ├── memorypool.h
│ ├── parser.h
│ ├── parser_internal.h
│ ├── platform.h
│ ├── polymorph.h
│ ├── precompile.h
│ ├── pts.h
│ ├── repl.h
│ ├── resolver.h
│ ├── sst.h
│ ├── sst_expr.h
│ ├── stcommon.h
│ ├── string_consts.h
│ ├── typecheck.h
│ ├── zfu.h
│ ├── zpr.h
│ └── ztmu.h
├── main.cpp
├── misc/
│ ├── allocator.cpp
│ ├── destructors.cpp
│ ├── identifier.cpp
│ └── mpool.cpp
├── platform/
│ ├── backtrace.cpp
│ ├── compiler.cpp
│ ├── msvcfinder.cpp
│ └── platform.cpp
├── repl/
│ ├── commands.cpp
│ ├── driver.cpp
│ ├── execute.cpp
│ └── history.cpp
└── typecheck/
├── alloc.cpp
├── arithmetic.cpp
├── assign.cpp
├── call.cpp
├── classes.cpp
├── controlflow.cpp
├── defer.cpp
├── destructure.cpp
├── directives.cpp
├── dotop.cpp
├── enums.cpp
├── function.cpp
├── literals.cpp
├── loops.cpp
├── misc.cpp
├── operators.cpp
├── polymorph/
│ ├── driver.cpp
│ ├── instantiator.cpp
│ ├── misc.cpp
│ ├── solver.cpp
│ └── transforms.cpp
├── ranges.cpp
├── resolver/
│ ├── driver.cpp
│ ├── misc.cpp
│ └── resolver.cpp
├── sizeof.cpp
├── slice.cpp
├── special.cpp
├── structs.cpp
├── subscript.cpp
├── toplevel.cpp
├── traits.cpp
├── type.cpp
├── typecheckstate.cpp
├── unions.cpp
├── using.cpp
└── variable.cpp
SYMBOL INDEX (1516 symbols across 193 files)
FILE: build/generate_test.py
function gen_test (line 7) | def gen_test(reps):
FILE: external/mpreal/mpreal.h
function namespace (line 160) | namespace mpfr {
function mpreal (line 1102) | inline mpreal& mpreal::operator+=(const mpreal& v)
function mpreal (line 1109) | inline mpreal& mpreal::operator+=(const mpf_t u)
function mpreal (line 1116) | inline mpreal& mpreal::operator+=(const mpz_t u)
function mpreal (line 1123) | inline mpreal& mpreal::operator+=(const mpq_t u)
function mpreal (line 1130) | inline mpreal& mpreal::operator+= (const long double u)
function mpreal (line 1137) | inline mpreal& mpreal::operator+= (const double u)
function u (line 1149) | const unsigned long int u)
function u (line 1156) | const unsigned int u)
function u (line 1163) | const long int u)
function mpreal (line 1170) | inline mpreal& mpreal::operator+=(const int u)
function u (line 1177) | const long long int u) { *this += mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1178) | const unsigned long long int u){ *this += mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1179) | const long long int u) { *this -= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1180) | const unsigned long long int u){ *this -= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1181) | const long long int u) { *this *= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1182) | const unsigned long long int u){ *this *= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1183) | const long long int u) { *this /= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1184) | const unsigned long long int u){ *this /= mpreal(u); MPREAL_MSVC_DEBU...
function u (line 1539) | const unsigned long int u)
function u (line 1546) | const unsigned int u)
function u (line 1553) | const long int u)
function mpreal (line 1560) | inline mpreal& mpreal::operator<<=(const int u)
function u (line 1567) | const unsigned long int u)
function u (line 1574) | const unsigned int u)
function u (line 1581) | const long int u)
function mpreal (line 1588) | inline mpreal& mpreal::operator>>=(const int u)
function k (line 1600) | int k)
function k (line 1610) | int k)
function k (line 1620) | int k)
function k (line 1630) | int k)
function mpreal (line 1636) | inline const mpreal mul_2ui(const mpreal& v, unsigned long int k, mp_rnd...
function mpreal (line 1644) | inline const mpreal mul_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode)
function mpreal (line 1651) | inline const mpreal div_2ui(const mpreal& v, unsigned long int k, mp_rnd...
function mpreal (line 1658) | inline const mpreal div_2si(const mpreal& v, long int k, mp_rnd_t rnd_mode)
function operator (line 1678) | inline bool operator > (const mpreal& a, const mpreal& b ){ ...
function operator (line 1679) | inline bool operator > (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1680) | inline bool operator > (const mpreal& a, const unsigned int b ){ ...
function operator (line 1681) | inline bool operator > (const mpreal& a, const long int b ){ ...
function operator (line 1682) | inline bool operator > (const mpreal& a, const int b ){ ...
function operator (line 1683) | inline bool operator > (const mpreal& a, const long double b ){ ...
function operator (line 1684) | inline bool operator > (const mpreal& a, const double b ){ ...
function operator (line 1686) | inline bool operator >= (const mpreal& a, const mpreal& b ){ ...
function operator (line 1687) | inline bool operator >= (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1688) | inline bool operator >= (const mpreal& a, const unsigned int b ){ ...
function operator (line 1689) | inline bool operator >= (const mpreal& a, const long int b ){ ...
function operator (line 1690) | inline bool operator >= (const mpreal& a, const int b ){ ...
function operator (line 1691) | inline bool operator >= (const mpreal& a, const long double b ){ ...
function operator (line 1692) | inline bool operator >= (const mpreal& a, const double b ){ ...
function operator (line 1694) | inline bool operator < (const mpreal& a, const mpreal& b ){ ...
function operator (line 1695) | inline bool operator < (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1696) | inline bool operator < (const mpreal& a, const unsigned int b ){ ...
function operator (line 1697) | inline bool operator < (const mpreal& a, const long int b ){ ...
function operator (line 1698) | inline bool operator < (const mpreal& a, const int b ){ ...
function operator (line 1699) | inline bool operator < (const mpreal& a, const long double b ){ ...
function operator (line 1700) | inline bool operator < (const mpreal& a, const double b ){ ...
function operator (line 1702) | inline bool operator <= (const mpreal& a, const mpreal& b ){ ...
function operator (line 1703) | inline bool operator <= (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1704) | inline bool operator <= (const mpreal& a, const unsigned int b ){ ...
function operator (line 1705) | inline bool operator <= (const mpreal& a, const long int b ){ ...
function operator (line 1706) | inline bool operator <= (const mpreal& a, const int b ){ ...
function operator (line 1707) | inline bool operator <= (const mpreal& a, const long double b ){ ...
function operator (line 1708) | inline bool operator <= (const mpreal& a, const double b ){ ...
function operator (line 1710) | inline bool operator == (const mpreal& a, const mpreal& b ){ ...
function operator (line 1711) | inline bool operator == (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1712) | inline bool operator == (const mpreal& a, const unsigned int b ){ ...
function operator (line 1713) | inline bool operator == (const mpreal& a, const long int b ){ ...
function operator (line 1714) | inline bool operator == (const mpreal& a, const int b ){ ...
function operator (line 1715) | inline bool operator == (const mpreal& a, const long double b ){ ...
function operator (line 1716) | inline bool operator == (const mpreal& a, const double b ){ ...
function operator (line 1718) | inline bool operator != (const mpreal& a, const mpreal& b ){ ...
function operator (line 1719) | inline bool operator != (const mpreal& a, const unsigned long int b ){ ...
function operator (line 1720) | inline bool operator != (const mpreal& a, const unsigned int b ){ ...
function operator (line 1721) | inline bool operator != (const mpreal& a, const long int b ){ ...
function operator (line 1722) | inline bool operator != (const mpreal& a, const int b ){ ...
function operator (line 1723) | inline bool operator != (const mpreal& a, const long double b ){ ...
function operator (line 1724) | inline bool operator != (const mpreal& a, const double b ){ ...
function isnan (line 1726) | inline bool isnan (const mpreal& op){ return (mpfr_nan_p (op.mp...
function isinf (line 1727) | inline bool isinf (const mpreal& op){ return (mpfr_inf_p (op.mp...
function isfinite (line 1728) | inline bool isfinite (const mpreal& op){ return (mpfr_number_p (op.mp...
function iszero (line 1729) | inline bool iszero (const mpreal& op){ return (mpfr_zero_p (op.mp...
function isint (line 1730) | inline bool isint (const mpreal& op){ return (mpfr_integer_p(op.mp...
function isregular (line 1733) | inline bool isregular(const mpreal& op){ return (mpfr_regular_p(op.mp...
function toBool (line 1738) | inline bool mpreal::toBool ( ) const { ...
function toULong (line 1740) | inline unsigned long mpreal::toULong (mp_rnd_t mode) const { ...
function toFloat (line 1741) | inline float mpreal::toFloat (mp_rnd_t mode) const { ...
function toDouble (line 1742) | inline double mpreal::toDouble (mp_rnd_t mode) const { ...
function toLDouble (line 1743) | inline long double mpreal::toLDouble(mp_rnd_t mode) const { ...
function toLLong (line 1744) | inline long long mpreal::toLLong (mp_rnd_t mode) const { ...
function toULLong (line 1745) | inline unsigned long long mpreal::toULLong (mp_rnd_t mode) const { ...
function mpfr_ptr (line 1747) | inline ::mpfr_ptr mpreal::mpfr_ptr() { return mp; }
function mpreal (line 2192) | inline const mpreal sqrt(const unsigned long int x, mp_rnd_t r)
function mpreal (line 2199) | inline const mpreal sqrt(const unsigned int v, mp_rnd_t rnd_mode)
function mpreal (line 2204) | inline const mpreal sqrt(const long int v, mp_rnd_t rnd_mode)
function mpreal (line 2210) | inline const mpreal sqrt(const int v, mp_rnd_t rnd_mode)
function cmpabs (line 2230) | inline int cmpabs(const mpreal& a,const mpreal& b)
function mpreal (line 2240) | inline const mpreal sqrt (const long double v, mp_rnd_t rnd_mode) { ...
function mpreal (line 2241) | inline const mpreal sqrt (const double v, mp_rnd_t rnd_mode) { ...
function mpreal (line 2245) | inline const mpreal abs (const mpreal& x, mp_rnd_t r) ...
function mpreal (line 2531) | inline const mpreal ceil(const mpreal& v)
function mpreal (line 2538) | inline const mpreal floor(const mpreal& v)
function mpreal (line 2545) | inline const mpreal round(const mpreal& v)
function mpreal (line 2552) | inline const mpreal trunc(const mpreal& v)
function swap (line 2568) | inline void swap (mpreal& a, mpreal& b) { mpfr_swa...
function mpreal (line 2569) | inline const mpreal (max)(const mpreal& x, const mpreal& y){ return (...
function mpreal (line 2570) | inline const mpreal (min)(const mpreal& x, const mpreal& y){ return (...
function mpreal (line 2586) | inline const mpreal nexttoward (const mpreal& x, const mpreal& y)
function mpreal (line 2593) | inline const mpreal nextabove (const mpreal& x)
function mpreal (line 2600) | inline const mpreal nextbelow (const mpreal& x)
function mpreal (line 2607) | inline const mpreal urandomb (gmp_randstate_t& state)
function mpreal (line 2624) | inline const mpreal random2 (mp_size_t size, mp_exp_t exp)
function set_default_prec (line 2688) | inline void mpreal::set_default_prec(mp_prec_t prec)
function set_default_rnd (line 2693) | inline void mpreal::set_default_rnd(mp_rnd_t rnd_mode)
function fits_in_bits (line 2698) | inline bool mpreal::fits_in_bits(double x, int n)
function mpreal (line 2726) | inline const mpreal pow(const mpreal& a, const unsigned int b, mp_rnd_t ...
function mpreal (line 2738) | inline const mpreal pow(const mpreal& a, const int b, mp_rnd_t rnd_mode)
function mpreal (line 2743) | inline const mpreal pow(const mpreal& a, const long double b, mp_rnd_t r...
function mpreal (line 2748) | inline const mpreal pow(const mpreal& a, const double b, mp_rnd_t rnd_mode)
function mpreal (line 2760) | inline const mpreal pow(const unsigned int a, const mpreal& b, mp_rnd_t ...
function mpreal (line 2765) | inline const mpreal pow(const long int a, const mpreal& b, mp_rnd_t rnd_...
function mpreal (line 2771) | inline const mpreal pow(const int a, const mpreal& b, mp_rnd_t rnd_mode)
function mpreal (line 2777) | inline const mpreal pow(const long double a, const mpreal& b, mp_rnd_t r...
function mpreal (line 2782) | inline const mpreal pow(const double a, const mpreal& b, mp_rnd_t rnd_mode)
function mpreal (line 2788) | inline const mpreal pow(const unsigned long int a, const unsigned long i...
function mpreal (line 2795) | inline const mpreal pow(const unsigned long int a, const unsigned int b,...
function mpreal (line 2800) | inline const mpreal pow(const unsigned long int a, const long int b, mp_...
function mpreal (line 2806) | inline const mpreal pow(const unsigned long int a, const int b, mp_rnd_t...
function mpreal (line 2812) | inline const mpreal pow(const unsigned long int a, const long double b, ...
function mpreal (line 2817) | inline const mpreal pow(const unsigned long int a, const double b, mp_rn...
function mpreal (line 2823) | inline const mpreal pow(const unsigned int a, const unsigned long int b,...
function mpreal (line 2828) | inline const mpreal pow(const unsigned int a, const unsigned int b, mp_r...
function mpreal (line 2833) | inline const mpreal pow(const unsigned int a, const long int b, mp_rnd_t...
function mpreal (line 2839) | inline const mpreal pow(const unsigned int a, const int b, mp_rnd_t rnd_...
function mpreal (line 2845) | inline const mpreal pow(const unsigned int a, const long double b, mp_rn...
function mpreal (line 2850) | inline const mpreal pow(const unsigned int a, const double b, mp_rnd_t r...
function mpreal (line 2856) | inline const mpreal pow(const long int a, const unsigned long int b, mp_...
function mpreal (line 2862) | inline const mpreal pow(const long int a, const unsigned int b, mp_rnd_t...
function mpreal (line 2868) | inline const mpreal pow(const long int a, const long int b, mp_rnd_t rnd...
function mpreal (line 2879) | inline const mpreal pow(const long int a, const int b, mp_rnd_t rnd_mode)
function mpreal (line 2890) | inline const mpreal pow(const long int a, const long double b, mp_rnd_t ...
function mpreal (line 2896) | inline const mpreal pow(const long int a, const double b, mp_rnd_t rnd_m...
function mpreal (line 2903) | inline const mpreal pow(const int a, const unsigned long int b, mp_rnd_t...
function mpreal (line 2909) | inline const mpreal pow(const int a, const unsigned int b, mp_rnd_t rnd_...
function mpreal (line 2915) | inline const mpreal pow(const int a, const long int b, mp_rnd_t rnd_mode)
function mpreal (line 2926) | inline const mpreal pow(const int a, const int b, mp_rnd_t rnd_mode)
function mpreal (line 2937) | inline const mpreal pow(const int a, const long double b, mp_rnd_t rnd_m...
function mpreal (line 2943) | inline const mpreal pow(const int a, const double b, mp_rnd_t rnd_mode)
function mpreal (line 2950) | inline const mpreal pow(const long double a, const long double b, mp_rnd...
function mpreal (line 2955) | inline const mpreal pow(const long double a, const unsigned long int b, ...
function mpreal (line 2960) | inline const mpreal pow(const long double a, const unsigned int b, mp_rn...
function mpreal (line 2965) | inline const mpreal pow(const long double a, const long int b, mp_rnd_t ...
function mpreal (line 2970) | inline const mpreal pow(const long double a, const int b, mp_rnd_t rnd_m...
function mpreal (line 2975) | inline const mpreal pow(const double a, const double b, mp_rnd_t rnd_mode)
function mpreal (line 2980) | inline const mpreal pow(const double a, const unsigned long int b, mp_rn...
function mpreal (line 2985) | inline const mpreal pow(const double a, const unsigned int b, mp_rnd_t r...
function mpreal (line 2990) | inline const mpreal pow(const double a, const long int b, mp_rnd_t rnd_m...
function mpreal (line 2995) | inline const mpreal pow(const double a, const int b, mp_rnd_t rnd_mode)
function namespace (line 3004) | namespace std
function mpfr (line 3043) | inline static mpfr::mpreal epsilon(const mpfr::mpreal& x) { return mpfr...
function mpfr (line 3053) | inline static const mpfr::mpreal infinity() { return mpfr::const...
function mpfr (line 3054) | inline static const mpfr::mpreal quiet_NaN() { return mpfr::mprea...
function mpfr (line 3055) | inline static const mpfr::mpreal signaling_NaN() { return mpfr::mprea...
function mpfr (line 3056) | inline static const mpfr::mpreal denorm_min() { return (min)(); ...
function float_round_style (line 3072) | inline static float_round_style round_style()
function digits (line 3086) | inline static int digits() { return int(mpfr::...
function digits (line 3087) | inline static int digits(const mpfr::mpreal& x) { return x.getPreci...
function digits10 (line 3094) | inline static int digits10(const mpfr::mpreal& x)
FILE: external/tinyprocesslib/process.cpp
type tinyproclib (line 3) | namespace tinyproclib {
FILE: external/tinyprocesslib/tinyprocess.h
function namespace (line 14) | namespace tinyproclib {
FILE: external/utf8rewind/include/utf8rewind/utf8rewind.h
type utf16_t (line 694) | typedef uint16_t utf16_t;
type unicode_t (line 700) | typedef uint32_t unicode_t;
FILE: external/utf8rewind/source/internal/casemapping.c
function casemapping_initialize (line 71) | uint8_t casemapping_initialize(
function casemapping_execute (line 101) | size_t casemapping_execute(CaseMappingState* state, int32_t* errors)
FILE: external/utf8rewind/source/internal/casemapping.h
type CaseMappingState (line 38) | typedef struct {
FILE: external/utf8rewind/source/internal/codepoint.c
function codepoint_write (line 80) | uint8_t codepoint_write(unicode_t encoded, char** target, size_t* target...
function codepoint_read (line 161) | uint8_t codepoint_read(const char* input, size_t inputSize, unicode_t* d...
FILE: external/utf8rewind/source/internal/composition.c
function compose_initialize (line 31) | uint8_t compose_initialize(ComposeState* state, StreamState* input, Stre...
function compose_readcodepoint (line 66) | uint8_t compose_readcodepoint(ComposeState* state, uint8_t index)
function compose_execute (line 88) | uint8_t compose_execute(ComposeState* state)
FILE: external/utf8rewind/source/internal/composition.h
type ComposeState (line 39) | typedef struct {
FILE: external/utf8rewind/source/internal/database.c
function unicode_t (line 60) | unicode_t database_querycomposition(unicode_t left, unicode_t right)
FILE: external/utf8rewind/source/internal/database.h
type QuickCheckCaseMapped (line 40) | enum QuickCheckCaseMapped
type QuickCheckResult (line 48) | enum QuickCheckResult
FILE: external/utf8rewind/source/internal/decomposition.c
function decompose_initialize (line 31) | uint8_t decompose_initialize(
function decompose_execute (line 77) | uint8_t decompose_execute(DecomposeState* state)
FILE: external/utf8rewind/source/internal/decomposition.h
type DecomposeState (line 39) | typedef struct {
FILE: external/utf8rewind/source/internal/streaming.c
function stream_initialize (line 31) | uint8_t stream_initialize(StreamState* state, const char* input, size_t ...
function stream_read (line 49) | uint8_t stream_read(StreamState* state, const size_t* propertyIndex, con...
function stream_write (line 158) | uint8_t stream_write(StreamState* state, char** output, size_t* outputSi...
function stream_reorder (line 189) | uint8_t stream_reorder(StreamState* state)
FILE: external/utf8rewind/source/internal/streaming.h
type StreamState (line 61) | typedef struct {
FILE: external/utf8rewind/source/unicodedatabase.h
type DecompositionRecord (line 38) | typedef struct {
type CompositionRecord (line 43) | typedef struct {
FILE: external/utf8rewind/source/utf8rewind.c
function strncasecmp (line 40) | int strncasecmp(const char* s1, const char* s2, size_t n)
function utf8len (line 58) | size_t utf8len(const char* text)
function utf16toutf8 (line 119) | size_t utf16toutf8(const utf16_t* input, size_t inputSize, char* target,...
function utf32toutf8 (line 239) | size_t utf32toutf8(const unicode_t* input, size_t inputSize, char* targe...
function widetoutf8 (line 359) | size_t widetoutf8(const wchar_t* input, size_t inputSize, char* target, ...
function utf8toutf16 (line 370) | size_t utf8toutf16(const char* input, size_t inputSize, utf16_t* target,...
function utf8toutf32 (line 453) | size_t utf8toutf32(const char* input, size_t inputSize, unicode_t* targe...
function utf8towide (line 505) | size_t utf8towide(const char* input, size_t inputSize, wchar_t* target, ...
function UTF8_API (line 568) | UTF8_API size_t utf8envlocale()
function utf8toupper (line 626) | size_t utf8toupper(const char* input, size_t inputSize, char* target, si...
function utf8tolower (line 666) | size_t utf8tolower(const char* input, size_t inputSize, char* target, si...
function utf8totitle (line 706) | size_t utf8totitle(const char* input, size_t inputSize, char* target, si...
function utf8casefold (line 775) | size_t utf8casefold(const char* input, size_t inputSize, char* target, s...
function utf8isnormalized (line 958) | uint8_t utf8isnormalized(const char* input, size_t inputSize, size_t fla...
function utf8normalize (line 1071) | size_t utf8normalize(const char* input, size_t inputSize, char* target, ...
function utf8iscategory (line 1248) | size_t utf8iscategory(const char* input, size_t inputSize, size_t flags)
FILE: source/backend/backend.cpp
type backend (line 8) | namespace backend
function Backend (line 10) | Backend* Backend::getBackendFromOption(BackendOption opt, CompiledData...
function capabilitiesToString (line 33) | std::string capabilitiesToString(BackendCaps::Capabilities caps)
FILE: source/backend/interp/driver.cpp
type backend (line 18) | namespace backend
function _printTiming (line 21) | static void _printTiming(T ts, const std::string& thing)
FILE: source/backend/llvm/jit.cpp
function dealWithLLVMError (line 32) | static std::string dealWithLLVMError(const llvm::Error& err)
type backend (line 41) | namespace backend
function LLVMJit (line 82) | LLVMJit* LLVMJit::create()
FILE: source/backend/llvm/linker.cpp
function _printTiming (line 76) | static void _printTiming(T ts, const std::string& thing)
type backend (line 86) | namespace backend
function EntryPoint_t (line 411) | EntryPoint_t LLVMBackend::getEntryFunctionFromJIT()
FILE: source/backend/llvm/translator.cpp
type backend (line 52) | namespace backend
function llvmTyToString (line 58) | inline std::string llvmTyToString(llvm::Type* t)
function llvmToString (line 67) | inline std::string llvmToString(llvm::Value* t)
FILE: source/backend/x64AsmBackend.cpp
type backend (line 7) | namespace backend
FILE: source/codegen/alloc.cpp
function CGResult (line 184) | CGResult sst::AllocOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 197) | CGResult sst::DeallocOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/arithmetic.cpp
type sst (line 10) | namespace sst
function CGResult (line 12) | CGResult BinaryOp::_codegen(cgn::CodegenState* cs, fir::Type* inferred)
function CGResult (line 176) | CGResult UnaryOp::_codegen(cgn::CodegenState* cs, fir::Type* inferred)
type cgn (line 271) | namespace cgn
function CGResult (line 273) | CGResult CodegenState::performBinaryOperation(const Location& loc, std...
FILE: source/codegen/assign.cpp
function CGResult (line 13) | CGResult sst::AssignOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 133) | CGResult sst::TupleAssignOp::_codegen(cgn::CodegenState* cs, fir::Type* ...
FILE: source/codegen/autocasting.cpp
type cgn (line 11) | namespace cgn
FILE: source/codegen/builtin.cpp
function CGResult (line 40) | CGResult sst::BuiltinDotOp::_codegen(cgn::CodegenState* cs, fir::Type* i...
FILE: source/codegen/call.cpp
function _codegenAndArrangeFunctionCallArguments (line 27) | static std::vector<fir::Value*> _codegenAndArrangeFunctionCallArguments(...
function CGResult (line 240) | CGResult sst::FunctionCall::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 356) | static CGResult callBuiltinTypeConstructor(cgn::CodegenState* cs, fir::T...
function CGResult (line 416) | CGResult sst::ExprCall::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/classes.cpp
function CGResult (line 10) | CGResult sst::ClassDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/codegenstate.cpp
type cgn (line 11) | namespace cgn
function ControlFlowPoint (line 87) | ControlFlowPoint CodegenState::getCurrentCFPoint()
function ControlFlowPoint (line 99) | ControlFlowPoint CodegenState::leaveBreakableBody()
function BlockPoint (line 110) | BlockPoint CodegenState::getCurrentBlockPoint()
function Location (line 145) | Location CodegenState::loc()
FILE: source/codegen/constructor.cpp
function CGResult (line 134) | CGResult sst::StructConstructorCall::_codegen(cgn::CodegenState* cs, fir...
function CGResult (line 162) | CGResult sst::ClassConstructorCall::_codegen(cgn::CodegenState* cs, fir:...
function CGResult (line 180) | CGResult sst::BaseClassConstructorCall::_codegen(cgn::CodegenState* cs, ...
FILE: source/codegen/controlflow.cpp
function CGResult (line 15) | CGResult sst::IfStmt::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function doBlockEndThings (line 175) | static void doBlockEndThings(cgn::CodegenState* cs, const cgn::ControlFl...
function CGResult (line 202) | CGResult sst::BreakStmt::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 217) | CGResult sst::ContinueStmt::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 234) | CGResult sst::ReturnStmt::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 273) | CGResult sst::Block::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/destructure.cpp
function CGResult (line 11) | CGResult sst::DecompDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function handleDefn (line 24) | static void handleDefn(cgn::CodegenState* cs, sst::VarDefn* defn, CGResu...
function checkTuple (line 51) | static void checkTuple(cgn::CodegenState* cs, const DecompMapping& bind,...
function checkArray (line 79) | static void checkArray(cgn::CodegenState* cs, const DecompMapping& bind,...
FILE: source/codegen/directives.cpp
function CGResult (line 110) | CGResult sst::RunDirective::_codegen(cgn::CodegenState* cs, fir::Type* i...
FILE: source/codegen/dotop.cpp
function isAutoDereferencable (line 11) | static bool isAutoDereferencable(fir::Type* t)
function CGResult (line 16) | static CGResult getAppropriateValuePointer(cgn::CodegenState* cs, sst::E...
function CGResult (line 54) | CGResult sst::MethodDotOp::_codegen(cgn::CodegenState* cs, fir::Type* in...
function CGResult (line 96) | CGResult sst::FieldDotOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 175) | CGResult sst::TupleDotOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 203) | CGResult cgn::CodegenState::getStructFieldImplicitly(std::string name)
FILE: source/codegen/enums.cpp
function CGResult (line 8) | CGResult sst::EnumDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 56) | CGResult sst::EnumCaseDefn::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 90) | CGResult sst::EnumDotOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/function.cpp
function CGResult (line 12) | CGResult sst::FunctionDefn::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 102) | CGResult sst::ForeignFuncDefn::_codegen(cgn::CodegenState* cs, fir::Type...
function CGResult (line 139) | CGResult sst::ArgumentDefn::_codegen(cgn::CodegenState* cs, fir::Type* i...
FILE: source/codegen/glue/any.cpp
type cgn (line 10) | namespace cgn {
type glue (line 11) | namespace glue {
type any (line 12) | namespace any
function _doRefCount (line 14) | static void _doRefCount(CodegenState* cs, fir::Function* func, boo...
FILE: source/codegen/glue/arrays.cpp
type cgn (line 10) | namespace cgn {
type glue (line 11) | namespace glue {
type array (line 12) | namespace array
function _compareFunctionUsingBuiltinCompare (line 231) | static void _compareFunctionUsingBuiltinCompare(CodegenState* cs, ...
function _compareFunctionUsingOperatorFunction (line 385) | static void _compareFunctionUsingOperatorFunction(CodegenState* cs...
FILE: source/codegen/glue/misc.cpp
type cgn (line 10) | namespace cgn {
type glue (line 11) | namespace glue {
function printRuntimeError (line 13) | void printRuntimeError(cgn::CodegenState* cs, fir::Value* pos, const...
type misc (line 36) | namespace misc
function Idt (line 194) | Idt getOI(const std::string& name, fir::Type* t = 0)
function Idt (line 200) | Idt getCompare_FName(fir::Type* t) { return getOI("co...
function Idt (line 201) | Idt getSetElements_FName(fir::Type* t) { return getOI("se...
function Idt (line 202) | Idt getCallClassConstructor_FName(fir::Type* t) { return getOI("ca...
function Idt (line 203) | Idt getSetElementsDefault_FName(fir::Type* t) { return getOI("se...
function Idt (line 205) | Idt getClone_FName(fir::Type* t) { return getOI("clone", t...
function Idt (line 206) | Idt getAppend_FName(fir::Type* t) { return getOI("append", ...
function Idt (line 207) | Idt getPopBack_FName(fir::Type* t) { return getOI("popback",...
function Idt (line 208) | Idt getMakeFromOne_FName(fir::Type* t) { return getOI("makefromo...
function Idt (line 209) | Idt getMakeFromTwo_FName(fir::Type* t) { return getOI("makefromt...
function Idt (line 210) | Idt getReserveExtra_FName(fir::Type* t) { return getOI("reserveex...
function Idt (line 211) | Idt getAppendElement_FName(fir::Type* t) { return getOI("appendele...
function Idt (line 212) | Idt getReserveEnough_FName(fir::Type* t) { return getOI("reservesu...
function Idt (line 213) | Idt getRecursiveRefcount_FName(fir::Type* t, bool incr)
function Idt (line 218) | Idt getIncrRefcount_FName(fir::Type* t) { return getOI("in...
function Idt (line 219) | Idt getDecrRefcount_FName(fir::Type* t) { return getOI("de...
function Idt (line 220) | Idt getLoopIncrRefcount_FName(fir::Type* t) { return getOI("lo...
function Idt (line 221) | Idt getLoopDecrRefcount_FName(fir::Type* t) { return getOI("lo...
function Idt (line 223) | Idt getCreateAnyOf_FName(fir::Type* t) { return getOI("cr...
function Idt (line 224) | Idt getGetValueFromAny_FName(fir::Type* t) { return getOI("ge...
function Idt (line 226) | Idt getUtf8Length_FName() { return getOI("utf8_length"); }
function Idt (line 227) | Idt getRangeSanityCheck_FName() { return getOI("range_sanity"); }
function Idt (line 228) | Idt getMallocWrapper_FName() { return getOI("malloc_wrapper...
function Idt (line 229) | Idt getBoundsCheck_FName() { return getOI("boundscheck"); }
function Idt (line 230) | Idt getDecompBoundsCheck_FName() { return getOI("boundscheck_de...
FILE: source/codegen/glue/saa_common.cpp
type cgn (line 12) | namespace cgn {
type glue (line 13) | namespace glue {
type saa_common (line 14) | namespace saa_common
function isSAA (line 16) | static inline bool isSAA(fir::Type* t) { return t->isStringType() ...
function _callCloneFunctionInLoop (line 132) | static void _callCloneFunctionInLoop(CodegenState* cs, fir::Functi...
function _handleCallingAppropriateCloneFunction (line 172) | static void _handleCallingAppropriateCloneFunction(CodegenState* c...
FILE: source/codegen/glue/strings.cpp
type cgn (line 11) | namespace cgn {
type glue (line 12) | namespace glue {
type string (line 13) | namespace string
function _doRefCount (line 140) | static void _doRefCount(CodegenState* cs, fir::Function* func, boo...
FILE: source/codegen/literals.cpp
function CGResult (line 8) | CGResult sst::LiteralNumber::_codegen(cgn::CodegenState* cs, fir::Type* ...
function CGResult (line 31) | CGResult sst::LiteralArray::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 190) | CGResult sst::LiteralTuple::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 237) | CGResult sst::LiteralNull::_codegen(cgn::CodegenState* cs, fir::Type* in...
function CGResult (line 249) | CGResult sst::LiteralBool::_codegen(cgn::CodegenState* cs, fir::Type* in...
function CGResult (line 257) | CGResult sst::LiteralChar::_codegen(cgn::CodegenState* cs, fir::Type* in...
function CGResult (line 265) | CGResult sst::LiteralString::_codegen(cgn::CodegenState* cs, fir::Type* ...
FILE: source/codegen/logical.cpp
type cgn (line 9) | namespace cgn
function CGResult (line 11) | static CGResult doLogicalOr(CodegenState* cs, sst::BinaryOp* b)
function CGResult (line 60) | static CGResult doLogicalAnd(CodegenState* cs, sst::BinaryOp* b)
function CGResult (line 113) | CGResult CodegenState::performLogicalBinaryOperation(sst::BinaryOp* bo)
FILE: source/codegen/loops.cpp
function CGResult (line 9) | CGResult sst::WhileLoop::_codegen(cgn::CodegenState* cs, fir::Type* infe...
function CGResult (line 119) | CGResult sst::ForeachLoop::_codegen(cgn::CodegenState* cs, fir::Type* in...
FILE: source/codegen/misc.cpp
function CGResult (line 8) | CGResult sst::TypeExpr::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 13) | CGResult sst::ScopeExpr::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 18) | CGResult sst::BareTypeDefn::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 28) | CGResult sst::Stmt::codegen(cgn::CodegenState* cs, fir::Type* inferred)
function CGResult (line 33) | CGResult sst::Defn::codegen(cgn::CodegenState* cs, fir::Type* inferred)
FILE: source/codegen/operators.cpp
type cgn (line 8) | namespace cgn
FILE: source/codegen/raii.cpp
type cgn (line 9) | namespace cgn
function doMemberWiseStuffIfNecessary (line 143) | static void doMemberWiseStuffIfNecessary(CodegenState* cs, fir::ClassT...
function findRAIITraitImpl (line 301) | static bool findRAIITraitImpl(CodegenState* cs, fir::Type* ty, const s...
FILE: source/codegen/ranges.cpp
function CGResult (line 9) | CGResult sst::RangeExpr::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/refcounting.cpp
type cgn (line 9) | namespace cgn
function isStructuredAggregate (line 93) | static bool isStructuredAggregate(fir::Type* t)
function doRefCountOfAggregateType (line 100) | void doRefCountOfAggregateType(CodegenState* cs, T* type, fir::Value* ...
function _doRefCount (line 125) | static void _doRefCount(CodegenState* cs, fir::Value* val, bool incr)
FILE: source/codegen/sizeof.cpp
function CGResult (line 8) | CGResult sst::SizeofOp::_codegen(cgn::CodegenState* cs, fir::Type* infer...
function CGResult (line 18) | CGResult sst::TypeidOp::_codegen(cgn::CodegenState* cs, fir::Type* infer...
FILE: source/codegen/slice.cpp
function checkSliceOperation (line 11) | static void checkSliceOperation(cgn::CodegenState* cs, sst::Expr* user, ...
function CGResult (line 81) | static CGResult performSliceOperation(cgn::CodegenState* cs, sst::SliceO...
function CGResult (line 109) | CGResult sst::SliceOp::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 215) | CGResult sst::SplatExpr::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/structs.cpp
function CGResult (line 9) | CGResult sst::StructDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/subscript.cpp
function CGResult (line 9) | CGResult sst::SubscriptOp::_codegen(cgn::CodegenState* cs, fir::Type* in...
function CGResult (line 85) | CGResult sst::SubscriptDollarOp::_codegen(cgn::CodegenState* cs, fir::Ty...
FILE: source/codegen/toplevel.cpp
type cgn (line 17) | namespace cgn
function CGResult (line 54) | CGResult sst::NamespaceDefn::_codegen(cgn::CodegenState* cs, fir::Type* ...
FILE: source/codegen/traits.cpp
function CGResult (line 9) | CGResult sst::TraitDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/codegen/unions.cpp
function CGResult (line 8) | CGResult sst::UnionDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 16) | CGResult sst::UnionVariantDefn::_codegen(cgn::CodegenState* cs, fir::Typ...
function CGResult (line 21) | CGResult sst::RawUnionDefn::_codegen(cgn::CodegenState* cs, fir::Type* i...
function CGResult (line 27) | CGResult sst::UnionVariantConstructor::_codegen(cgn::CodegenState* cs, f...
FILE: source/codegen/variable.cpp
function CGResult (line 9) | CGResult sst::VarDefn::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 115) | CGResult sst::VarRef::_codegen(cgn::CodegenState* cs, fir::Type* infer)
function CGResult (line 163) | CGResult sst::SelfVarRef::_codegen(cgn::CodegenState* cs, fir::Type* infer)
FILE: source/fir/ConstantValue.cpp
type fir (line 14) | namespace fir
function ConstantValue (line 21) | ConstantValue* ConstantValue::getZeroValue(Type* type)
function ConstantValue (line 28) | ConstantValue* ConstantValue::getNull()
function ConstantBool (line 40) | ConstantBool* ConstantBool::get(bool val)
function ConstantBitcast (line 64) | ConstantBitcast* ConstantBitcast::get(ConstantValue* v, Type* t)
function ConstantNumber (line 81) | ConstantNumber* ConstantNumber::get(ConstantNumberType* cnt, const mpf...
function ConstantInt (line 100) | ConstantInt* ConstantInt::get(Type* intType, uint64_t val)
function ConstantInt (line 126) | ConstantInt* ConstantInt::getInt8(int8_t value)
function ConstantInt (line 131) | ConstantInt* ConstantInt::getInt16(int16_t value)
function ConstantInt (line 136) | ConstantInt* ConstantInt::getInt32(int32_t value)
function ConstantInt (line 141) | ConstantInt* ConstantInt::getInt64(int64_t value)
function ConstantInt (line 146) | ConstantInt* ConstantInt::getUint8(uint8_t value)
function ConstantInt (line 151) | ConstantInt* ConstantInt::getUint16(uint16_t value)
function ConstantInt (line 156) | ConstantInt* ConstantInt::getUint32(uint32_t value)
function ConstantInt (line 161) | ConstantInt* ConstantInt::getUint64(uint64_t value)
function ConstantInt (line 166) | ConstantInt* ConstantInt::getNative(int64_t value)
function ConstantInt (line 171) | ConstantInt* ConstantInt::getUNative(uint64_t value)
function ConstantFP (line 219) | ConstantFP* ConstantFP::get(Type* type, float val)
function ConstantFP (line 225) | ConstantFP* ConstantFP::get(Type* type, double val)
function ConstantFP (line 246) | ConstantFP* ConstantFP::getFloat32(float value)
function ConstantFP (line 251) | ConstantFP* ConstantFP::getFloat64(double value)
function ConstantStruct (line 272) | ConstantStruct* ConstantStruct::get(StructType* st, const std::vector<...
function ConstantCharSlice (line 320) | ConstantCharSlice* ConstantCharSlice::get(const std::string& s)
function ConstantTuple (line 344) | ConstantTuple* ConstantTuple::get(const std::vector<ConstantValue*>& m...
function mapTypes (line 354) | static std::vector<Type*> mapTypes(const std::vector<ConstantValue*>& vs)
function ConstantEnumCase (line 385) | ConstantEnumCase* ConstantEnumCase::get(EnumType* et, ConstantInt* ind...
function ConstantInt (line 390) | ConstantInt* ConstantEnumCase::getIndex()
function ConstantValue (line 395) | ConstantValue* ConstantEnumCase::getValue()
function ConstantArray (line 436) | ConstantArray* ConstantArray::get(Type* type, const std::vector<Consta...
function ConstantDynamicArray (line 455) | ConstantDynamicArray* ConstantDynamicArray::get(DynamicArrayType* t, C...
function ConstantDynamicArray (line 465) | ConstantDynamicArray* ConstantDynamicArray::get(ConstantArray* arr)
function ConstantDynamicString (line 485) | ConstantDynamicString* ConstantDynamicString::get(const std::string& s)
function ConstantArraySlice (line 510) | ConstantArraySlice* ConstantArraySlice::get(ArraySliceType* t, Constan...
FILE: source/fir/Function.cpp
type fir (line 10) | namespace fir
function Value (line 24) | Value* Argument::getActualValue()
function Function (line 30) | Function* Argument::getParentFunction()
function Type (line 70) | Type* Function::getReturnType()
function Argument (line 85) | Argument* Function::getArgumentWithName(std::string name)
function Function (line 179) | Function* Function::create(const Name& name, fir::FunctionType* fnType...
function FunctionType (line 188) | FunctionType* Function::getType()
FILE: source/fir/GlobalValue.cpp
type fir (line 10) | namespace fir
function ConstantValue (line 48) | ConstantValue* GlobalVariable::getInitialValue()
FILE: source/fir/IRBlock.cpp
type fir (line 8) | namespace fir
function Function (line 25) | Function* IRBlock::getParentFunction()
FILE: source/fir/IRBuilder.cpp
function isSAAType (line 17) | static bool isSAAType(fir::Type* t)
type fir (line 31) | namespace fir
function Function (line 64) | Function* IRBuilder::getCurrentFunction()
function IRBlock (line 69) | IRBlock* IRBuilder::getCurrentBlock()
function Instruction (line 76) | static Instruction* make_instr(OpKind kind, bool sideEffects, Type* ou...
function Value (line 82) | Value* IRBuilder::addInstruction(Instruction* instr, const std::string...
function Instruction (line 95) | static Instruction* getBinaryOpInstruction(const std::string& ao, Valu...
function Value (line 303) | Value* IRBuilder::BinaryOp(const std::string& ao, Value* a, Value* b, ...
function Value (line 341) | Value* IRBuilder::Negate(Value* a, const std::string& vname)
function Value (line 352) | Value* IRBuilder::Add(Value* a, Value* b, const std::string& vname)
function Value (line 367) | Value* IRBuilder::Subtract(Value* a, Value* b, const std::string& vname)
function Value (line 381) | Value* IRBuilder::Multiply(Value* a, Value* b, const std::string& vname)
function Value (line 395) | Value* IRBuilder::Divide(Value* a, Value* b, const std::string& vname)
function Value (line 410) | Value* IRBuilder::Modulo(Value* a, Value* b, const std::string& vname)
function Value (line 424) | Value* IRBuilder::FTruncate(Value* v, Type* targetType, const std::str...
function Value (line 434) | Value* IRBuilder::FExtend(Value* v, Type* targetType, const std::strin...
function Value (line 447) | Value* IRBuilder::ICmpEQ(Value* a, Value* b, const std::string& vname)
function Value (line 461) | Value* IRBuilder::ICmpNEQ(Value* a, Value* b, const std::string& vname)
function Value (line 475) | Value* IRBuilder::ICmpGT(Value* a, Value* b, const std::string& vname)
function Value (line 489) | Value* IRBuilder::ICmpLT(Value* a, Value* b, const std::string& vname)
function Value (line 503) | Value* IRBuilder::ICmpGEQ(Value* a, Value* b, const std::string& vname)
function Value (line 517) | Value* IRBuilder::ICmpLEQ(Value* a, Value* b, const std::string& vname)
function Value (line 535) | Value* IRBuilder::FCmpEQ_ORD(Value* a, Value* b, const std::string& vn...
function Value (line 544) | Value* IRBuilder::FCmpEQ_UNORD(Value* a, Value* b, const std::string& ...
function Value (line 552) | Value* IRBuilder::FCmpNEQ_ORD(Value* a, Value* b, const std::string& v...
function Value (line 560) | Value* IRBuilder::FCmpNEQ_UNORD(Value* a, Value* b, const std::string&...
function Value (line 568) | Value* IRBuilder::FCmpGT_ORD(Value* a, Value* b, const std::string& vn...
function Value (line 576) | Value* IRBuilder::FCmpGT_UNORD(Value* a, Value* b, const std::string& ...
function Value (line 584) | Value* IRBuilder::FCmpLT_ORD(Value* a, Value* b, const std::string& vn...
function Value (line 592) | Value* IRBuilder::FCmpLT_UNORD(Value* a, Value* b, const std::string& ...
function Value (line 600) | Value* IRBuilder::FCmpGEQ_ORD(Value* a, Value* b, const std::string& v...
function Value (line 608) | Value* IRBuilder::FCmpGEQ_UNORD(Value* a, Value* b, const std::string&...
function Value (line 616) | Value* IRBuilder::FCmpLEQ_ORD(Value* a, Value* b, const std::string& v...
function Value (line 624) | Value* IRBuilder::FCmpLEQ_UNORD(Value* a, Value* b, const std::string&...
function Value (line 634) | Value* IRBuilder::ICmpMulti(Value* a, Value* b, const std::string& vname)
function Value (line 642) | Value* IRBuilder::FCmpMulti(Value* a, Value* b, const std::string& vname)
function Value (line 659) | Value* IRBuilder::BitwiseXOR(Value* a, Value* b, const std::string& vn...
function Value (line 666) | Value* IRBuilder::BitwiseLogicalSHR(Value* a, Value* b, const std::str...
function Value (line 673) | Value* IRBuilder::BitwiseArithmeticSHR(Value* a, Value* b, const std::...
function Value (line 680) | Value* IRBuilder::BitwiseSHL(Value* a, Value* b, const std::string& vn...
function Value (line 687) | Value* IRBuilder::BitwiseAND(Value* a, Value* b, const std::string& vn...
function Value (line 694) | Value* IRBuilder::BitwiseOR(Value* a, Value* b, const std::string& vname)
function Value (line 701) | Value* IRBuilder::BitwiseNOT(Value* a, const std::string& vname)
function Value (line 707) | Value* IRBuilder::Bitcast(Value* v, Type* targetType, const std::strin...
function Value (line 714) | Value* IRBuilder::IntSizeCast(Value* v, Type* targetType, const std::s...
function Value (line 731) | Value* IRBuilder::IntSignednessCast(Value* v, Type* targetType, const ...
function Value (line 752) | Value* IRBuilder::FloatToIntCast(Value* v, Type* targetType, const std...
function Value (line 774) | Value* IRBuilder::IntToFloatCast(Value* v, Type* targetType, const std...
function Value (line 808) | Value* IRBuilder::PointerTypeCast(Value* v, Type* targetType, const st...
function Value (line 819) | Value* IRBuilder::PointerToIntCast(Value* v, Type* targetType, const s...
function Value (line 829) | Value* IRBuilder::IntToPointerCast(Value* v, Type* targetType, const s...
function Value (line 840) | Value* IRBuilder::IntTruncate(Value* v, Type* targetType, const std::s...
function Value (line 850) | Value* IRBuilder::IntZeroExt(Value* v, Type* targetType, const std::st...
function Value (line 864) | Value* IRBuilder::AppropriateCast(Value* v, Type* r, const std::string...
function Value (line 903) | Value* IRBuilder::Call(Function* fn, const std::string& vname)
function Value (line 908) | Value* IRBuilder::Call(Function* fn, Value* p1, const std::string& vname)
function Value (line 913) | Value* IRBuilder::Call(Function* fn, Value* p1, Value* p2, const std::...
function Value (line 918) | Value* IRBuilder::Call(Function* fn, Value* p1, Value* p2, Value* p3, ...
function Value (line 923) | Value* IRBuilder::Call(Function* fn, Value* p1, Value* p2, Value* p3, ...
function Value (line 929) | Value* IRBuilder::Call(Function* fn, const std::vector<Value*>& args, ...
function Value (line 1080) | Value* IRBuilder::Call(Function* fn, const std::initializer_list<Value...
function Value (line 1089) | Value* IRBuilder::CallToFunctionPointer(Value* fn, FunctionType* ft, c...
function Value (line 1099) | Value* IRBuilder::CallVirtualMethod(ClassType* cls, FunctionType* ft, ...
function Value (line 1138) | Value* IRBuilder::Return(Value* v)
function Value (line 1144) | Value* IRBuilder::ReturnVoid()
function Value (line 1151) | Value* IRBuilder::LogicalNot(Value* v, const std::string& vname)
function PHINode (line 1158) | PHINode* IRBuilder::CreatePHINode(Type* type, const std::string& vname)
function Value (line 1177) | Value* IRBuilder::StackAlloc(Type* type, const std::string& vname)
function Value (line 1205) | Value* IRBuilder::ImmutStackAlloc(Type* type, Value* v, const std::str...
function Value (line 1216) | Value* IRBuilder::CreateSliceFromSAA(Value* saa, bool mut, const std::...
function Value (line 1251) | Value* IRBuilder::GetRawUnionFieldByType(Value* lval, Type* type, cons...
function Value (line 1268) | Value* IRBuilder::GetRawUnionField(Value* lval, const std::string& fie...
function Instruction (line 1287) | static Instruction* doGEPOnCompoundType(T* type, Value* structPtr, siz...
function Value (line 1303) | Value* IRBuilder::StructGEP(Value* structPtr, size_t memberIndex, cons...
function Value (line 1336) | Value* IRBuilder::GetStructMember(Value* ptr, const std::string& membe...
function Value (line 1397) | Value* IRBuilder::ConstGEP2(Value* ptr, size_t ptrIndex, size_t elmInd...
function Value (line 1409) | Value* IRBuilder::GEP2(Value* ptr, Value* ptrIndex, Value* elmIndex, c...
function Value (line 1433) | Value* IRBuilder::GetPointer(Value* ptr, Value* ptrIndex, const std::s...
function Value (line 1450) | Value* IRBuilder::Select(Value* cond, Value* one, Value* two, const st...
function Value (line 1464) | Value* IRBuilder::Sizeof(Type* t, const std::string& vname)
function Value (line 1472) | Value* IRBuilder::CreateValue(Type* t, const std::string& vname)
function Instruction (line 1487) | static Instruction* _insertValue(Value* val, size_t idx, Type* et, Val...
function Instruction (line 1510) | static Instruction* _extractValue(Value* val, size_t idx, Type* et)
function Value (line 1532) | Value* IRBuilder::InsertValue(Value* val, const std::vector<size_t>& i...
function Value (line 1554) | Value* IRBuilder::ExtractValue(Value* val, const std::vector<size_t>& ...
function Value (line 1576) | Value* IRBuilder::InsertValueByName(Value* val, const std::string& n, ...
function Value (line 1591) | Value* IRBuilder::ExtractValueByName(Value* val, const std::string& n,...
function Value (line 1617) | Value* IRBuilder::GetSAAData(Value* arr, const std::string& vname)
function Value (line 1627) | Value* IRBuilder::SetSAAData(Value* arr, Value* val, const std::string...
function Value (line 1646) | Value* IRBuilder::GetSAALength(Value* arr, const std::string& vname)
function Value (line 1656) | Value* IRBuilder::SetSAALength(Value* arr, Value* val, const std::stri...
function Value (line 1671) | Value* IRBuilder::GetSAACapacity(Value* arr, const std::string& vname)
function Value (line 1681) | Value* IRBuilder::SetSAACapacity(Value* arr, Value* val, const std::st...
function Value (line 1696) | Value* IRBuilder::GetSAARefCountPointer(Value* arr, const std::string&...
function Value (line 1706) | Value* IRBuilder::SetSAARefCountPointer(Value* arr, Value* val, const ...
function Value (line 1721) | Value* IRBuilder::GetSAARefCount(Value* arr, const std::string& vname)
function Value (line 1755) | Value* IRBuilder::GetArraySliceData(Value* slc, const std::string& vname)
function Value (line 1768) | Value* IRBuilder::SetArraySliceData(Value* slc, Value* val, const std:...
function Value (line 1789) | Value* IRBuilder::GetArraySliceLength(Value* slc, const std::string& v...
function Value (line 1799) | Value* IRBuilder::SetArraySliceLength(Value* slc, Value* val, const st...
function Value (line 1819) | Value* IRBuilder::GetAnyTypeID(Value* any, const std::string& vname)
function Value (line 1829) | Value* IRBuilder::SetAnyTypeID(Value* any, Value* val, const std::stri...
function Value (line 1843) | Value* IRBuilder::GetAnyData(Value* any, const std::string& vname)
function Value (line 1854) | Value* IRBuilder::SetAnyData(Value* any, Value* val, const std::string...
function Value (line 1868) | Value* IRBuilder::GetAnyRefCountPointer(Value* arr, const std::string&...
function Value (line 1878) | Value* IRBuilder::SetAnyRefCountPointer(Value* arr, Value* val, const ...
function Value (line 1893) | Value* IRBuilder::GetAnyRefCount(Value* arr, const std::string& vname)
function Value (line 1922) | Value* IRBuilder::GetRangeLower(Value* range, const std::string& vname)
function Value (line 1932) | Value* IRBuilder::SetRangeLower(Value* range, Value* val, const std::s...
function Value (line 1945) | Value* IRBuilder::GetRangeUpper(Value* range, const std::string& vname)
function Value (line 1955) | Value* IRBuilder::SetRangeUpper(Value* range, Value* val, const std::s...
function Value (line 1968) | Value* IRBuilder::GetRangeStep(Value* range, const std::string& vname)
function Value (line 1978) | Value* IRBuilder::SetRangeStep(Value* range, Value* val, const std::st...
function Value (line 1994) | Value* IRBuilder::GetEnumCaseIndex(Value* ecs, const std::string& vname)
function Value (line 2004) | Value* IRBuilder::SetEnumCaseIndex(Value* ecs, Value* idx, const std::...
function Value (line 2017) | Value* IRBuilder::GetEnumCaseValue(Value* ecs, const std::string& vname)
function Value (line 2027) | Value* IRBuilder::SetEnumCaseValue(Value* ecs, Value* val, const std::...
function Value (line 2049) | Value* IRBuilder::ReadPtr(Value* ptr, const std::string& vname)
function getInstrThatMakesLValue (line 2086) | static std::pair<Instruction*, IRBlock*> getInstrThatMakesLValue(IRBui...
function Value (line 2107) | Value* IRBuilder::CreateLValue(Type* type, const std::string& vname)
function Value (line 2133) | Value* IRBuilder::Dereference(Value* val, const std::string& vname)
function Value (line 2147) | Value* IRBuilder::AddressOf(Value* lval, bool mut, const std::string& ...
function Value (line 2160) | Value* IRBuilder::SetUnionVariantData(Value* unn, size_t id, Value* da...
function Value (line 2174) | Value* IRBuilder::GetUnionVariantData(Value* unn, size_t id, const std...
function Value (line 2186) | Value* IRBuilder::GetUnionVariantID(Value* unn, const std::string& vname)
function Value (line 2195) | Value* IRBuilder::SetUnionVariantID(Value* unn, size_t id, const std::...
function IRBlock (line 2239) | IRBlock* IRBuilder::addNewBlockInFunction(const std::string& name, Fun...
function IRBlock (line 2262) | IRBlock* IRBuilder::addNewBlockAfter(const std::string& name, IRBlock*...
FILE: source/fir/Instruction.cpp
type fir (line 12) | namespace fir
function Value (line 26) | Value* Instruction::getResult()
FILE: source/fir/Module.cpp
type fir (line 10) | namespace fir
function GlobalVariable (line 72) | GlobalVariable* Module::createGlobalVariable(const Name& ident, Type* ...
function GlobalVariable (line 82) | GlobalVariable* Module::createGlobalVariable(const Name& id, Type* typ...
function GlobalVariable (line 87) | GlobalVariable* Module::declareGlobalVariable(const Name& id, Type* ty...
function GlobalVariable (line 92) | GlobalVariable* Module::tryGetGlobalVariable(const Name& id)
function GlobalVariable (line 100) | GlobalVariable* Module::getGlobalVariable(const Name& id)
function GlobalVariable (line 110) | GlobalVariable* Module::getOrCreateVirtualTableForClass(ClassType* cls)
function Function (line 151) | Function* Module::getEntryFunction()
function Type (line 164) | Type* Module::getNamedType(const Name& id)
function Function (line 207) | Function* Module::declareFunction(const Name& id, FunctionType* ftype)
function Function (line 212) | Function* Module::getFunction(const Name& id)
function Function (line 234) | Function* Module::getOrCreateFunction(const Name& id, FunctionType* ft...
function GlobalVariable (line 278) | GlobalVariable* Module::createGlobalString(const std::string& str)
function Function (line 396) | Function* Module::getIntrinsicFunction(const std::string& id)
FILE: source/fir/Name.cpp
type fir (line 7) | namespace fir
function Name (line 23) | Name Name::of(std::string name)
function Name (line 28) | Name Name::of(std::string name, std::vector<std::string> scope)
function Name (line 33) | Name Name::type(std::string name)
function Name (line 38) | Name Name::type(std::string name, std::vector<std::string> scope)
function Name (line 43) | Name Name::function(std::string name, std::vector<fir::Type*> params, ...
function Name (line 48) | Name Name::function(std::string name, std::vector<std::string> scope, ...
function mangleScopeOnly (line 57) | static std::string mangleScopeOnly(const fir::Name& id)
function lentypestr (line 70) | static inline std::string lentypestr(const std::string& s)
function mangleScopeName (line 75) | static std::string mangleScopeName(const fir::Name& id)
function mangleType (line 80) | static std::string mangleType(fir::Type* t)
function mangleName (line 161) | static std::string mangleName(const Name& id, bool includeScope)
function obfuscateName (line 257) | std::string obfuscateName(const std::string& name)
function obfuscateName (line 261) | std::string obfuscateName(const std::string& name, size_t id)
function obfuscateName (line 265) | std::string obfuscateName(const std::string& name, const std::string& ...
function Name (line 270) | Name Name::obfuscate(const std::string& name, NameKind kind)
function Name (line 274) | Name Name::obfuscate(const std::string& name, size_t id, NameKind kind)
function Name (line 278) | Name Name::obfuscate(const std::string& name, const std::string& extra...
type zpr (line 284) | namespace zpr
FILE: source/fir/Types/ArraySliceType.cpp
type fir (line 8) | namespace fir
function Type (line 18) | Type* ArraySliceType::getElementType()
function Type (line 28) | Type* ArraySliceType::getDataPointerType()
function ArraySliceType (line 67) | ArraySliceType* ArraySliceType::get(Type* elementType, bool mut)
function ArraySliceType (line 72) | ArraySliceType* ArraySliceType::getMutable(Type* elementType)
function ArraySliceType (line 77) | ArraySliceType* ArraySliceType::getImmutable(Type* elementType)
function ArraySliceType (line 82) | ArraySliceType* ArraySliceType::getVariadic(Type* elementType)
FILE: source/fir/Types/ArrayType.cpp
type fir (line 7) | namespace fir
function ArrayType (line 15) | ArrayType* ArrayType::get(Type* elementType, size_t num)
function Type (line 47) | Type* ArrayType::getElementType()
FILE: source/fir/Types/ClassType.cpp
type fir (line 9) | namespace fir
function ClassType (line 21) | ClassType* ClassType::create(const Name& name, const std::vector<std::...
function ClassType (line 31) | ClassType* ClassType::createWithoutBody(const Name& name)
function Name (line 64) | Name ClassType::getTypeName()
function Type (line 74) | Type* ClassType::getElement(const std::string& name)
function Function (line 193) | Function* ClassType::getDestructor()
function Function (line 198) | Function* ClassType::getCopyConstructor()
function Function (line 203) | Function* ClassType::getMoveConstructor()
function Function (line 229) | Function* ClassType::getMethodWithType(FunctionType* ftype)
function ClassType (line 297) | ClassType* ClassType::getBaseClass()
function Function (line 374) | Function* ClassType::getInlineInitialiser()
function Function (line 385) | Function* ClassType::getInlineDestructor()
FILE: source/fir/Types/DynamicArrayType.cpp
type fir (line 8) | namespace fir
function Type (line 15) | Type* DynamicArrayType::getElementType()
function DynamicArrayType (line 38) | DynamicArrayType* DynamicArrayType::get(Type* elementType)
FILE: source/fir/Types/EnumType.cpp
type fir (line 11) | namespace fir
function Name (line 18) | Name EnumType::getTypeName()
function Type (line 23) | Type* EnumType::getCaseType()
function EnumType (line 80) | EnumType* EnumType::get(const Name& name, Type* caseType)
FILE: source/fir/Types/FunctionType.cpp
type Codegen (line 8) | namespace Codegen
type fir (line 13) | namespace fir
function FunctionType (line 28) | FunctionType* FunctionType::getCVariadicFunc(const std::vector<Type*>&...
function FunctionType (line 33) | FunctionType* FunctionType::getCVariadicFunc(const std::initializer_li...
function FunctionType (line 38) | FunctionType* FunctionType::get(const std::vector<Type*>& args, Type* ...
function FunctionType (line 43) | FunctionType* FunctionType::get(const std::initializer_list<Type*>& ar...
function Type (line 88) | Type* FunctionType::getArgumentN(size_t n)
function Type (line 93) | Type* FunctionType::getReturnType()
FILE: source/fir/Types/OpaqueType.cpp
type fir (line 10) | namespace fir
function OpaqueType (line 40) | OpaqueType* OpaqueType::get(const std::string& name, size_t size)
FILE: source/fir/Types/PointerType.cpp
type fir (line 7) | namespace fir
function PointerType (line 15) | PointerType* PointerType::getMutable()
function PointerType (line 21) | PointerType* PointerType::getImmutable()
function PointerType (line 35) | PointerType* PointerType::getInt8Ptr()
function PointerType (line 40) | PointerType* PointerType::getInt16Ptr()
function PointerType (line 45) | PointerType* PointerType::getInt32Ptr()
function PointerType (line 50) | PointerType* PointerType::getInt64Ptr()
function PointerType (line 55) | PointerType* PointerType::getInt128Ptr()
function PointerType (line 61) | PointerType* PointerType::getUint8Ptr()
function PointerType (line 66) | PointerType* PointerType::getUint16Ptr()
function PointerType (line 71) | PointerType* PointerType::getUint32Ptr()
function PointerType (line 76) | PointerType* PointerType::getUint64Ptr()
function PointerType (line 81) | PointerType* PointerType::getUint128Ptr()
FILE: source/fir/Types/PrimitiveType.cpp
type fir (line 7) | namespace fir
function PrimitiveType (line 26) | PrimitiveType* PrimitiveType::getIntWithBitWidthAndSignage(size_t bits...
function PrimitiveType (line 41) | PrimitiveType* PrimitiveType::getFloatWithBitWidth(size_t bits)
function PrimitiveType (line 55) | PrimitiveType* PrimitiveType::getIntN(size_t bits)
function PrimitiveType (line 60) | PrimitiveType* PrimitiveType::getUintN(size_t bits)
function PrimitiveType (line 69) | PrimitiveType* PrimitiveType::getInt8()
function PrimitiveType (line 74) | PrimitiveType* PrimitiveType::getInt16()
function PrimitiveType (line 79) | PrimitiveType* PrimitiveType::getInt32()
function PrimitiveType (line 84) | PrimitiveType* PrimitiveType::getInt64()
function PrimitiveType (line 89) | PrimitiveType* PrimitiveType::getInt128()
function PrimitiveType (line 98) | PrimitiveType* PrimitiveType::getUint8()
function PrimitiveType (line 103) | PrimitiveType* PrimitiveType::getUint16()
function PrimitiveType (line 108) | PrimitiveType* PrimitiveType::getUint32()
function PrimitiveType (line 113) | PrimitiveType* PrimitiveType::getUint64()
function PrimitiveType (line 118) | PrimitiveType* PrimitiveType::getUint128()
function PrimitiveType (line 126) | PrimitiveType* PrimitiveType::getFloat32()
function PrimitiveType (line 131) | PrimitiveType* PrimitiveType::getFloat64()
function PrimitiveType (line 136) | PrimitiveType* PrimitiveType::getFloat128()
function PrimitiveType (line 212) | PrimitiveType* PrimitiveType::getOppositeSignedType()
FILE: source/fir/Types/RawUnionType.cpp
type fir (line 11) | namespace fir
function RawUnionType (line 21) | RawUnionType* RawUnionType::create(const Name& name, const util::hash_...
function RawUnionType (line 30) | RawUnionType* RawUnionType::createWithoutBody(const Name& name)
function Name (line 63) | Name RawUnionType::getTypeName()
function Type (line 83) | Type* RawUnionType::getVariant(const std::string& name)
FILE: source/fir/Types/SingleTypes.cpp
type fir (line 8) | namespace fir
function AnyType (line 17) | AnyType* AnyType::get() { return singleAny...
function BoolType (line 26) | BoolType* BoolType::get() { return singleBoo...
function VoidType (line 35) | VoidType* VoidType::get() { return singleVoi...
function NullType (line 44) | NullType* NullType::get() { return singleNul...
function RangeType (line 53) | RangeType* RangeType::get() { return singleRan...
function StringType (line 62) | StringType* StringType::get() { return singleStr...
function ConstantNumberType (line 81) | ConstantNumberType* ConstantNumberType::get(bool neg, bool flt, size_t...
function ConstantNumberType (line 104) | ConstantNumberType* unifyConstantTypes(ConstantNumberType* a, Constant...
function Type (line 113) | Type* getBestFitTypeForConstant(ConstantNumberType* cnt)
function PolyPlaceholderType (line 157) | PolyPlaceholderType* PolyPlaceholderType::get(const std::string& n, in...
FILE: source/fir/Types/StructType.cpp
type fir (line 10) | namespace fir
function StructType (line 21) | StructType* StructType::create(const Name& name, const std::vector<std...
function StructType (line 30) | StructType* StructType::createWithoutBody(const Name& name, bool isPac...
function Name (line 63) | Name StructType::getTypeName()
function Type (line 73) | Type* StructType::getElementN(size_t n)
function Type (line 80) | Type* StructType::getElement(const std::string& name)
FILE: source/fir/Types/TraitType.cpp
type fir (line 11) | namespace fir
function TraitType (line 21) | TraitType* TraitType::create(const Name& name)
function Name (line 57) | Name TraitType::getTypeName()
FILE: source/fir/Types/TupleType.cpp
type fir (line 8) | namespace fir
function Type (line 20) | Type* TupleType::getElementN(size_t n)
function TupleType (line 53) | TupleType* TupleType::get(const std::vector<Type*>& mems)
function TupleType (line 58) | TupleType* TupleType::get(const std::initializer_list<Type*>& mems)
FILE: source/fir/Types/Type.cpp
type pts (line 10) | namespace pts
type fir (line 15) | namespace fir
function TypeCache (line 18) | TypeCache& TypeCache::get()
function setNativeWordSizeInBits (line 25) | void setNativeWordSizeInBits(size_t sz)
function getNativeWordSizeInBits (line 34) | size_t getNativeWordSizeInBits()
function getCastDistance (line 41) | int getCastDistance(Type* from, Type* to)
function PrimitiveType (line 181) | PrimitiveType* Type::getNativeWord()
function PrimitiveType (line 186) | PrimitiveType* Type::getNativeUWord()
function PointerType (line 191) | PointerType* Type::getNativeWordPtr()
function Type (line 236) | Type* Type::getPointerTo()
function Type (line 248) | Type* Type::getMutablePointerTo()
function Type (line 261) | Type* Type::getMutablePointerVersion()
function Type (line 267) | Type* Type::getImmutablePointerVersion()
function Type (line 274) | Type* Type::getPointerElementType()
function Type (line 290) | Type* Type::getIndirectedType(int times)
function Type (line 310) | Type* Type::fromBuiltin(const std::string& builtin)
function Type (line 360) | Type* Type::getArrayElementType()
function _containsPlaceholders (line 386) | static bool _containsPlaceholders(fir::Type* ty, std::unordered_set<fi...
function PrimitiveType (line 479) | PrimitiveType* Type::toPrimitiveType()
function FunctionType (line 485) | FunctionType* Type::toFunctionType()
function PointerType (line 491) | PointerType* Type::toPointerType()
function StructType (line 497) | StructType* Type::toStructType()
function ClassType (line 503) | ClassType* Type::toClassType()
function TupleType (line 509) | TupleType* Type::toTupleType()
function ArrayType (line 515) | ArrayType* Type::toArrayType()
function DynamicArrayType (line 521) | DynamicArrayType* Type::toDynamicArrayType()
function ArraySliceType (line 527) | ArraySliceType* Type::toArraySliceType()
function RangeType (line 533) | RangeType* Type::toRangeType()
function StringType (line 539) | StringType* Type::toStringType()
function EnumType (line 545) | EnumType* Type::toEnumType()
function UnionType (line 551) | UnionType* Type::toUnionType()
function RawUnionType (line 557) | RawUnionType* Type::toRawUnionType()
function AnyType (line 563) | AnyType* Type::toAnyType()
function NullType (line 569) | NullType* Type::toNullType()
function ConstantNumberType (line 575) | ConstantNumberType* Type::toConstantNumberType()
function PolyPlaceholderType (line 581) | PolyPlaceholderType* Type::toPolyPlaceholderType()
function UnionVariantType (line 587) | UnionVariantType* Type::toUnionVariantType()
function OpaqueType (line 593) | OpaqueType* Type::toOpaqueType()
function TraitType (line 599) | TraitType* Type::toTraitType()
function VoidType (line 779) | VoidType* Type::getVoid()
function NullType (line 784) | NullType* Type::getNull()
function Type (line 789) | Type* Type::getVoidPtr()
function BoolType (line 794) | BoolType* Type::getBool()
function PrimitiveType (line 799) | PrimitiveType* Type::getInt8()
function PrimitiveType (line 804) | PrimitiveType* Type::getInt16()
function PrimitiveType (line 809) | PrimitiveType* Type::getInt32()
function PrimitiveType (line 814) | PrimitiveType* Type::getInt64()
function PrimitiveType (line 819) | PrimitiveType* Type::getInt128()
function PrimitiveType (line 824) | PrimitiveType* Type::getUint8()
function PrimitiveType (line 829) | PrimitiveType* Type::getUint16()
function PrimitiveType (line 834) | PrimitiveType* Type::getUint32()
function PrimitiveType (line 839) | PrimitiveType* Type::getUint64()
function PrimitiveType (line 844) | PrimitiveType* Type::getUint128()
function PrimitiveType (line 849) | PrimitiveType* Type::getFloat32()
function PrimitiveType (line 854) | PrimitiveType* Type::getFloat64()
function PrimitiveType (line 859) | PrimitiveType* Type::getFloat128()
function PointerType (line 865) | PointerType* Type::getInt8Ptr()
function PointerType (line 870) | PointerType* Type::getInt16Ptr()
function PointerType (line 875) | PointerType* Type::getInt32Ptr()
function PointerType (line 880) | PointerType* Type::getInt64Ptr()
function PointerType (line 885) | PointerType* Type::getInt128Ptr()
function PointerType (line 890) | PointerType* Type::getUint8Ptr()
function PointerType (line 895) | PointerType* Type::getUint16Ptr()
function PointerType (line 900) | PointerType* Type::getUint32Ptr()
function PointerType (line 905) | PointerType* Type::getUint64Ptr()
function PointerType (line 910) | PointerType* Type::getUint128Ptr()
function PointerType (line 918) | PointerType* Type::getMutInt8Ptr()
function PointerType (line 923) | PointerType* Type::getMutInt16Ptr()
function PointerType (line 928) | PointerType* Type::getMutInt32Ptr()
function PointerType (line 933) | PointerType* Type::getMutInt64Ptr()
function PointerType (line 938) | PointerType* Type::getMutInt128Ptr()
function PointerType (line 943) | PointerType* Type::getMutUint8Ptr()
function PointerType (line 948) | PointerType* Type::getMutUint16Ptr()
function PointerType (line 953) | PointerType* Type::getMutUint32Ptr()
function PointerType (line 958) | PointerType* Type::getMutUint64Ptr()
function PointerType (line 963) | PointerType* Type::getMutUint128Ptr()
function ArraySliceType (line 972) | ArraySliceType* Type::getCharSlice(bool mut)
function RangeType (line 977) | RangeType* Type::getRange()
function StringType (line 982) | StringType* Type::getString()
function AnyType (line 987) | AnyType* Type::getAny()
function getAggregateSize (line 1008) | static size_t getAggregateSize(const std::vector<Type*>& tys, bool pac...
function getSizeOfType (line 1048) | size_t getSizeOfType(Type* type)
function getAlignmentOfType (line 1142) | size_t getAlignmentOfType(Type* type)
function isRefCountedType (line 1149) | bool isRefCountedType(Type* type)
FILE: source/fir/Types/TypeUtils.cpp
type fir (line 9) | namespace fir
function _checkTypeVariance (line 11) | static bool _checkTypeVariance(Type* base, Type* derv, bool contra, bo...
function areTypesCovariant (line 62) | bool areTypesCovariant(Type* base, Type* derv)
function areTypesContravariant (line 67) | bool areTypesContravariant(Type* base, Type* derv, bool traitChecking)
function areTypeListsContravariant (line 72) | bool areTypeListsContravariant(const std::vector<Type*>& base, const s...
function areMethodsVirtuallyCompatible (line 91) | bool areMethodsVirtuallyCompatible(FunctionType* base, FunctionType* f...
FILE: source/fir/Types/UnionType.cpp
type fir (line 10) | namespace fir
function UnionType (line 20) | UnionType* UnionType::create(const Name& name, const util::hash_map<st...
function UnionType (line 29) | UnionType* UnionType::createWithoutBody(const Name& name)
function Name (line 62) | Name UnionType::getTypeName()
function UnionVariantType (line 91) | UnionVariantType* UnionType::getVariant(size_t id)
function UnionVariantType (line 100) | UnionVariantType* UnionType::getVariant(const std::string& name)
FILE: source/fir/Value.cpp
type fir (line 8) | namespace fir
function Type (line 16) | Type* Value::getType()
function Name (line 38) | const Name& Value::getName()
FILE: source/fir/interp/compiler.cpp
type fir (line 12) | namespace fir {
type interp (line 13) | namespace interp
function compileInstruction (line 15) | static interp::Instruction compileInstruction(InterpState* is, fir::...
function compileBlock (line 30) | static interp::Block compileBlock(InterpState* is, fir::Function* pa...
FILE: source/fir/interp/interpreter.cpp
type fir (line 56) | namespace fir {
type interp (line 57) | namespace interp
function makeValue (line 66) | static interp::Value makeValue(fir::Value* fv, const T& val)
function makeValueOfType (line 93) | static interp::Value makeValueOfType(fir::Value* fv, fir::Type* ty)
function T (line 116) | static T getActualValue(const interp::Value& v)
function cloneValue (line 129) | static interp::Value cloneValue(const interp::Value& v)
function cloneValue (line 141) | static interp::Value cloneValue(fir::Value* fv, const interp::Value& v)
function setValueRaw (line 155) | static void setValueRaw(InterpState* is, interp::Value* target, void...
function setValue (line 173) | static void setValue(InterpState* is, interp::Value* target, const i...
function loadFromPtr (line 196) | static interp::Value loadFromPtr(const interp::Value& x, fir::Type* ty)
function makeConstant (line 222) | static interp::Value makeConstant(InterpState* is, ConstantValue* c)
function ffi_type (line 569) | static ffi_type* convertTypeToLibFFI(fir::Type* ty)
function getOffsetOfTypeInTypeList (line 611) | static size_t getOffsetOfTypeInTypeList(const std::vector<fir::Type*...
function getTypeListOfType (line 626) | static std::vector<fir::Type*> getTypeListOfType(fir::Type* ty)
function doInsertValue (line 690) | static interp::Value doInsertValue(interp::InterpState* is, fir::Val...
function doExtractValue (line 732) | static interp::Value doExtractValue(interp::InterpState* is, fir::Va...
function oneArgumentOpIntOnly (line 780) | static interp::Value oneArgumentOpIntOnly(InterpState* is, fir::Type...
function oneArgumentOpIntOnly (line 802) | static interp::Value oneArgumentOpIntOnly(InterpState* is, const int...
function oneArgumentOp (line 811) | static interp::Value oneArgumentOp(InterpState* is, fir::Type* resty...
function oneArgumentOp (line 828) | static interp::Value oneArgumentOp(InterpState* is, const interp::In...
function twoArgumentOpIntOnly (line 839) | static interp::Value twoArgumentOpIntOnly(InterpState* is, fir::Type...
function twoArgumentOp (line 898) | static interp::Value twoArgumentOp(InterpState* is, fir::Type* resty...
function twoArgumentOpIntOnly (line 953) | static interp::Value twoArgumentOpIntOnly(InterpState* is, const int...
function twoArgumentOp (line 963) | static interp::Value twoArgumentOp(InterpState* is, const interp::In...
function complainAboutFFIEscape (line 975) | static void complainAboutFFIEscape(void* fnptr, fir::Type* fnty, con...
function runFunctionWithLibFFI (line 996) | static interp::Value runFunctionWithLibFFI(InterpState* is, void* fn...
function runFunctionWithLibFFI (line 1071) | static interp::Value runFunctionWithLibFFI(InterpState* is, fir::Fun...
function runFunctionWithLibFFI (line 1079) | static interp::Value runFunctionWithLibFFI(InterpState* is, const in...
function leaveFunction (line 1111) | static void leaveFunction(InterpState* is)
type InstrResult (line 1130) | struct InstrResult
function runBlock (line 1149) | static interp::Value runBlock(InterpState* is, const interp::Block* ...
function getVal (line 1290) | static interp::Value getVal(InterpState* is, fir::Value* fv)
function performGEP2 (line 1303) | static interp::Value performGEP2(InterpState* is, fir::Type* resty, ...
function performStructGEP (line 1328) | static interp::Value performStructGEP(InterpState* is, fir::Type* re...
function decay (line 1350) | static interp::Value decay(const interp::Value& val)
function getArg (line 1374) | static interp::Value getArg(InterpState* is, const interp::Instructi...
function setRet (line 1380) | static void setRet(InterpState* is, const interp::Instruction& inst,...
function areTypesSufficientlyEqual (line 1385) | static bool areTypesSufficientlyEqual(fir::Type* a, fir::Type* b)
function runInstruction (line 1392) | static int runInstruction(InterpState* is, const interp::Instruction...
FILE: source/fir/interp/wrappers.cpp
function PLATFORM_EXPORT_FUNCTION (line 12) | PLATFORM_EXPORT_FUNCTION
function PLATFORM_EXPORT_FUNCTION (line 18) | PLATFORM_EXPORT_FUNCTION
function PLATFORM_EXPORT_FUNCTION (line 24) | PLATFORM_EXPORT_FUNCTION
function PLATFORM_EXPORT_FUNCTION (line 30) | PLATFORM_EXPORT_FUNCTION
function PLATFORM_EXPORT_FUNCTION (line 36) | PLATFORM_EXPORT_FUNCTION
function PLATFORM_EXPORT_FUNCTION (line 57) | PLATFORM_EXPORT_FUNCTION int __interp_wrapper_printf(char* fmt, ...)
function PLATFORM_EXPORT_FUNCTION (line 68) | PLATFORM_EXPORT_FUNCTION int __interp_wrapper_sprintf(char* buf, char* f...
function PLATFORM_EXPORT_FUNCTION (line 79) | PLATFORM_EXPORT_FUNCTION int __interp_wrapper_snprintf(char* buf, size_t...
function PLATFORM_EXPORT_FUNCTION (line 90) | PLATFORM_EXPORT_FUNCTION int __interp_wrapper_fprintf(void* stream, char...
FILE: source/frontend/arguments.cpp
function setupMap (line 54) | static void setupMap()
function printHelp (line 94) | static void printHelp()
function parseQuotedString (line 123) | static std::string parseQuotedString(char** argv, int& i)
type frontend (line 149) | namespace frontend
function getVersion (line 151) | std::string getVersion()
function OptimisationLevel (line 189) | OptimisationLevel getOptLevel()
function ProgOutputMode (line 194) | ProgOutputMode getOutputMode()
function BackendOption (line 199) | BackendOption getBackendOption()
function getPrintProfileStats (line 204) | bool getPrintProfileStats()
function getIsNoRuntimeChecks (line 209) | bool getIsNoRuntimeChecks()
function getIsNoRuntimeErrorStrings (line 214) | bool getIsNoRuntimeErrorStrings()
function getAbortOnError (line 219) | bool getAbortOnError()
function getCanFFIEscape (line 224) | bool getCanFFIEscape()
function getIsReplMode (line 229) | bool getIsReplMode()
function getPrintFIR (line 234) | bool getPrintFIR()
function getPrintLLVMIR (line 239) | bool getPrintLLVMIR()
function getFrameworksToLink (line 244) | std::vector<std::string> getFrameworksToLink()
function getFrameworkSearchPaths (line 248) | std::vector<std::string> getFrameworkSearchPaths()
function getLibrariesToLink (line 253) | std::vector<std::string> getLibrariesToLink()
function getLibrarySearchPaths (line 258) | std::vector<std::string> getLibrarySearchPaths()
function getIsFreestanding (line 263) | bool getIsFreestanding()
function getIsNoStandardLibraries (line 268) | bool getIsNoStandardLibraries()
function getIsPositionIndependent (line 273) | bool getIsPositionIndependent()
function getParameter (line 279) | std::string getParameter(const std::string& name)
function setupFlagMutexes (line 305) | static void setupFlagMutexes()
function checkOptionExclusivity (line 336) | static void checkOptionExclusivity(const std::string& a)
function parseCmdLineOpts (line 352) | std::pair<std::string, std::string> parseCmdLineOpts(int argc, char** ...
FILE: source/frontend/collector.cpp
type frontend (line 14) | namespace frontend
function collectFiles (line 16) | void collectFiles(const std::string& _filename, CollectorState* state)
function parseFiles (line 39) | void parseFiles(CollectorState* state)
FILE: source/frontend/dependencies.cpp
type frontend (line 9) | namespace frontend
function stronglyConnect (line 97) | static void stronglyConnect(DependencyGraph* graph, int& index, std::v...
function checkForCycles (line 157) | std::vector<std::string> checkForCycles(const std::string& topmod, fro...
FILE: source/frontend/errors.cpp
function repeat (line 17) | static std::string repeat(std::string str, size_t n)
function spaces (line 47) | static std::string spaces(size_t n)
function fetchContextLine (line 52) | static std::string fetchContextLine(Location loc, size_t* adjust)
function getSpannedContext (line 94) | static std::string getSpannedContext(const Location& loc, const std::vec...
function getSingleContext (line 148) | static std::string getSingleContext(const Location& loc, const std::stri...
function __error_gen_internal (line 164) | std::string __error_gen_internal(const Location& loc, const std::string&...
function typestr (line 216) | static std::string typestr(MsgType t)
function strprinterrf (line 228) | static size_t strprinterrf(const char* fmt, Ts... ts)
function outputWithoutContext (line 234) | static void outputWithoutContext(const char* type, const Location& loc, ...
type util (line 279) | namespace util
function BareError (line 284) | BareError* make_BareError(const std::string& m, MsgType t)
function SpanError (line 289) | SpanError* make_SpanError(SimpleError* se, const std::vector<ESpan>& s...
function SimpleError (line 294) | SimpleError* make_SimpleError(const Location& l, const std::string& m,...
function OverloadError (line 299) | OverloadError* make_OverloadError(SimpleError* se, MsgType t)
function ExampleMsg (line 304) | ExampleMsg* make_ExampleMsg(const std::string& eg, MsgType t)
function SpanError (line 311) | SpanError* SpanError::add(const util::ESpan& s)
function OverloadError (line 430) | OverloadError& OverloadError::addCand(Locatable* d, ErrorMsg* sp)
function doTheExit (line 479) | [[noreturn]] void doTheExit(bool trace)
FILE: source/frontend/file.cpp
type frontend (line 18) | namespace frontend
function getRawLines (line 23) | static void getRawLines(const std::string_view& fileContents, bool* cr...
function tokenise (line 62) | static void tokenise(lexer::TokenList* ts, bool crlf, const std::strin...
function lex (line 112) | static void lex(FileInnards* innards, bool crlf, Location* pos)
function FileInnards (line 120) | FileInnards lexTokensFromString(const std::string& fakename, const std...
function FileInnards (line 141) | static FileInnards& readFileIfNecessary(const std::string& fullPath)
function FileInnards (line 171) | FileInnards& getFileState(const std::string& name)
function getFileContents (line 181) | std::string getFileContents(const std::string& fullPath)
function cachePreExistingFilename (line 189) | void cachePreExistingFilename(const std::string& name)
function getFileIDFromFilename (line 200) | size_t getFileIDFromFilename(const std::string& name)
function getPathFromFile (line 228) | std::string getPathFromFile(const std::string& path)
function getFilenameFromPath (line 239) | std::string getFilenameFromPath(const std::string& path)
function getFullPathOfFile (line 251) | std::string getFullPathOfFile(const std::string& partial)
function removeExtensionFromFilename (line 260) | std::string removeExtensionFromFilename(const std::string& name)
FILE: source/frontend/import.cpp
type frontend (line 11) | namespace frontend
function resolveImport (line 17) | std::string resolveImport(const std::string& imp, const Location& loc,...
type parser (line 67) | namespace parser
function parseImports (line 73) | std::vector<frontend::ImportThing> parseImports(const std::string& fil...
FILE: source/frontend/lexer.cpp
type lexer (line 12) | namespace lexer
function skipWhitespace (line 14) | static void skipWhitespace(string_view& line, Location& pos, size_t* o...
function hasPrefix (line 28) | static bool hasPrefix(const string_view& str, char const (&literal)[N])
function compare (line 38) | static bool compare(const string_view& str, char const (&literal)[N])
function shouldConsiderUnaryLiteral (line 51) | static bool shouldConsiderUnaryLiteral(string_view& stream, Location& ...
function initKeywordMap (line 81) | static void initKeywordMap()
function TokenType (line 136) | TokenType getNextToken(const util::FastInsertVector<string_view>& line...
FILE: source/frontend/parser/controlflow.cpp
type parser (line 10) | namespace parser
function parseIfStmt (line 15) | PResult<Stmt> parseIfStmt(State& st)
function ReturnStmt (line 132) | ReturnStmt* parseReturn(State& st)
function Stmt (line 158) | Stmt* parseForLoop(State& st)
function parseWhileLoop (line 213) | PResult<WhileLoop> parseWhileLoop(State& st)
function Stmt (line 272) | Stmt* parseBreak(State& st)
function Stmt (line 278) | Stmt* parseContinue(State& st)
FILE: source/frontend/parser/expr.cpp
type parser (line 16) | namespace parser
function parseStmtWithAccessSpec (line 20) | PResult<Stmt> parseStmtWithAccessSpec(State& st)
function parseStmt (line 51) | PResult<Stmt> parseStmt(State& st, bool allowExprs)
function isRightAssociative (line 286) | static bool isRightAssociative(TT tt)
function isPostfixUnaryOperator (line 291) | static bool isPostfixUnaryOperator(State& st, const Token& tk)
function unaryPrecedence (line 304) | static int unaryPrecedence(const std::string& op)
function tok_precedence (line 312) | static int tok_precedence(State& st, TokenType t)
function precedence (line 467) | static int precedence(State& st)
function Expr (line 493) | static Expr* parseRhs(State& st, Expr* lhs, int prio)
function Expr (line 631) | Expr* parseCaretOrColonScopeExpr(State& st)
function Expr (line 652) | static Expr* parseTuple(State& st, Expr* lhs)
function Expr (line 681) | Expr* parseDollarExpr(State& st)
function Expr (line 695) | static Expr* parseParenthesised(State& st)
function Expr (line 730) | static Expr* parseUnary(State& st)
function parseCallArgumentList (line 799) | std::vector<std::pair<std::string, Expr*>> parseCallArgumentList(State...
function FunctionCall (line 838) | static FunctionCall* parseFunctionCall(State& st, const Location& loc,...
function Expr (line 849) | static Expr* parseCall(State& st, Expr* lhs, Token op)
function Expr (line 869) | static Expr* parseIdentifier(State& st)
function Expr (line 902) | static Expr* parsePostfixUnary(State& st, Expr* lhs, Token op)
function Expr (line 1021) | static Expr* parseAlloc(State& st, bool raw)
function DeallocOp (line 1084) | DeallocOp* parseDealloc(State& st)
function DeferredStmt (line 1095) | DeferredStmt* parseDefer(State& st)
function SizeofOp (line 1109) | SizeofOp* parseSizeof(State& st)
function TypeidOp (line 1127) | TypeidOp* parseTypeid(State& st)
function Expr (line 1145) | Expr* parseExpr(State& st)
function Expr (line 1158) | static Expr* parsePrimary(State& st)
FILE: source/frontend/parser/function.cpp
type parser (line 15) | namespace parser
function parseFunctionLookingDecl (line 17) | std::tuple<std::vector<FuncDefn::Param>, std::vector<std::pair<std::st...
function parseFunctionDecl (line 120) | std::tuple<FuncDefn*, bool, Location> parseFunctionDecl(State& st)
function parseFunction (line 144) | PResult<FuncDefn> parseFunction(State& st)
function ForeignFuncDefn (line 170) | ForeignFuncDefn* parseForeignFunction(State& st)
function InitFunctionDefn (line 219) | InitFunctionDefn* parseInitFunction(State& st)
function InitFunctionDefn (line 263) | InitFunctionDefn* parseCopyOrMoveInitFunction(State& st, const std::st...
function InitFunctionDefn (line 293) | InitFunctionDefn* parseDeinitFunction(State& st)
function parseGenericTypeList (line 317) | std::vector<std::pair<std::string, TypeConstraints_t>> parseGenericTyp...
function parseBracedBlock (line 388) | PResult<Block> parseBracedBlock(State& st)
FILE: source/frontend/parser/literal.cpp
type parser (line 20) | namespace parser
function LitNumber (line 22) | LitNumber* parseNumber(State& st)
function parseHexEscapes (line 30) | static std::string parseHexEscapes(const Location& loc, std::string_vi...
function parseStringEscapes (line 94) | std::string parseStringEscapes(const Location& loc, const std::string&...
function LitString (line 134) | LitString* parseString(State& st, bool israw)
function LitArray (line 142) | LitArray* parseArray(State& st, bool israw)
FILE: source/frontend/parser/misc.cpp
type parser (line 13) | namespace parser
function ImportStmt (line 16) | ImportStmt* parseImport(State& st)
function UsingStmt (line 60) | UsingStmt* parseUsingStmt(State& st)
function RunDirective (line 84) | RunDirective* parseRunDirective(State& st)
function AttribSet (line 103) | AttribSet parseAttributes(State& st)
function PlatformDefn (line 177) | PlatformDefn* parsePlatformDefn(State& st)
FILE: source/frontend/parser/operators.cpp
type parser (line 17) | namespace parser
function OperatorOverloadDefn (line 19) | OperatorOverloadDefn* parseOperatorOverload(State& st)
function parseOperatorTokens (line 68) | std::string parseOperatorTokens(State& st)
function parseOperatorDecl (line 162) | size_t parseOperatorDecl(const lexer::TokenList& tokens, size_t idx, i...
function parseOperators (line 237) | std::tuple<util::hash_map<std::string, parser::CustomOperatorDecl>,
type Operator (line 297) | namespace Operator
function isArithmetic (line 345) | bool isArithmetic(const std::string& op)
function isBitwise (line 350) | bool isBitwise(const std::string& op)
function isAssignment (line 356) | bool isAssignment(const std::string& op)
function isComparison (line 364) | bool isComparison(const std::string& op)
function getNonAssignmentVersion (line 371) | std::string getNonAssignmentVersion(const std::string& op)
FILE: source/frontend/parser/toplevel.cpp
type parser (line 18) | namespace parser
function parseIdentPath (line 20) | std::pair<Location, std::vector<std::string>> parseIdentPath(const lex...
function parseModuleName (line 51) | static std::pair<std::string, std::vector<std::string>> parseModuleNam...
function TopLevelBlock (line 103) | TopLevelBlock* parseTopLevel(State& st, const std::string& name)
function ParsedFile (line 304) | ParsedFile parseFile(const std::string& fullname, const frontend::File...
FILE: source/frontend/parser/type.cpp
type fir (line 14) | namespace fir
type parser (line 20) | namespace parser
function addSelfToMethod (line 25) | static void addSelfToMethod(T* thing, bool mutating)
function ClassDefn (line 38) | ClassDefn* parseClass(State& st)
function parseStruct (line 175) | PResult<StructDefn> parseStruct(State& st, bool nameless)
function UnionDefn (line 314) | UnionDefn* parseUnion(State& st, bool israw, bool nameless)
function EnumDefn (line 442) | EnumDefn* parseEnum(State& st)
function TraitDefn (line 536) | TraitDefn* parseTrait(State& st)
function StaticDecl (line 627) | StaticDecl* parseStaticDecl(State& st)
function PolyArgMapping_t (line 882) | PolyArgMapping_t parsePAMs(State& st, bool* failed)
FILE: source/frontend/parser/variable.cpp
type parser (line 15) | namespace parser
function DecompMapping (line 17) | static DecompMapping recursivelyParseDecomp(State& st)
function DecompVarDefn (line 92) | DecompVarDefn* parseDecompDecl(State& st)
function DecompMapping (line 137) | DecompMapping parseTupleDecomp(State& st)
function Stmt (line 155) | Stmt* parseVariable(State& st)
FILE: source/frontend/pts.cpp
type pts (line 8) | namespace pts
function unwrapPointerType (line 10) | std::string unwrapPointerType(const std::string& type, int* _indirecti...
function NamedType (line 34) | NamedType* Type::toNamedType()
function PointerType (line 39) | PointerType* Type::toPointerType()
function TupleType (line 44) | TupleType* Type::toTupleType()
function FixedArrayType (line 49) | FixedArrayType* Type::toFixedArrayType()
function DynamicArrayType (line 54) | DynamicArrayType* Type::toDynamicArrayType()
function VariadicArrayType (line 59) | VariadicArrayType* Type::toVariadicArrayType()
function FunctionType (line 64) | FunctionType* Type::toFunctionType()
function ArraySliceType (line 69) | ArraySliceType* Type::toArraySliceType()
function InferredType (line 125) | InferredType* InferredType::get()
function NamedType (line 131) | NamedType* NamedType::create(const Location& l, const std::string& s)
function NamedType (line 136) | NamedType* NamedType::create(const Location& l, const std::string& s, ...
FILE: source/include/allocator.h
function namespace (line 9) | namespace mem
FILE: source/include/ast.h
function namespace (line 13) | namespace pts
function namespace (line 18) | namespace fir
function namespace (line 23) | namespace sst
function Locatable (line 32) | struct Stmt : Locatable
function Stmt (line 41) | struct Expr : Stmt
function Stmt (line 56) | struct DeferredStmt : Stmt
type TypeDefn (line 66) | struct TypeDefn
function Stmt (line 67) | struct Parameterisable : Stmt
function Stmt (line 110) | struct ImportStmt : Stmt
function Stmt (line 118) | struct Block : Stmt
function Parameterisable (line 137) | struct FuncDefn : Parameterisable
function Parameterisable (line 167) | struct InitFunctionDefn : Parameterisable
function Stmt (line 188) | struct ForeignFuncDefn : Stmt
type OperatorOverloadDefn (line 211) | struct OperatorOverloadDefn
function FuncDefn (line 213) | OperatorOverloadDefn(const Location& l) : FuncDefn(l) { this->readableNa...
function Kind (line 219) | enum class Kind
function Stmt (line 231) | struct VarDefn : Stmt
function Stmt (line 253) | struct DecompVarDefn : Stmt
function Stmt (line 266) | struct PlatformDefn : Stmt
FILE: source/include/backend.h
function namespace (line 9) | namespace fir
type CompiledData (line 17) | struct CompiledData
function namespace (line 22) | namespace BackendCaps
type class (line 34) | enum class
function ProgOutputMode (line 46) | enum class ProgOutputMode
FILE: source/include/backends/interp.h
function namespace (line 8) | namespace fir::interp
function namespace (line 13) | namespace backend
FILE: source/include/backends/llvm.h
function namespace (line 55) | namespace llvm
function namespace (line 65) | namespace backend
FILE: source/include/codegen.h
function namespace (line 11) | namespace fir
function namespace (line 22) | namespace sst
function namespace (line 37) | namespace cgn
FILE: source/include/container.h
function namespace (line 16) | namespace util
FILE: source/include/defs.h
type Identifier (line 14) | struct Identifier
type class (line 15) | enum class
function namespace (line 17) | namespace fir { struct Type; struct Name; }
function namespace (line 18) | namespace pts { struct Type; }
function namespace (line 21) | namespace zpr
function Identifier (line 36) | struct print_formatter<Identifier>
function VisibilityLevel (line 42) | struct print_formatter<VisibilityLevel>
function _error_and_exit (line 54) | [[noreturn]] inline void _error_and_exit(const char* fmt, Ts&&... ts)
function namespace (line 60) | namespace platform { void printStackTrace(); }
function compiler_crash (line 63) | [[noreturn]] inline void compiler_crash(const char* fmt, Ts&&... ts)
function string (line 73) | string strprintf(const char* fmt, Ts&&... ts)
function namespace (line 91) | namespace util
function namespace (line 97) | namespace fir
function namespace (line 103) | namespace sst
function IdKind (line 110) | enum class IdKind
type Locatable (line 235) | struct Locatable
type BareError (line 245) | struct BareError
type SpanError (line 246) | struct SpanError
type SimpleError (line 247) | struct SimpleError
type OverloadError (line 248) | struct OverloadError
type ExampleMsg (line 249) | struct ExampleMsg
function ErrKind (line 252) | enum class ErrKind
function virtual (line 400) | virtual void post() override;
function virtual (line 402) | virtual SpanError* prepend(ErrorMsg* e) override { this->subs.insert(thi...
function ErrorMsg (line 421) | struct OverloadError : ErrorMsg
function virtual (line 428) | virtual void post() override;
function virtual (line 430) | virtual OverloadError* prepend(ErrorMsg* e) override { this->subs.insert...
type ErrorException (line 449) | struct ErrorException
function err (line 451) | err(msg) { }
function TCResult (line 457) | struct TCResult
function explicit (line 485) | explicit TCResult(sst::Stmt* s) : _kind(RK::Statement) { _st = s; }
function explicit (line 486) | explicit TCResult(sst::Expr* e) : _kind(RK::Expression) { _ex = e; }
function explicit (line 487) | explicit TCResult(sst::Defn* d) : _kind(RK::Definition) { _df = d; }
function explicit (line 489) | explicit TCResult(ErrorMsg* pe) : _kind(RK::Error) { _pe = pe; }
function ErrorMsg (line 535) | ErrorMsg* error() const { if(this->_kind != RK::Error || !this->_pe) ...
function TCResult (line 551) | static TCResult getParametric() { return TCResult(RK::Parametric); }
function TCResult (line 552) | static TCResult getDummy() { return TCResult(RK::Dummy); }
type CGResult (line 562) | struct CGResult
function namespace (line 582) | namespace std
function VisibilityLevel (line 604) | enum class VisibilityLevel
function namespace (line 648) | namespace util
function namespace (line 688) | namespace Operator
function namespace (line 754) | namespace std
function namespace (line 781) | namespace __dontlook
FILE: source/include/errors.h
function namespace (line 69) | namespace frontend
function string (line 79) | string __error_gen(const Location& loc, const char* msg, const char* typ...
FILE: source/include/frontend.h
function namespace (line 17) | namespace sst
function namespace (line 22) | namespace fir
function namespace (line 27) | namespace backend
function namespace (line 34) | namespace frontend
FILE: source/include/gluecode.h
function namespace (line 33) | namespace fir
function namespace (line 43) | namespace sst
function namespace (line 48) | namespace cgn
FILE: source/include/ir/block.h
function namespace (line 14) | namespace fir
FILE: source/include/ir/constant.h
function namespace (line 14) | namespace fir
FILE: source/include/ir/function.h
function namespace (line 14) | namespace fir
FILE: source/include/ir/instruction.h
function namespace (line 14) | namespace fir
FILE: source/include/ir/interp.h
function namespace (line 14) | namespace fir
FILE: source/include/ir/irbuilder.h
function namespace (line 17) | namespace fir
FILE: source/include/ir/module.h
function namespace (line 15) | namespace fir
FILE: source/include/ir/type.h
function NameKind (line 12) | enum class NameKind
type Type (line 94) | struct Type
type Module (line 95) | struct Module
type AnyType (line 96) | struct AnyType
type BoolType (line 97) | struct BoolType
type EnumType (line 98) | struct EnumType
type NullType (line 99) | struct NullType
type VoidType (line 100) | struct VoidType
type ArrayType (line 101) | struct ArrayType
type ClassType (line 102) | struct ClassType
type RangeType (line 103) | struct RangeType
type TraitType (line 104) | struct TraitType
type TupleType (line 105) | struct TupleType
type UnionType (line 106) | struct UnionType
type StringType (line 107) | struct StringType
type StructType (line 108) | struct StructType
type OpaqueType (line 109) | struct OpaqueType
type PointerType (line 110) | struct PointerType
type FunctionType (line 111) | struct FunctionType
type RawUnionType (line 112) | struct RawUnionType
type PrimitiveType (line 113) | struct PrimitiveType
type ArraySliceType (line 114) | struct ArraySliceType
type DynamicArrayType (line 115) | struct DynamicArrayType
type UnionVariantType (line 116) | struct UnionVariantType
type ConstantNumberType (line 117) | struct ConstantNumberType
type PolyPlaceholderType (line 118) | struct PolyPlaceholderType
type ConstantValue (line 120) | struct ConstantValue
type ConstantArray (line 121) | struct ConstantArray
type Function (line 122) | struct Function
function TypeKind (line 143) | enum class TypeKind
type BoolType (line 381) | struct BoolType
function virtual (line 385) | virtual std::string str() override;
FILE: source/include/ir/value.h
function namespace (line 15) | namespace fir
FILE: source/include/lexer.h
function namespace (line 9) | namespace lexer
FILE: source/include/memorypool.h
function namespace (line 9) | namespace util
FILE: source/include/parser.h
function namespace (line 9) | namespace ast
function namespace (line 14) | namespace frontend
function namespace (line 21) | namespace parser
FILE: source/include/parser_internal.h
function namespace (line 14) | namespace pts
function namespace (line 19) | namespace parser
function ErrorMsg (line 346) | ErrorMsg* err() const
function T (line 352) | T* val() const
function PResult (line 373) | static PResult<T> insufficientTokensError()
function expected (line 404) | [[noreturn]] inline void expected(const Location& loc, std::string a, st...
function expectedAfter (line 410) | [[noreturn]] inline void expectedAfter(const Location& loc, std::string ...
function unexpected (line 416) | [[noreturn]] inline void unexpected(const Location& loc, std::string a)
FILE: source/include/platform.h
function namespace (line 50) | namespace platform
function namespace (line 59) | namespace platform
function namespace (line 71) | namespace platform
FILE: source/include/polymorph.h
function namespace (line 13) | namespace pts
function namespace (line 18) | namespace ast
function namespace (line 24) | namespace fir
function namespace (line 29) | namespace sst
FILE: source/include/pts.h
function namespace (line 16) | namespace pts
function Type (line 72) | struct NamedType : Type
function Type (line 89) | struct PointerType : Type
function Type (line 100) | struct TupleType : Type
function Type (line 111) | struct FixedArrayType : Type
function Type (line 123) | struct DynamicArrayType : Type
function Type (line 133) | struct VariadicArrayType : Type
function Type (line 143) | struct ArraySliceType : Type
function Type (line 154) | struct FunctionType : Type
FILE: source/include/repl.h
function namespace (line 11) | namespace ztmu
function namespace (line 17) | namespace repl
FILE: source/include/resolver.h
function namespace (line 13) | namespace fir
function namespace (line 18) | namespace sst
FILE: source/include/sst.h
function namespace (line 14) | namespace fir
function namespace (line 24) | namespace cgn
function namespace (line 29) | namespace ast
function namespace (line 35) | namespace sst
function virtual (line 110) | virtual std::vector<Block*> getBlocks() override;
type WhileLoop (line 137) | struct WhileLoop
function virtual (line 143) | virtual std::vector<Block*> getBlocks() override;
function Stmt (line 176) | struct ContinueStmt : Stmt
function Expr (line 184) | struct SizeofOp : Expr
function Expr (line 194) | struct TypeidOp : Expr
type FunctionDefn (line 204) | struct FunctionDefn
function Expr (line 205) | struct AllocOp : Expr
function Stmt (line 225) | struct DeallocOp : Stmt
function Expr (line 234) | struct BinaryOp : Expr
function Expr (line 248) | struct UnaryOp : Expr
function Expr (line 261) | struct AssignOp : Expr
function Expr (line 275) | struct TupleAssignOp : Expr
function Expr (line 287) | struct SubscriptDollarOp : Expr
function Expr (line 295) | struct SubscriptOp : Expr
function Expr (line 306) | struct SliceOp : Expr
function Expr (line 322) | struct FunctionCall : Expr
function Expr (line 335) | struct ExprCall : Expr
type StructDefn (line 347) | struct StructDefn
type ClassDefn (line 348) | struct ClassDefn
function Expr (line 349) | struct StructConstructorCall : Expr
function Expr (line 360) | struct ClassConstructorCall : Expr
function ClassConstructorCall (line 372) | struct BaseClassConstructorCall : ClassConstructorCall
type VarDefn (line 381) | struct VarDefn
function Expr (line 382) | struct VarRef : Expr
function Expr (line 394) | struct SelfVarRef : Expr
function Expr (line 402) | struct ScopeExpr : Expr
function Expr (line 414) | struct FieldDotOp : Expr
function Expr (line 429) | struct MethodDotOp : Expr
function Expr (line 440) | struct TupleDotOp : Expr
function Expr (line 451) | struct BuiltinDotOp : Expr
type EnumDefn (line 465) | struct EnumDefn
function Expr (line 466) | struct EnumDotOp : Expr
function Expr (line 479) | struct LiteralNumber : Expr
function Expr (line 489) | struct LiteralString : Expr
function Expr (line 500) | struct LiteralNull : Expr
function Expr (line 508) | struct LiteralBool : Expr
function Expr (line 518) | struct LiteralChar : Expr
function Expr (line 528) | struct LiteralTuple : Expr
function Expr (line 538) | struct LiteralArray : Expr
function Expr (line 550) | struct RangeExpr : Expr
function Expr (line 564) | struct SplatExpr : Expr
function Stmt (line 575) | struct NamespaceDefn : Stmt
function Defn (line 587) | struct VarDefn : Defn
function VarDefn (line 600) | struct ArgumentDefn : VarDefn
function Defn (line 609) | struct FunctionDecl : Defn
function FunctionDecl (line 624) | struct FunctionDefn : FunctionDecl
function FunctionDecl (line 646) | struct ForeignFuncDefn : FunctionDecl
function FunctionDefn (line 657) | struct OperatorOverloadDefn : FunctionDefn
function Stmt (line 666) | struct DecompDefn : Stmt
function VarDefn (line 679) | struct StructFieldDefn : VarDefn
function FunctionDefn (line 691) | struct ClassInitialiserDefn : FunctionDefn
function TypeDefn (line 701) | struct BareTypeDefn : TypeDefn
function TypeDefn (line 711) | struct TraitDefn : TypeDefn
function TypeDefn (line 722) | struct StructDefn : TypeDefn
function StructDefn (line 736) | struct ClassDefn : StructDefn
function Defn (line 758) | struct EnumCaseDefn : Defn
function TypeDefn (line 772) | struct EnumDefn : TypeDefn
function TypeDefn (line 785) | struct RawUnionDefn : TypeDefn
type UnionVariantDefn (line 799) | struct UnionVariantDefn
function TypeDefn (line 800) | struct UnionDefn : TypeDefn
function TypeDefn (line 811) | struct UnionVariantDefn : TypeDefn
function Expr (line 823) | struct UnionVariantConstructor : Expr
function Expr (line 835) | struct RunDirective : Expr
FILE: source/include/sst_expr.h
function namespace (line 10) | namespace cgn
function namespace (line 15) | namespace sst
FILE: source/include/stcommon.h
function namespace (line 8) | namespace sst
function namespace (line 14) | namespace ast
function namespace (line 19) | namespace attr
type AttribSet (line 30) | struct AttribSet
function set (line 62) | void set(FlagTy x) { this->flags |= x; }
function has (line 63) | bool has(FlagTy x) const { return (this->flags & x); }
function hasAny (line 64) | bool hasAny(FlagTy x) const { return (this->flags & x); }
function hasAll (line 65) | bool hasAll(FlagTy x) const { return (this->flags & x); }
function add (line 71) | void add(const UserAttrib& ua)
function AttribSet (line 76) | static AttribSet of(FlagTy flags, const std::vector<UserAttrib>& attribs...
type DecompMapping (line 89) | struct DecompMapping
type FnCallArgument (line 106) | struct FnCallArgument
type FnParam (line 126) | struct FnParam
FILE: source/include/string_consts.h
function namespace (line 8) | namespace strs
FILE: source/include/typecheck.h
function namespace (line 13) | namespace parser
function namespace (line 18) | namespace frontend
function namespace (line 24) | namespace pts
function namespace (line 29) | namespace ast
function namespace (line 37) | namespace fir
function namespace (line 42) | namespace sst
FILE: source/include/zfu.h
function namespace (line 61) | namespace zfu
function cross_imp (line 389) | void cross_imp(F f) { f(); }
function cross_imp (line 392) | void cross_imp(F f, const std::vector<H>& h, const std::vector<Ts>&... t)
function x (line 418) | auto fact = [](size_t x) -> size_t {
function std (line 512) | static inline std::string join(const std::vector<std::string>& list, con...
function std (line 528) | static inline std::string serialiseScope(const std::vector<std::string>&...
function std (line 539) | static inline std::string plural(const std::string& thing, size_t count)
type identity (line 573) | struct identity
type tostring (line 579) | struct tostring
type pair_first (line 585) | struct pair_first
type pair_second (line 591) | struct pair_second
function value (line 600) | equals_to(const T& x) : value(x) { }
FILE: source/include/zpr.h
function namespace (line 28) | namespace zpr
FILE: source/include/ztmu.h
function namespace (line 23) | namespace ztmu
FILE: source/main.cpp
type timer (line 20) | struct timer
method timer (line 24) | timer() : out(nullptr) { start = hrc::now(); }
method timer (line 25) | explicit timer(double* t) : out(t) { start = hrc::now(); }
method measure (line 27) | double measure() { return static_cast<double>((hrc:...
function compile (line 34) | static void compile(std::string in, std::string out)
function main (line 161) | int main(int argc, char** argv)
FILE: source/misc/allocator.cpp
type mem (line 25) | namespace mem
function _dealloc (line 43) | static void _dealloc(void* ptr, size_t bytes)
function deallocate_memory (line 75) | void deallocate_memory(void* ptr, size_t bytes)
function resetStats (line 82) | void resetStats()
function getAllocatedCount (line 89) | size_t getAllocatedCount()
function getDeallocatedCount (line 94) | size_t getDeallocatedCount()
function getWatermark (line 99) | size_t getWatermark()
FILE: source/misc/destructors.cpp
type ast (line 7) | namespace ast
FILE: source/misc/identifier.cpp
type util (line 153) | namespace util
function typeParamMapToString (line 155) | std::string typeParamMapToString(const std::string& name, const TypePa...
type zpr (line 170) | namespace zpr
FILE: source/misc/mpool.cpp
type util (line 10) | namespace util
function addPool (line 13) | void addPool(MemoryPool_base* pool)
function clearAllPools (line 18) | void clearAllPools()
FILE: source/platform/backtrace.cpp
type platform (line 24) | namespace platform
type piece_t (line 29) | struct piece_t
function printStackTrace (line 40) | void printStackTrace()
FILE: source/platform/compiler.cpp
type platform (line 27) | namespace platform {
type compiler (line 28) | namespace compiler
function getCompilerCommandLine (line 39) | std::string getCompilerCommandLine(const std::vector<std::string>& i...
function addLibrarySearchPaths (line 133) | void addLibrarySearchPaths()
function restoreLibrarySearchPaths (line 169) | void restoreLibrarySearchPaths()
function getDefaultSharedLibraries (line 183) | std::vector<std::string> getDefaultSharedLibraries()
function getSharedLibraryName (line 208) | std::string getSharedLibraryName(const std::string& name)
function getExecutableName (line 219) | std::string getExecutableName(const std::string& name)
function getObjectFileName (line 228) | std::string getObjectFileName(const std::string& name)
function performSelfDlOpen (line 251) | void performSelfDlOpen()
function performSelfDlClose (line 263) | void performSelfDlClose()
FILE: source/platform/msvcfinder.cpp
type platform (line 20) | namespace platform {
type compiler (line 21) | namespace compiler
type DECLSPEC_UUID (line 26) | struct DECLSPEC_UUID
function DECLSPEC_NOVTABLE (line 26) | DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
type DECLSPEC_UUID (line 38) | struct DECLSPEC_UUID
type DECLSPEC_UUID (line 48) | struct DECLSPEC_UUID
function DECLSPEC_NOVTABLE (line 48) | DECLSPEC_NOVTABLE ISetupConfiguration : public IUnknown
type DECLSPEC_UUID (line 55) | struct DECLSPEC_UUID
type VersionData (line 63) | struct VersionData
type FindResult (line 69) | struct FindResult
function checkFileExists (line 77) | static bool checkFileExists(const std::wstring& name)
function visitFiles (line 83) | static bool visitFiles(const std::wstring& dir, VersionData* vd, std::fu...
function readRegistryString (line 111) | static std::wstring readRegistryString(HKEY key, const std::wstring& name)
function getBestWin10Version (line 160) | static void getBestWin10Version(const std::wstring& shortName, const std...
function getBestWin8Version (line 187) | static void getBestWin8Version(const std::wstring& shortName, const std:...
function findWindowsKitRoot (line 210) | static void findWindowsKitRoot(FindResult* result)
function trim (line 263) | static std::string trim(std::string s)
function findVSToolchain (line 280) | static bool findVSToolchain(FindResult* result)
function FindResult (line 378) | static FindResult* getResult()
function getWindowsSDKLocation (line 397) | std::string getWindowsSDKLocation()
function getVSToolchainLibLocation (line 402) | std::string getVSToolchainLibLocation()
function getVSToolchainBinLocation (line 407) | std::string getVSToolchainBinLocation()
FILE: source/platform/platform.cpp
type platform (line 43) | namespace platform
function getEnvironmentVar (line 54) | std::string getEnvironmentVar(const std::string& name)
function pushEnvironmentVar (line 74) | void pushEnvironmentVar(const std::string& name, const std::string& va...
function popEnvironmentVar (line 85) | void popEnvironmentVar(const std::string& name)
function convertStringToWChar (line 104) | std::wstring convertStringToWChar(const std::string& s)
function convertWCharToString (line 128) | std::string convertWCharToString(const std::wstring& s)
function getFileSize (line 156) | size_t getFileSize(const std::string& path)
function cachePreExistingFile (line 190) | void cachePreExistingFile(const std::string& path, const std::string& ...
function readEntireFile (line 198) | std::string_view readEntireFile(const std::string& path)
function filehandle_t (line 265) | filehandle_t openFile(const char* name, int mode, int flags)
function closeFile (line 283) | void closeFile(filehandle_t fd)
function deleteFile (line 292) | void deleteFile(filehandle_t fd)
function readFile (line 296) | size_t readFile(filehandle_t fd, void* buf, size_t count)
function writeFile (line 310) | size_t writeFile(filehandle_t fd, void* buf, size_t count)
function checkFileExists (line 326) | bool checkFileExists(const std::string& path)
function getFullPath (line 341) | std::string getFullPath(const std::string& partial)
function getTerminalWidth (line 395) | size_t getTerminalWidth()
function setupTerminalIfNecessary (line 412) | void setupTerminalIfNecessary()
function setupCrashHandlers (line 436) | void setupCrashHandlers()
FILE: source/repl/commands.cpp
type repl (line 14) | namespace repl
function runCommand (line 19) | bool runCommand(const std::string& s, ztmu::State* consoleState)
function print_type (line 57) | static void print_type(const std::string& line)
function print_help (line 108) | static void print_help()
FILE: source/repl/driver.cpp
type repl (line 13) | namespace repl
function start (line 22) | void start()
FILE: source/repl/execute.cpp
type repl (line 23) | namespace repl
type State (line 25) | struct State
method State (line 27) | State()
function setupEnvironment (line 64) | void setupEnvironment()
function setEnvironment (line 72) | void setEnvironment(State* st)
function State (line 77) | State* getEnvironment()
method State (line 27) | State()
function parseAndTypecheck (line 83) | std::optional<sst::Stmt*> parseAndTypecheck(const std::string& line, b...
function processLine (line 151) | bool processLine(const std::string& line)
FILE: source/repl/history.cpp
type repl (line 13) | namespace repl
function getConfigPath (line 15) | static std::string getConfigPath()
function saveHistory (line 24) | void saveHistory(const std::vector<std::vector<std::string>>& history)
function loadHistory (line 62) | std::vector<std::vector<std::string>> loadHistory()
FILE: source/typecheck/alloc.cpp
function TCResult (line 15) | TCResult ast::AllocOp::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 103) | TCResult ast::DeallocOp::typecheck(sst::TypecheckState* fs, fir::Type* i...
FILE: source/typecheck/arithmetic.cpp
function TCResult (line 220) | TCResult ast::BinaryOp::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 304) | TCResult ast::UnaryOp::typecheck(sst::TypecheckState* fs, fir::Type* inf...
function TCResult (line 401) | TCResult ast::ComparisonOp::typecheck(sst::TypecheckState* fs, fir::Type...
FILE: source/typecheck/assign.cpp
function TCResult (line 14) | TCResult ast::AssignOp::typecheck(sst::TypecheckState* fs, fir::Type* in...
FILE: source/typecheck/call.cpp
function TCResult (line 148) | TCResult ast::ExprCall::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 156) | TCResult ast::FunctionCall::typecheck(sst::TypecheckState* fs, fir::Type...
FILE: source/typecheck/classes.cpp
function TCResult (line 23) | TCResult ast::ClassDefn::generateDeclaration(sst::TypecheckState* fs, fi...
function TCResult (line 127) | TCResult ast::ClassDefn::typecheck(sst::TypecheckState* fs, fir::Type* i...
function TCResult (line 436) | TCResult ast::InitFunctionDefn::typecheck(sst::TypecheckState* fs, fir::...
function TCResult (line 493) | TCResult ast::InitFunctionDefn::generateDeclaration(sst::TypecheckState*...
FILE: source/typecheck/controlflow.cpp
function TCResult (line 13) | TCResult ast::IfStmt::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 49) | TCResult ast::ReturnStmt::typecheck(sst::TypecheckState* fs, fir::Type* ...
function checkBlockPathsReturn (line 85) | static bool checkBlockPathsReturn(sst::TypecheckState* fs, sst::Block* b...
FILE: source/typecheck/defer.cpp
function TCResult (line 12) | TCResult ast::DeferredStmt::typecheck(sst::TypecheckState* fs, fir::Type...
FILE: source/typecheck/destructure.cpp
function checkTuple (line 14) | static void checkTuple(sst::TypecheckState* fs, DecompMapping* bind, fir...
function checkArray (line 31) | static void checkArray(sst::TypecheckState* fs, DecompMapping* bind, fir...
function checkAndAddBinding (line 87) | static void checkAndAddBinding(sst::TypecheckState* fs, DecompMapping* b...
function DecompMapping (line 122) | DecompMapping sst::TypecheckState::typecheckDecompositions(const DecompM...
function TCResult (line 131) | TCResult ast::DecompVarDefn::typecheck(sst::TypecheckState* fs, fir::Typ...
FILE: source/typecheck/directives.cpp
function TCResult (line 19) | TCResult ast::RunDirective::typecheck(sst::TypecheckState* fs, fir::Type...
function TCResult (line 49) | TCResult ast::IfDirective::typecheck(sst::TypecheckState* fs, fir::Type*...
FILE: source/typecheck/dotop.cpp
function ErrorMsg (line 21) | static ErrorMsg* wrongDotOpError(ErrorMsg* e, sst::StructDefn* str, cons...
type search_result_t (line 69) | struct search_result_t
method search_result_t (line 71) | search_result_t() { }
method search_result_t (line 72) | search_result_t(fir::Type* t, size_t i, bool tr) : type(t), fieldIdx(i...
function searchTransparentFields (line 79) | static std::vector<search_result_t> searchTransparentFields(sst::Typeche...
function TCResult (line 906) | TCResult ast::DotOperator::typecheck(sst::TypecheckState* fs, fir::Type*...
FILE: source/typecheck/enums.cpp
function TCResult (line 29) | TCResult ast::EnumDefn::generateDeclaration(sst::TypecheckState* fs, fir...
function TCResult (line 62) | TCResult ast::EnumDefn::typecheck(sst::TypecheckState* fs, fir::Type* in...
FILE: source/typecheck/function.cpp
function TCResult (line 15) | TCResult ast::FuncDefn::generateDeclaration(sst::TypecheckState* fs, fir...
function TCResult (line 122) | TCResult ast::FuncDefn::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 182) | TCResult ast::ForeignFuncDefn::typecheck(sst::TypecheckState* fs, fir::T...
function TCResult (line 254) | TCResult ast::Block::typecheck(sst::TypecheckState* fs, fir::Type* infer...
FILE: source/typecheck/literals.cpp
function TCResult (line 13) | TCResult ast::LitNumber::typecheck(sst::TypecheckState* fs, fir::Type* i...
function TCResult (line 64) | TCResult ast::LitNull::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 73) | TCResult ast::LitBool::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 84) | TCResult ast::LitChar::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 95) | TCResult ast::LitTuple::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 139) | TCResult ast::LitString::typecheck(sst::TypecheckState* fs, fir::Type* i...
function TCResult (line 162) | TCResult ast::LitArray::typecheck(sst::TypecheckState* fs, fir::Type* in...
FILE: source/typecheck/loops.cpp
function TCResult (line 14) | TCResult ast::ForeachLoop::typecheck(sst::TypecheckState* fs, fir::Type*...
function TCResult (line 89) | TCResult ast::WhileLoop::typecheck(sst::TypecheckState* fs, fir::Type* i...
function TCResult (line 131) | TCResult ast::BreakStmt::typecheck(sst::TypecheckState* fs, fir::Type* i...
function TCResult (line 145) | TCResult ast::ContinueStmt::typecheck(sst::TypecheckState* fs, fir::Type...
FILE: source/typecheck/misc.cpp
function TCResult (line 14) | TCResult ast::PlatformDefn::typecheck(sst::TypecheckState* fs, fir::Type...
FILE: source/typecheck/operators.cpp
function isBuiltinType (line 11) | static bool isBuiltinType(fir::Type* ty)
function isBuiltinOperator (line 28) | static bool isBuiltinOperator(std::string op)
function TCResult (line 70) | TCResult ast::OperatorOverloadDefn::typecheck(sst::TypecheckState* fs, f...
function TCResult (line 87) | TCResult ast::OperatorOverloadDefn::generateDeclaration(sst::TypecheckSt...
FILE: source/typecheck/polymorph/driver.cpp
type sst (line 20) | namespace sst {
type poly (line 21) | namespace poly
function findPolymorphReferences (line 23) | std::vector<PolyRefResult> findPolymorphReferences(TypecheckState* f...
type internal (line 57) | namespace internal
function inferPolymorphicType (line 59) | static std::pair<Solution_t, ErrorMsg*> inferPolymorphicType(Typec...
function inferPolymorphicFunction (line 221) | static std::pair<Solution_t, ErrorMsg*> inferPolymorphicFunction(T...
function inferTypesForPolymorph (line 308) | std::pair<Solution_t, ErrorMsg*> inferTypesForPolymorph(TypecheckS...
FILE: source/typecheck/polymorph/instantiator.cpp
type sst (line 13) | namespace sst {
type poly (line 14) | namespace poly
type internal (line 16) | namespace internal
function SimpleError (line 18) | static SimpleError* complainAboutMissingSolutions(const Location& ...
function getMissingSolutions (line 29) | std::vector<std::string> getMissingSolutions(const ProblemSpace_t&...
function solvePolymorphWithPlaceholders (line 48) | std::pair<TCResult, Solution_t> solvePolymorphWithPlaceholders(Typ...
function attemptToInstantiatePolymorph (line 70) | std::pair<TCResult, Solution_t> attemptToInstantiatePolymorph(Typech...
function TCResult (line 151) | TCResult fullyInstantiatePolymorph(TypecheckState* fs, ast::Paramete...
FILE: source/typecheck/polymorph/misc.cpp
type sst (line 13) | namespace sst
type poly (line 15) | namespace poly
type internal (line 17) | namespace internal
function getNextSessionId (line 20) | int getNextSessionId()
function convertPtsTypeList (line 85) | std::vector<fir::Type*> convertPtsTypeList(TypecheckState* fs, con...
function unwrapFunctionParameters (line 96) | std::vector<ArgType> unwrapFunctionParameters(TypecheckState* fs, ...
FILE: source/typecheck/polymorph/solver.cpp
type sst (line 15) | namespace sst
type poly (line 17) | namespace poly
function ErrorMsg (line 22) | static ErrorMsg* solveSingleType(Solution_t* soln, const fir::Locate...
function ErrorMsg (line 148) | static ErrorMsg* solveSingleTypeList(Solution_t* soln, const Locatio...
function solveTypeList (line 374) | std::pair<Solution_t, ErrorMsg*> solveTypeList(const Location& callL...
FILE: source/typecheck/polymorph/transforms.cpp
type sst (line 11) | namespace sst {
type poly (line 12) | namespace poly
type internal (line 74) | namespace internal
function decomposeIntoTransforms (line 76) | std::pair<fir::Type*, std::vector<Trf>> decomposeIntoTransforms(fi...
function decomposeIntoTransforms (line 113) | std::pair<pts::Type*, std::vector<Trf>> decomposeIntoTransforms(pt...
FILE: source/typecheck/ranges.cpp
function TCResult (line 13) | TCResult ast::RangeExpr::typecheck(sst::TypecheckState* fs, fir::Type* i...
FILE: source/typecheck/resolver/driver.cpp
type sst (line 17) | namespace sst {
type resolver (line 18) | namespace resolver
function TCResult (line 20) | TCResult resolveFunctionCallFromCandidates(TypecheckState* fs, const...
function TCResult (line 30) | TCResult resolveFunctionCall(TypecheckState* fs, const Location& cal...
function TCResult (line 164) | TCResult resolveConstructorCall(TypecheckState* fs, const Location& ...
FILE: source/typecheck/resolver/misc.cpp
type sst (line 12) | namespace sst
type resolver (line 14) | namespace resolver
type misc (line 16) | namespace misc
function canonicalisePolyArguments (line 18) | std::pair<TypeParamMap_t, ErrorMsg*> canonicalisePolyArguments(Typ...
function typecheckCallArguments (line 63) | std::vector<FnCallArgument> typecheckCallArguments(TypecheckState*...
function TCResult (line 85) | TCResult resolveAndInstantiatePolymorphicUnion(TypecheckState* fs, s...
function verifyStructConstructorArguments (line 152) | std::pair<util::hash_map<std::string, size_t>, ErrorMsg*> verifyStru...
function getOverloadDistance (line 221) | int getOverloadDistance(const std::vector<fir::Type*>& a, const std::v...
function isDuplicateOverload (line 230) | bool isDuplicateOverload(const std::vector<FnParam>& a, const std::vec...
FILE: source/typecheck/resolver/resolver.cpp
type sst (line 13) | namespace sst {
type resolver (line 14) | namespace resolver
function computeOverloadDistance (line 16) | std::pair<int, ErrorMsg*> computeOverloadDistance(const Location& fn...
function computeNamedOverloadDistance (line 39) | std::pair<int, ErrorMsg*> computeNamedOverloadDistance(const Locatio...
function ErrorMsg (line 65) | ErrorMsg* createErrorFromFailedCandidates(TypecheckState* fs, const ...
type internal (line 114) | namespace internal
function resolveFunctionCallFromCandidates (line 116) | std::pair<TCResult, std::vector<FnCallArgument>> resolveFunctionCa...
FILE: source/typecheck/sizeof.cpp
function TCResult (line 13) | TCResult ast::SizeofOp::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 35) | TCResult ast::TypeidOp::typecheck(sst::TypecheckState* fs, fir::Type* in...
FILE: source/typecheck/slice.cpp
function TCResult (line 31) | TCResult ast::SliceOp::typecheck(sst::TypecheckState* fs, fir::Type* inf...
FILE: source/typecheck/special.cpp
function TCResult (line 12) | TCResult ast::TypeExpr::typecheck(sst::TypecheckState* fs, fir::Type* in...
function TCResult (line 18) | TCResult ast::MutabilityTypeExpr::typecheck(sst::TypecheckState* fs, fir...
function TCResult (line 23) | TCResult ast::ImportStmt::typecheck(sst::TypecheckState* fs, fir::Type* ...
function TCResult (line 29) | TCResult ast::SplatOp::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 48) | TCResult ast::Parameterisable::typecheck(sst::TypecheckState* fs, fir::T...
function FnCallArgument (line 63) | FnCallArgument FnCallArgument::make(const Location& l, const std::string...
FILE: source/typecheck/structs.cpp
function checkFieldRecursion (line 19) | void checkFieldRecursion(sst::TypecheckState* fs, fir::Type* strty, fir:...
function checkTransparentFieldRedefinition (line 25) | void checkTransparentFieldRedefinition(sst::TypecheckState* fs, sst::Typ...
function TCResult (line 36) | TCResult ast::StructDefn::generateDeclaration(sst::TypecheckState* fs, f...
function TCResult (line 82) | TCResult ast::StructDefn::typecheck(sst::TypecheckState* fs, fir::Type* ...
function _checkFieldRecursion (line 180) | static void _checkFieldRecursion(sst::TypecheckState* fs, fir::Type* str...
function _checkTransparentFieldRedefinition (line 215) | static void _checkTransparentFieldRedefinition(sst::TypecheckState* fs, ...
FILE: source/typecheck/subscript.cpp
function TCResult (line 12) | TCResult ast::SubscriptOp::typecheck(sst::TypecheckState* fs, fir::Type*...
function TCResult (line 53) | TCResult ast::SubscriptDollarOp::typecheck(sst::TypecheckState* fs, fir:...
FILE: source/typecheck/toplevel.cpp
type sst (line 22) | namespace sst
type OsStrings (line 24) | struct OsStrings
function definitionsConflict (line 33) | static bool definitionsConflict(const sst::Defn* a, const sst::Defn* b)
type ExportMetadata (line 55) | struct ExportMetadata
function checkConflictingDefinitions (line 62) | static void checkConflictingDefinitions(Location loc, const char* kind...
function getExportInfo (line 116) | static std::optional<ExportMetadata> getExportInfo(const sst::StateTre...
function checkExportsRecursively (line 129) | static void checkExportsRecursively(const Location& loc, const char* k...
function mergeExternalTree (line 141) | void mergeExternalTree(const Location& loc, const char* kind, sst::Sta...
function DefinitionTree (line 214) | DefinitionTree* typecheck(frontend::CollectorState* cs, const parser::...
function OsStrings (line 304) | static OsStrings getOsStrings()
function generatePreludeDefinitions (line 359) | static void generatePreludeDefinitions(TypecheckState* fs, const std::...
function visitDeclarables (line 407) | static void visitDeclarables(sst::TypecheckState* fs, ast::TopLevelBlock...
function TCResult (line 430) | TCResult ast::TopLevelBlock::typecheck(sst::TypecheckState* fs, fir::Typ...
FILE: source/typecheck/traits.cpp
function TCResult (line 14) | TCResult ast::TraitDefn::generateDeclaration(sst::TypecheckState* fs, fi...
function TCResult (line 59) | TCResult ast::TraitDefn::typecheck(sst::TypecheckState* fs, fir::Type* i...
function _checkFunctionTypesMatch (line 115) | static bool _checkFunctionTypesMatch(fir::Type* trait, fir::Type* type, ...
function checkTraitConformity (line 148) | void checkTraitConformity(sst::TypecheckState* fs, sst::TypeDefn* defn)
FILE: source/typecheck/type.cpp
type sst (line 16) | namespace sst
function ErrorMsg (line 48) | static ErrorMsg* _complainNoParentScope(TypecheckState* fs, const std:...
function StateTree (line 54) | static StateTree* recursivelyFindTreeUpwards(TypecheckState* fs, const...
FILE: source/typecheck/typecheckstate.cpp
type sst (line 18) | namespace sst
function Location (line 33) | Location TypecheckState::popLoc()
function Location (line 42) | Location TypecheckState::loc()
function FunctionDefn (line 67) | FunctionDefn* TypecheckState::getCurrentFunction()
function Expr (line 121) | Expr* TypecheckState::getCurrentSubscriptArray()
function StateTree (line 151) | StateTree* TypecheckState::popTree()
function Scope (line 192) | Scope TypecheckState::scope()
function fetchDefinitionsFrom (line 207) | static void fetchDefinitionsFrom(const std::string& name, StateTree* t...
function Scope (line 284) | const Scope& StateTree::getScope()
function Scope (line 297) | const Scope& Scope::appending(const std::string& name) const
function StateTree (line 314) | StateTree* StateTree::findSubtree(const std::string& name)
function StateTree (line 333) | StateTree* StateTree::findOrCreateSubtree(const std::string& name, boo...
function ErrorMsg (line 375) | ErrorMsg* TypecheckState::checkForShadowingOrConflictingDefinition(Def...
FILE: source/typecheck/unions.cpp
function TCResult (line 19) | TCResult ast::UnionDefn::generateDeclaration(sst::TypecheckState* fs, fi...
function TCResult (line 61) | TCResult ast::UnionDefn::typecheck(sst::TypecheckState* fs, fir::Type* i...
FILE: source/typecheck/using.cpp
function TCResult (line 15) | TCResult ast::UsingStmt::typecheck(sst::TypecheckState* fs, fir::Type* i...
FILE: source/typecheck/variable.cpp
function TCResult (line 21) | static TCResult getResult(ast::Ident* ident, sst::Defn* def, bool implic...
function TCResult (line 33) | static TCResult checkPotentialCandidate(sst::TypecheckState* fs, ast::Id...
function TCResult (line 141) | TCResult ast::Ident::typecheck(sst::TypecheckState* fs, fir::Type* infer)
function TCResult (line 297) | TCResult ast::VarDefn::typecheck(sst::TypecheckState* fs, fir::Type* infer)
Condensed preview — 272 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,609K chars).
[
{
"path": ".github/workflows/continuous_integration.yml",
"chars": 3637,
"preview": "name: CI\non: [push, pull_request]\n\njobs:\n build-linux:\n runs-on: ubuntu-18.04\n steps:\n - uses: actions/checkou"
},
{
"path": ".gitignore",
"chars": 1010,
"preview": "# Compiled Object files\n*.slo\n*.lo\n*.o\n*.obj\n\n# Precompiled Headers\n*.gch*\n*.pch*\n\n# Makefile dependencies\n*.cpp.d\n*.c.d"
},
{
"path": ".semaphore/semaphore.yml",
"chars": 1168,
"preview": "version: v1.0\r\nname: flax\r\nagent:\r\n machine:\r\n type: e1-standard-2\r\n os_image: ubuntu1804\r\nblocks:\r\n - name: \"li"
},
{
"path": "LICENSE",
"chars": 11306,
"preview": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licens"
},
{
"path": "Makefile",
"chars": 5318,
"preview": "# Makefile for Orion-X3/Orion-X4/mx and derivatives\n# Written in 2011\n# This makefile is licensed under the WTFPL\n\n\n\nWAR"
},
{
"path": "README.md",
"chars": 6094,
"preview": "# [Flax](https://flax-lang.github.io)\n\nA low level, general-purpose language with high level syntax and expressibility.\n"
},
{
"path": "appveyor.yml",
"chars": 2441,
"preview": "image: Visual Studio 2019\nclone_depth: 50\nclone_folder: c:\\projects\\flax\n\nenvironment:\n global:\n MPIR_ROOT_DIR: c"
},
{
"path": "build/a.flx",
"chars": 217,
"preview": "// a.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n// import libc as _\nexport a"
},
{
"path": "build/b.flx",
"chars": 114,
"preview": "// b.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport a\nimport libc\n\n"
},
{
"path": "build/c.flx",
"chars": 213,
"preview": "// ultratiny.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport ultratiny\n\n//"
},
{
"path": "build/d.flx",
"chars": 113,
"preview": "// d.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport a\nimport libc\n"
},
{
"path": "build/generate_test.py",
"chars": 3611,
"preview": "#!/usr/bin/env python3\n\n# taken from github.com/pervognesn/bitwise/ion/generate_test.py\n\nimport sys\n\ndef gen_test(reps):"
},
{
"path": "build/gltest.flx",
"chars": 5462,
"preview": "// gltest.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n// import Founda"
},
{
"path": "build/old/raii_poc.flx",
"chars": 1685,
"preview": "// raii_poc.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport ultratiny\nimpo"
},
{
"path": "build/run-test.ps1",
"chars": 656,
"preview": "# hmm\n\nParam\n(\n\t[string] $buildType,\n\t[string] $theProgram,\n\n\t[Parameter(ValueFromRemainingArguments=$true)]\n\t[string[]]"
},
{
"path": "build/speed-test.py",
"chars": 1577,
"preview": "#!/usr/bin/env python3\n\nimport re\nimport os\nimport subprocess\nimport generate_test\n\nimport prettytable\nfrom prettytable "
},
{
"path": "build/supertiny.flx",
"chars": 6033,
"preview": "// supertiny.flx\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\nexport super"
},
{
"path": "build/tester.flx",
"chars": 4650,
"preview": "// tester.flx\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport tester\n\ni"
},
{
"path": "build/tests/anytest.flx",
"chars": 887,
"preview": "// anytest.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_any"
},
{
"path": "build/tests/arraytest.flx",
"chars": 2315,
"preview": "// arraytest.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_a"
},
{
"path": "build/tests/basic.flx",
"chars": 2680,
"preview": "// basic.flx\n// Copyright (c) 2019, zhiayang, Apache License 2.0.\n\nexport test_basic\nimport libc as _\nimport std::io as "
},
{
"path": "build/tests/classes.flx",
"chars": 1272,
"preview": "// classes.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_classes\n\ni"
},
{
"path": "build/tests/decomposition.flx",
"chars": 1404,
"preview": "// decomposition.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport te"
},
{
"path": "build/tests/defertest.flx",
"chars": 400,
"preview": "// defer.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_defer"
},
{
"path": "build/tests/fizzbuzz.flx",
"chars": 429,
"preview": "// fizzbuzz.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_fi"
},
{
"path": "build/tests/forloops.flx",
"chars": 761,
"preview": "// forloops.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_fo"
},
{
"path": "build/tests/functions.flx",
"chars": 2909,
"preview": "// functions.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_f"
},
{
"path": "build/tests/generics.flx",
"chars": 1895,
"preview": "// generics.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_ge"
},
{
"path": "build/tests/intlimits.flx",
"chars": 1084,
"preview": "// intlimits.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_l"
},
{
"path": "build/tests/linkedlist.flx",
"chars": 1096,
"preview": "// linkedlist.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_linkedl"
},
{
"path": "build/tests/misc.flx",
"chars": 3847,
"preview": "// misc.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\nclass TestingClas"
},
{
"path": "build/tests/operators.flx",
"chars": 1549,
"preview": "// operators.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nimport Math\ni"
},
{
"path": "build/tests/recursiveFib.flx",
"chars": 355,
"preview": "// recursiveFib.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport tes"
},
{
"path": "build/tests/scopes.flx",
"chars": 2151,
"preview": "// scopes.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_scop"
},
{
"path": "build/tests/slices.flx",
"chars": 496,
"preview": "// slices.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_slic"
},
{
"path": "build/tests/unions.flx",
"chars": 865,
"preview": "// unions.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_unions\nimpo"
},
{
"path": "build/tests/using.flx",
"chars": 1123,
"preview": "// using.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport test_using\nimport"
},
{
"path": "build/tiniest.flx",
"chars": 327,
"preview": "// tiniest.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nimport libc\n\nclass wra"
},
{
"path": "build/tmp/repro_1.flx",
"chars": 816,
"preview": "// repro_1.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n/*\nimport libc as _\n//"
},
{
"path": "build/tmp/repro_2.flx",
"chars": 248,
"preview": "// repro_2.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\npublic enum Foo: i32\n{"
},
{
"path": "build/tmp/repro_3.flx",
"chars": 286,
"preview": "// repro_3.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n// public import libc "
},
{
"path": "build/tmp2/a.flx",
"chars": 291,
"preview": "// a.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nimport libc as _\n\n@entry fn "
},
{
"path": "build/tmp2/b.flx",
"chars": 325,
"preview": "// b.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n<<<<<<< Updated upstream\npub"
},
{
"path": "build/tmp2/c.flx",
"chars": 260,
"preview": "// c.flx\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n<<<<<<< Updated upstream\nexp"
},
{
"path": "build/ultratiny.flx",
"chars": 1706,
"preview": "// ultratiny.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport ultratiny\n\nim"
},
{
"path": "changelog.md",
"chars": 23644,
"preview": "# Partial Changelog\n\n\n### 2018-12-09 `(1350296)`\n- fix a refcounting bug where things were getting freed too early. the "
},
{
"path": "external/mpreal/mpreal.h",
"chars": 109937,
"preview": "/*\n\tMPFR C++: Multi-precision floating point number class for C++.\n\tBased on MPFR library: http://mpfr.org\n\n\tProject "
},
{
"path": "external/tinyprocesslib/LICENSE",
"chars": 1094,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2015-2016 Ole Christian Eidheim\n\nPermission is hereby granted, free of charge, to a"
},
{
"path": "external/tinyprocesslib/README.md",
"chars": 1372,
"preview": "# tiny-process-library [](https://t"
},
{
"path": "external/tinyprocesslib/process.cpp",
"chars": 701,
"preview": "#include \"tinyprocess.h\"\n\nnamespace tinyproclib {\nProcess::Process(const string_type &command, const string_type &path,\n"
},
{
"path": "external/tinyprocesslib/process_os.cpp",
"chars": 82,
"preview": "#ifdef _WIN32\n#include \"process_win.inc\"\n#else\n#include \"process_unix.inc\"\n#endif\n"
},
{
"path": "external/tinyprocesslib/process_unix.inc",
"chars": 5505,
"preview": "#include \"tinyprocess.h\"\n#include <cstdlib>\n#include <unistd.h>\n#include <signal.h>\n#include <stdexcept>\n\nnamespace tiny"
},
{
"path": "external/tinyprocesslib/process_win.inc",
"chars": 7828,
"preview": "#include \"tinyprocess.h\"\n#include <windows.h>\n#include <cstring>\n#include <TlHelp32.h>\n#include <stdexcept>\n\nnamespace t"
},
{
"path": "external/tinyprocesslib/tinyprocess.h",
"chars": 2997,
"preview": "#ifndef TINY_PROCESS_LIBRARY_HPP_\n#define TINY_PROCESS_LIBRARY_HPP_\n\n#include <mutex>\n#include <string>\n#include <functi"
},
{
"path": "external/utf8rewind/LICENSE",
"chars": 1061,
"preview": "Copyright (C) 2014-2015 Quinten Lansu\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of t"
},
{
"path": "external/utf8rewind/README.md",
"chars": 6154,
"preview": "## Introduction ##\n\n`utf8rewind` is a cross-platform and open source C library designed to extend the default string han"
},
{
"path": "external/utf8rewind/include/utf8rewind/utf8rewind.h",
"chars": 56826,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/makefile",
"chars": 352,
"preview": "# bleugh.\n# so we can call from our main makefile.\n\nCSRC := $(shell find source -name \"*.c\")\nCOBJ := $(CSRC:.c=.c."
},
{
"path": "external/utf8rewind/source/internal/base.h",
"chars": 3849,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/casemapping.c",
"chars": 15414,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/casemapping.h",
"chars": 2116,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/codepoint.c",
"chars": 6490,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/codepoint.h",
"chars": 8888,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/composition.c",
"chars": 9087,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/composition.h",
"chars": 1734,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/database.c",
"chars": 3288,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/database.h",
"chars": 2890,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/decomposition.c",
"chars": 8480,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/decomposition.h",
"chars": 1939,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/seeking.c",
"chars": 3895,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/seeking.h",
"chars": 1546,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/streaming.c",
"chars": 5502,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/internal/streaming.h",
"chars": 3060,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/unicodedatabase.c",
"chars": 1396774,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/unicodedatabase.h",
"chars": 3732,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "external/utf8rewind/source/utf8rewind.c",
"chars": 28199,
"preview": "/*\n\tCopyright (C) 2014-2016 Quinten Lansu\n\n\tPermission is hereby granted, free of charge, to any person\n\tobtaining a cop"
},
{
"path": "issues.md",
"chars": 9598,
"preview": "# Issues\n\nNote: this is just a personal log of outstanding issues, shorter rants/ramblings, and a changelog that doesn't"
},
{
"path": "libs/OpenGL/GL.flx",
"chars": 77363,
"preview": "// GL.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\npublic enum GL: u32\n"
},
{
"path": "libs/OpenGL/GLUT.flx",
"chars": 1692,
"preview": "// GLUT.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\npublic namespace G"
},
{
"path": "libs/SDL2/Keyboard.flx",
"chars": 12850,
"preview": "// Keyboard.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport SDL::Ke"
},
{
"path": "libs/SDL2/SDL.flx",
"chars": 4742,
"preview": "// SDL.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport SDL\n\nimport "
},
{
"path": "libs/libc.flx",
"chars": 2297,
"preview": "// libc.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport libc\n\n// pr"
},
{
"path": "libs/os.flx",
"chars": 103,
"preview": "// os.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport os\n"
},
{
"path": "libs/std/file.flx",
"chars": 1528,
"preview": "// file.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std::io\nimport lib"
},
{
"path": "libs/std/io.flx",
"chars": 158,
"preview": "// io.flx\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std::io\n\npublic impo"
},
{
"path": "libs/std/limits.flx",
"chars": 852,
"preview": "// limits.flx\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std::limi"
},
{
"path": "libs/std/map.flx",
"chars": 7976,
"preview": "// map.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std\nimport libc\nimp"
},
{
"path": "libs/std/math.flx",
"chars": 522,
"preview": "// math.flx\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport math\n\npubli"
},
{
"path": "libs/std/opt.flx",
"chars": 145,
"preview": "// opt.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std\n\npublic union o"
},
{
"path": "libs/std/print.flx",
"chars": 2413,
"preview": "// print.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std::io\nimport li"
},
{
"path": "libs/std/set.flx",
"chars": 239,
"preview": "// set.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\nexport std\n\npublic class s"
},
{
"path": "meson.build",
"chars": 15017,
"preview": "# meson.build\n\nproject('flax', version: '0.41.7-pre', default_options: [ 'warning_level=3' ])\n\nadd_languages(['c', 'cpp'"
},
{
"path": "notes.md",
"chars": 2764,
"preview": "## notes\n\n## to fix\n\n1. `public static` doesn't work, but `static public` works.\n\n2. underlining breaks for multi-line s"
},
{
"path": "programs/fic/main.flx",
"chars": 176,
"preview": "// main.flx\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n// this is supposed to b"
},
{
"path": "programs/fic/run.bat",
"chars": 172,
"preview": "@echo off\n\nrobocopy libs build\\sysroot\\usr\\local\\lib\\flaxlibs /e /nfl /ndl /njh /njs /nc /ns /np\nbuild\\meson-rel\\flaxc.e"
},
{
"path": "roadmap.md",
"chars": 823,
"preview": "# Flax 1.0 Roadmap\n\nAs more of the core features are slowly being finished up, the 1.0 milestone is in sight. This is ju"
},
{
"path": "source/backend/backend.cpp",
"chars": 1415,
"preview": "// Backend.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"backe"
},
{
"path": "source/backend/interp/driver.cpp",
"chars": 2043,
"preview": "// driver.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <chrono>\n\n#inc"
},
{
"path": "source/backend/llvm/jit.cpp",
"chars": 3620,
"preview": "// jit.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h\"\n#inclu"
},
{
"path": "source/backend/llvm/linker.cpp",
"chars": 12481,
"preview": "// linker.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n\n#ifndef __STDC"
},
{
"path": "source/backend/llvm/translator.cpp",
"chars": 69822,
"preview": "// Translator.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#ifndef __S"
},
{
"path": "source/backend/x64AsmBackend.cpp",
"chars": 594,
"preview": "// x64AsmBackend.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include "
},
{
"path": "source/codegen/alloc.cpp",
"chars": 5911,
"preview": "// alloc.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#includ"
},
{
"path": "source/codegen/arithmetic.cpp",
"chars": 17765,
"preview": "// arithmetic.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ss"
},
{
"path": "source/codegen/assign.cpp",
"chars": 5017,
"preview": "// assign.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\""
},
{
"path": "source/codegen/autocasting.cpp",
"chars": 11168,
"preview": "// autocasting.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"s"
},
{
"path": "source/codegen/builtin.cpp",
"chars": 6296,
"preview": "// builtin.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"error"
},
{
"path": "source/codegen/call.cpp",
"chars": 12533,
"preview": "// call.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <set>\n\n#i"
},
{
"path": "source/codegen/classes.cpp",
"chars": 5103,
"preview": "// classes.h\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h\"\n#inc"
},
{
"path": "source/codegen/codegenstate.cpp",
"chars": 11576,
"preview": "// codegenstate.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \""
},
{
"path": "source/codegen/constructor.cpp",
"chars": 6444,
"preview": "// constructor.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#"
},
{
"path": "source/codegen/controlflow.cpp",
"chars": 8409,
"preview": "// controlflow.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"s"
},
{
"path": "source/codegen/destructure.cpp",
"chars": 8129,
"preview": "// destructure.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#"
},
{
"path": "source/codegen/directives.cpp",
"chars": 3216,
"preview": "// directives.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <memory>\n\n"
},
{
"path": "source/codegen/dotop.cpp",
"chars": 5296,
"preview": "// dotops.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h\"\n#in"
},
{
"path": "source/codegen/enums.cpp",
"chars": 2400,
"preview": "// enums.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n"
},
{
"path": "source/codegen/function.cpp",
"chars": 3989,
"preview": "// function.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs"
},
{
"path": "source/codegen/glue/any.cpp",
"chars": 9620,
"preview": "// any.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \"codegen.h\"\n#inc"
},
{
"path": "source/codegen/glue/arrays.cpp",
"chars": 20272,
"preview": "// arrays.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"codege"
},
{
"path": "source/codegen/glue/misc.cpp",
"chars": 7597,
"preview": "// misc.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"codegen.h\"\n#inc"
},
{
"path": "source/codegen/glue/saa_common.cpp",
"chars": 27642,
"preview": "// saa_common.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \"codegen."
},
{
"path": "source/codegen/glue/strings.cpp",
"chars": 9984,
"preview": "// strings.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"codeg"
},
{
"path": "source/codegen/literals.cpp",
"chars": 7811,
"preview": "// literals.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst."
},
{
"path": "source/codegen/logical.cpp",
"chars": 3498,
"preview": "// logical.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"error"
},
{
"path": "source/codegen/loops.cpp",
"chars": 7837,
"preview": "// loops.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n"
},
{
"path": "source/codegen/misc.cpp",
"chars": 1901,
"preview": "// misc.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#"
},
{
"path": "source/codegen/operators.cpp",
"chars": 1309,
"preview": "// operators.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst"
},
{
"path": "source/codegen/raii.cpp",
"chars": 9184,
"preview": "// raii.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#include"
},
{
"path": "source/codegen/ranges.cpp",
"chars": 2138,
"preview": "// ranges.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#inclu"
},
{
"path": "source/codegen/refcounting.cpp",
"chars": 4269,
"preview": "// refcounting.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"s"
},
{
"path": "source/codegen/sizeof.cpp",
"chars": 574,
"preview": "// sizeof.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n#inclu"
},
{
"path": "source/codegen/slice.cpp",
"chars": 7680,
"preview": "// slice.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\"\n"
},
{
"path": "source/codegen/structs.cpp",
"chars": 462,
"preview": "// structs.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"error"
},
{
"path": "source/codegen/subscript.cpp",
"chars": 2087,
"preview": "// subscript.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst"
},
{
"path": "source/codegen/toplevel.cpp",
"chars": 1175,
"preview": "// toplevel.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst."
},
{
"path": "source/codegen/traits.cpp",
"chars": 311,
"preview": "// traits.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h\"\n#in"
},
{
"path": "source/codegen/unions.cpp",
"chars": 1682,
"preview": "// unions.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst.h\""
},
{
"path": "source/codegen/variable.cpp",
"chars": 3807,
"preview": "// variable.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"sst."
},
{
"path": "source/fir/ConstantValue.cpp",
"chars": 10551,
"preview": "// ConstantValue.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include "
},
{
"path": "source/fir/Function.cpp",
"chars": 3086,
"preview": "// Function.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/m"
},
{
"path": "source/fir/GlobalValue.cpp",
"chars": 1358,
"preview": "// GlobalValue.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \""
},
{
"path": "source/fir/IRBlock.cpp",
"chars": 1206,
"preview": "// IRBlock.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/fu"
},
{
"path": "source/fir/IRBuilder.cpp",
"chars": 72545,
"preview": "// IRBuilder.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <cma"
},
{
"path": "source/fir/Instruction.cpp",
"chars": 13047,
"preview": "// Instruction.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"i"
},
{
"path": "source/fir/Module.cpp",
"chars": 10869,
"preview": "// Module.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"string"
},
{
"path": "source/fir/Name.cpp",
"chars": 6193,
"preview": "// Name.cpp\n// Copyright (c) 2020, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/type.h\"\n\nnam"
},
{
"path": "source/fir/Types/ArraySliceType.cpp",
"chars": 2460,
"preview": "// ArraySliceType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include"
},
{
"path": "source/fir/Types/ArrayType.cpp",
"chars": 1307,
"preview": "// Type.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/type."
},
{
"path": "source/fir/Types/ClassType.cpp",
"chars": 8486,
"preview": "// ClassType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"err"
},
{
"path": "source/fir/Types/DynamicArrayType.cpp",
"chars": 1182,
"preview": "// DynamicArrayType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#inclu"
},
{
"path": "source/fir/Types/EnumType.cpp",
"chars": 1851,
"preview": "// EnumType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \"ir/"
},
{
"path": "source/fir/Types/FunctionType.cpp",
"chars": 3252,
"preview": "// FunctionType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \""
},
{
"path": "source/fir/Types/OpaqueType.cpp",
"chars": 1145,
"preview": "// OpaqueType.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/type.h"
},
{
"path": "source/fir/Types/PointerType.cpp",
"chars": 2526,
"preview": "// Type.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/type."
},
{
"path": "source/fir/Types/PrimitiveType.cpp",
"chars": 5061,
"preview": "// Type.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/type."
},
{
"path": "source/fir/Types/RawUnionType.cpp",
"chars": 2123,
"preview": "// RawUnionType.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \"errors"
},
{
"path": "source/fir/Types/SingleTypes.cpp",
"chars": 7355,
"preview": "// SingleTypes.cpp\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h"
},
{
"path": "source/fir/Types/StructType.cpp",
"chars": 3211,
"preview": "// StructType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"er"
},
{
"path": "source/fir/Types/TraitType.cpp",
"chars": 1608,
"preview": "// TraitType.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n\n#include \"errors.h\""
},
{
"path": "source/fir/Types/TupleType.cpp",
"chars": 1495,
"preview": "// TupleType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"err"
},
{
"path": "source/fir/Types/Type.cpp",
"chars": 26682,
"preview": "// Type.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h"
},
{
"path": "source/fir/Types/TypeUtils.cpp",
"chars": 3040,
"preview": "// TypeUtils.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"errors.h\"\n"
},
{
"path": "source/fir/Types/UnionType.cpp",
"chars": 3547,
"preview": "// UnionType.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"err"
},
{
"path": "source/fir/Value.cpp",
"chars": 1180,
"preview": "// Value.cpp\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ir/valu"
},
{
"path": "source/fir/interp/compiler.cpp",
"chars": 1500,
"preview": "// compiler.cpp\n// Copyright (c) 2017, zhiayang@gmail.com\n// Licensed under the Apache License Version 2.0.\n\n#include \"i"
},
{
"path": "source/fir/interp/interpreter.cpp",
"chars": 76030,
"preview": "// interpreter.cpp\n// Copyright (c) 2017, zhiayang@gmail.com\n// Licensed under the Apache License Version 2.0.\n\n#include"
},
{
"path": "source/fir/interp/wrappers.cpp",
"chars": 1621,
"preview": "// wrappers.cpp\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs.h\"\n#in"
},
{
"path": "source/frontend/arguments.cpp",
"chars": 19436,
"preview": "// frontend.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs"
},
{
"path": "source/frontend/collector.cpp",
"chars": 4198,
"preview": "// collector.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <sys"
},
{
"path": "source/frontend/dependencies.cpp",
"chars": 4278,
"preview": "// dependencies.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \""
},
{
"path": "source/frontend/errors.cpp",
"chars": 11575,
"preview": "// errors.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs.h"
},
{
"path": "source/frontend/file.cpp",
"chars": 6048,
"preview": "// file.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <string>\n"
},
{
"path": "source/frontend/import.cpp",
"chars": 4315,
"preview": "// import.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include <sys/st"
},
{
"path": "source/frontend/lexer.cpp",
"chars": 21531,
"preview": "// lexer.cpp\n// Copyright (c) 2014 - 2015, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"lexer.h"
},
{
"path": "source/frontend/parser/controlflow.cpp",
"chars": 6028,
"preview": "// controlflow.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"a"
},
{
"path": "source/frontend/parser/expr.cpp",
"chars": 31830,
"preview": "// expr.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"ast.h\"\n#"
},
{
"path": "source/frontend/parser/function.cpp",
"chars": 10089,
"preview": "// function.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs"
},
{
"path": "source/frontend/parser/literal.cpp",
"chars": 4274,
"preview": "// literal.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs."
},
{
"path": "source/frontend/parser/misc.cpp",
"chars": 7538,
"preview": "// misc.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"frontend"
},
{
"path": "source/frontend/parser/operators.cpp",
"chars": 11956,
"preview": "// operators.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"def"
},
{
"path": "source/frontend/parser/toplevel.cpp",
"chars": 7633,
"preview": "// toplevel.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"defs"
},
{
"path": "source/frontend/parser/type.cpp",
"chars": 21662,
"preview": "// type.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"pts.h\"\n#"
},
{
"path": "source/frontend/parser/variable.cpp",
"chars": 4814,
"preview": "// variable.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"pts."
},
{
"path": "source/frontend/pts.cpp",
"chars": 4343,
"preview": "// pts.cpp\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#include \"pts.h\"\n#i"
},
{
"path": "source/include/allocator.h",
"chars": 367,
"preview": "// allocator.h\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n#include "
},
{
"path": "source/include/ast.h",
"chars": 23233,
"preview": "// ast.h\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n#include"
},
{
"path": "source/include/backend.h",
"chars": 2127,
"preview": "// backend.h\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#in"
},
{
"path": "source/include/backends/interp.h",
"chars": 598,
"preview": "// interp.h\n// Copyright (c) 2019, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n#include \"ba"
},
{
"path": "source/include/backends/llvm.h",
"chars": 3063,
"preview": "// llvm.h\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#ifndef __STD"
},
{
"path": "source/include/codegen.h",
"chars": 6137,
"preview": "// codegen.h\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#in"
},
{
"path": "source/include/container.h",
"chars": 3755,
"preview": "// container.h\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n#include "
},
{
"path": "source/include/defs.h",
"chars": 20353,
"preview": "// defs.h\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n#includ"
},
{
"path": "source/include/errors.h",
"chars": 3003,
"preview": "// errors.h\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#inc"
},
{
"path": "source/include/frontend.h",
"chars": 4404,
"preview": "// frontend.h\n// Copyright (c) 2014 - 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#i"
},
{
"path": "source/include/gluecode.h",
"chars": 5913,
"preview": "// gluecode.h\n// Copyright (c) 2017, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#include "
},
{
"path": "source/include/ir/block.h",
"chars": 729,
"preview": "// block.h\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#incl"
},
{
"path": "source/include/ir/constant.h",
"chars": 7382,
"preview": "// constant.h\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#i"
},
{
"path": "source/include/ir/function.h",
"chars": 2042,
"preview": "// function.h\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#i"
},
{
"path": "source/include/ir/instruction.h",
"chars": 3768,
"preview": "// instruction.h\n// Copyright (c) 2014 - 2016, zhiayang\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n"
},
{
"path": "source/include/ir/interp.h",
"chars": 2533,
"preview": "// interp.h\n// Copyright (c) 2017, zhiayang@gmail.com\n// Licensed under the Apache License Version 2.0.\n\n#pragma once\n\n#"
}
]
// ... and 72 more files (download for full content)
About this extraction
This page contains the full source code of the flax-lang/flax GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 272 files (3.2 MB), approximately 848.9k tokens, and a symbol index with 1516 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.