├── .gitattributes ├── .gitignore ├── .gitmodules ├── INSTALL ├── LICENSE ├── NOTICE ├── README ├── docs └── structure-devices.graffle ├── make ├── PESpin_x64.exe ├── encap.r ├── lint.out ├── makefile-32 ├── makefile-64 ├── makefile-64-sdl ├── makefile-aarch64 ├── makefile-armv7 ├── makefile-linux ├── makefile-mingw-32 ├── makefile-mingw-64 ├── makefile-msys ├── makefile-msys-64 ├── makefile-osx ├── makefile-osx-64 ├── makefile-osxi ├── makefile.vc ├── makefiles │ ├── common-defs │ ├── common-targets │ ├── linux-common-defs │ ├── linux-common-defs-sdl │ ├── linux-common-targets │ ├── linux-common-targets-sdl │ ├── mingw-common-defs │ ├── mingw-common-targets │ └── osx-common-targets ├── msvc │ ├── libffi │ │ ├── ReadMe.txt │ │ ├── include │ │ │ ├── Win32 │ │ │ │ ├── ffi.h │ │ │ │ ├── fficonfig.h │ │ │ │ └── ffitarget.h │ │ │ └── x64 │ │ │ │ ├── ffi.h │ │ │ │ ├── fficonfig.h │ │ │ │ └── ffitarget.h │ │ ├── libffi.vcxproj │ │ └── libffi.vcxproj.filters │ ├── r3.sln │ └── r3 │ │ ├── ReadMe.txt │ │ ├── prebuild.bat │ │ ├── prebuild64.bat │ │ ├── r3-view.exe │ │ ├── r3-view.vcxproj │ │ └── r3-view.vcxproj.filters ├── r3-make-linux ├── r3-make-osx ├── r3-make-osxi ├── r3-make.exe ├── scripts │ └── build.sh ├── settings.ini ├── tests │ ├── gir.r │ ├── gtk.r │ ├── libs.so │ ├── ms-drives.r │ ├── qsort.r │ ├── so-main.c │ ├── test-ffi.r │ ├── test-libs.r │ ├── test-struct.r │ └── varargs.r ├── vcbuild.bat └── xcode │ └── r3 │ └── r3.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── WorkspaceSettings.xcsettings ├── release ├── android │ ├── clouds.jpg │ ├── demo-script.apk │ ├── demo-script.r3 │ └── r3-droid.apk ├── linux │ ├── libfreetype.so.6.10.1 │ ├── libr3.so │ ├── r3-core-host-linux │ ├── r3-core-linux │ ├── r3-view-host-linux │ └── r3-view-linux ├── osx │ ├── libfreetype.6.dylib │ ├── libr3.dylib │ ├── r3-core-host-osx │ ├── r3-core-osx │ ├── r3-view-host-osx │ └── r3-view-osx ├── osxi │ ├── libfreetype.6.dylib │ ├── libr3.dylib │ ├── r3-core-host-osxi │ ├── r3-core-osxi │ ├── r3-view-host-osxi │ └── r3-view-osxi ├── r3-saphir-changes.mdp ├── win32-x64 │ ├── r3-core-host.exe │ ├── r3-core.exe │ ├── r3-view-host.exe │ ├── r3-view.exe │ └── r3.dll └── win32 │ ├── r3-core-host.exe │ ├── r3-core.exe │ ├── r3-view-host.exe │ └── r3.dll ├── src ├── agg │ ├── agg_arc.cpp │ ├── agg_arc.h │ ├── agg_array.h │ ├── agg_arrowhead.cpp │ ├── agg_arrowhead.h │ ├── agg_basics.h │ ├── agg_bezier_arc.cpp │ ├── agg_bezier_arc.h │ ├── agg_bitset_iterator.h │ ├── agg_blur.h │ ├── agg_bspline.cpp │ ├── agg_bspline.h │ ├── agg_clip_liang_barsky.h │ ├── agg_color_rgba.h │ ├── agg_config.h │ ├── agg_conv_adaptor_vcgen.h │ ├── agg_conv_adaptor_vpgen.h │ ├── agg_conv_bspline.h │ ├── agg_conv_contour.h │ ├── agg_conv_curve.h │ ├── agg_conv_dash.h │ ├── agg_conv_marker.h │ ├── agg_conv_segmentator.h │ ├── agg_conv_smooth_poly1.h │ ├── agg_conv_stroke.h │ ├── agg_conv_transform.h │ ├── agg_curves.cpp │ ├── agg_curves.h │ ├── agg_dda_line.h │ ├── agg_effects.cpp │ ├── agg_effects.h │ ├── agg_ellipse_bresenham.h │ ├── agg_font_cache_manager.h │ ├── agg_font_freetype.cpp │ ├── agg_font_freetype.h │ ├── agg_font_win32_tt.cpp │ ├── agg_font_win32_tt.h │ ├── agg_fontconfig.cpp │ ├── agg_gamma_functions.h │ ├── agg_graphics.cpp │ ├── agg_graphics.h │ ├── agg_image_filters.cpp │ ├── agg_image_filters.h │ ├── agg_line_aa_basics.cpp │ ├── agg_line_aa_basics.h │ ├── agg_math.h │ ├── agg_math_stroke.h │ ├── agg_path_storage.cpp │ ├── agg_path_storage.h │ ├── agg_path_storage_integer.h │ ├── agg_pattern_filters_rgba_rebol.h │ ├── agg_pixfmt_rgba_rebol.h │ ├── agg_pixfmt_transposer.h │ ├── agg_rasterizer_outline.h │ ├── agg_rasterizer_outline_aa.h │ ├── agg_rasterizer_scanline_aa.cpp │ ├── agg_rasterizer_scanline_aa.h │ ├── agg_render_scanlines.h │ ├── agg_renderer_base.h │ ├── agg_renderer_outline_aa.h │ ├── agg_renderer_outline_image_rebol.h │ ├── agg_renderer_primitives.h │ ├── agg_renderer_scanline.h │ ├── agg_rendering_buffer.h │ ├── agg_rounded_rect.cpp │ ├── agg_rounded_rect.h │ ├── agg_scanline_bin.h │ ├── agg_scanline_boolean_algebra.h │ ├── agg_scanline_p.h │ ├── agg_scanline_storage_aa.h │ ├── agg_scanline_storage_bin.h │ ├── agg_scanline_u.h │ ├── agg_shorten_path.h │ ├── agg_simul_eq.h │ ├── agg_span_allocator.h │ ├── agg_span_converter.h │ ├── agg_span_generator.h │ ├── agg_span_gouraud.h │ ├── agg_span_gouraud_rgba.h │ ├── agg_span_gradient.h │ ├── agg_span_image_filter.h │ ├── agg_span_image_filter_rgba_rebol.h │ ├── agg_span_image_resample.h │ ├── agg_span_image_resample_rgba_rebol.h │ ├── agg_span_interpolator_linear.h │ ├── agg_span_interpolator_persp.h │ ├── agg_span_interpolator_trans.h │ ├── agg_span_pattern.h │ ├── agg_span_pattern_filter_rgba_rebol.h │ ├── agg_span_pattern_resample_rgba_rebol.h │ ├── agg_span_solid.h │ ├── agg_span_subdiv_adaptor.h │ ├── agg_sqrt_tables.cpp │ ├── agg_trans_affine.cpp │ ├── agg_trans_affine.h │ ├── agg_trans_bilinear.h │ ├── agg_trans_perspective.h │ ├── agg_trans_single_path.cpp │ ├── agg_trans_single_path.h │ ├── agg_truetype_text.cpp │ ├── agg_truetype_text.h │ ├── agg_vcgen_bspline.cpp │ ├── agg_vcgen_bspline.h │ ├── agg_vcgen_contour.cpp │ ├── agg_vcgen_contour.h │ ├── agg_vcgen_dash.cpp │ ├── agg_vcgen_dash.h │ ├── agg_vcgen_markers_term.cpp │ ├── agg_vcgen_markers_term.h │ ├── agg_vcgen_smooth_poly1.cpp │ ├── agg_vcgen_smooth_poly1.h │ ├── agg_vcgen_stroke.cpp │ ├── agg_vcgen_stroke.h │ ├── agg_vertex_sequence.h │ ├── agg_vpgen_segmentator.cpp │ ├── agg_vpgen_segmentator.h │ └── util │ │ ├── agg_color_conv.h │ │ ├── agg_color_conv_rgb16.h │ │ └── agg_color_conv_rgb8.h ├── boot │ ├── actions.r │ ├── booters.r │ ├── core.r │ ├── draw.r │ ├── errors.r │ ├── graphics.r │ ├── modes.r │ ├── natives.r │ ├── ops.r │ ├── platforms.r │ ├── root.r │ ├── shape.r │ ├── strings.r │ ├── sysobj.r │ ├── task.r │ ├── text.r │ ├── types-ext.r │ ├── types.r │ ├── typespec.r │ ├── version.r │ └── words.r ├── codecs │ ├── aes │ │ ├── aes.c │ │ └── aes.h │ ├── bigint │ │ ├── bigint.c │ │ ├── bigint.h │ │ ├── bigint_config.h │ │ └── bigint_impl.h │ ├── dh │ │ ├── dh.c │ │ └── dh.h │ ├── png │ │ ├── lodepng.c │ │ └── lodepng.h │ ├── rc4 │ │ ├── rc4.c │ │ └── rc4.h │ └── rsa │ │ ├── rsa.c │ │ └── rsa.h ├── core │ ├── a-constants.c │ ├── a-globals.c │ ├── a-lib.c │ ├── a-lib2.c │ ├── a-stubs.c │ ├── b-init.c │ ├── b-main.c │ ├── c-do.c │ ├── c-error.c │ ├── c-frame.c │ ├── c-function.c │ ├── c-port.c │ ├── c-task.c │ ├── c-word.c │ ├── d-crash.c │ ├── d-dump.c │ ├── d-print.c │ ├── f-blocks.c │ ├── f-deci.c │ ├── f-dtoa.c │ ├── f-enbase.c │ ├── f-extension.c │ ├── f-int.c │ ├── f-math.c │ ├── f-modify.c │ ├── f-qsort.c │ ├── f-random.c │ ├── f-round.c │ ├── f-series.c │ ├── f-stubs.c │ ├── l-scan.c │ ├── l-types.c │ ├── m-gc.c │ ├── m-pools.c │ ├── m-series.c │ ├── n-control.c │ ├── n-data.c │ ├── n-graphics.c │ ├── n-io.c │ ├── n-loop.c │ ├── n-math.c │ ├── n-sets.c │ ├── n-strings.c │ ├── n-system.c │ ├── p-clipboard.c │ ├── p-console.c │ ├── p-dir.c │ ├── p-dns.c │ ├── p-event.c │ ├── p-file.c │ ├── p-net.c │ ├── p-serial.c │ ├── p-signal.c │ ├── p-timer.c │ ├── s-cases.c │ ├── s-crc.c │ ├── s-file.c │ ├── s-find.c │ ├── s-make.c │ ├── s-mold.c │ ├── s-ops.c │ ├── s-trim.c │ ├── s-unicode.c │ ├── t-bitset.c │ ├── t-block.c │ ├── t-char.c │ ├── t-datatype.c │ ├── t-date.c │ ├── t-decimal.c │ ├── t-event.c │ ├── t-function.c │ ├── t-gob.c │ ├── t-image.c │ ├── t-integer.c │ ├── t-library.c │ ├── t-logic.c │ ├── t-map.c │ ├── t-money.c │ ├── t-none.c │ ├── t-object.c │ ├── t-pair.c │ ├── t-port.c │ ├── t-routine.c │ ├── t-string.c │ ├── t-struct.c │ ├── t-time.c │ ├── t-tuple.c │ ├── t-typeset.c │ ├── t-utype.c │ ├── t-vector.c │ ├── t-word.c │ ├── u-bmp.c │ ├── u-compress.c │ ├── u-dialect.c │ ├── u-gif.c │ ├── u-jpg.c │ ├── u-md5.c │ ├── u-parse.c │ ├── u-png.c │ ├── u-sha1.c │ └── u-zlib.c ├── include │ ├── host-compositor.h │ ├── host-draw-api.h │ ├── host-text-api.h │ ├── host-view.h │ ├── reb-args.h │ ├── reb-c.h │ ├── reb-codec.h │ ├── reb-config.h │ ├── reb-defs.h │ ├── reb-device.h │ ├── reb-dtoa.h │ ├── reb-event.h │ ├── reb-ext.h │ ├── reb-file.h │ ├── reb-filereq.h │ ├── reb-gob.h │ ├── reb-host.h │ ├── reb-math.h │ ├── reb-net.h │ ├── reb-series.h │ ├── reb-struct.h │ ├── reb-value.h │ ├── sys-core.h │ ├── sys-dec-to-char.h │ ├── sys-deci-funcs.h │ ├── sys-deci.h │ ├── sys-globals.h │ ├── sys-int-funcs.h │ ├── sys-jpg.h │ ├── sys-mem.h │ ├── sys-net.h │ ├── sys-panics.h │ ├── sys-scan.h │ ├── sys-stack.h │ ├── sys-state.h │ ├── sys-value.h │ └── sys-zlib.h ├── mezz │ ├── base-constants.r │ ├── base-debug.r │ ├── base-defs.r │ ├── base-files.r │ ├── base-funcs.r │ ├── base-series.r │ ├── boot-files.r │ ├── dial-draw.r │ ├── dial-effect.r │ ├── dial-text.r │ ├── mezz-banner.r │ ├── mezz-colors.r │ ├── mezz-control.r │ ├── mezz-debug.r │ ├── mezz-files.r │ ├── mezz-func.r │ ├── mezz-help.r │ ├── mezz-math.r │ ├── mezz-save.r │ ├── mezz-secure.r │ ├── mezz-series.r │ ├── mezz-shell.r │ ├── mezz-tail.r │ ├── mezz-types.r │ ├── prot-http.r │ ├── prot-tls.r │ ├── saphir-patches.r │ ├── sys-base.r │ ├── sys-codec.r │ ├── sys-load.r │ ├── sys-ports.r │ ├── sys-start.r │ └── view-funcs.r ├── os │ ├── dev-dns.c │ ├── dev-net.c │ ├── host-args.c │ ├── host-core.c │ ├── host-device.c │ ├── host-draw-api-agg.cpp │ ├── host-draw-api-skia.c │ ├── host-draw.c │ ├── host-ext-test.c │ ├── host-main.c │ ├── host-stdio.c │ ├── host-text-api-agg.cpp │ ├── host-text-api-skia.c │ ├── host-text.c │ ├── host-view.c │ ├── linux │ │ ├── ISO-639-2_utf-8.txt │ │ ├── dev-clipboard.c │ │ ├── dev-event.c │ │ ├── dev-file.c │ │ ├── dev-serial.c │ │ ├── dev-signal.c │ │ ├── dev-stdio.c │ │ ├── file-chooser-gtk.c │ │ ├── host-compositor.c │ │ ├── host-event.c │ │ ├── host-graphics.c │ │ ├── host-lib.c │ │ ├── host-put-image.cpp │ │ ├── host-readline.c │ │ ├── host-window.c │ │ ├── host-window.h │ │ ├── iso-3166.c │ │ ├── iso-3166.h │ │ ├── iso-639.c │ │ ├── iso-639.h │ │ ├── iso3166.r │ │ ├── iso3166.txt │ │ ├── iso639.r │ │ ├── keysym2ucs.c │ │ └── keysym2ucs.h │ ├── osx │ │ ├── dev-event.c │ │ ├── dev-file.c │ │ ├── dev-stdio.c │ │ ├── host-compositor.c │ │ ├── host-graphics.c │ │ ├── host-lib.c │ │ ├── host-readline.c │ │ └── host-window.c │ ├── porting-templates │ │ ├── dev-clipboard.c │ │ ├── dev-event.c │ │ ├── dev-file.c │ │ ├── dev-stdio.c │ │ ├── host-compositor.c │ │ ├── host-effect.c │ │ ├── host-event.c │ │ ├── host-graphics.c │ │ ├── host-lib.c │ │ ├── host-readline.c │ │ └── host-window.c │ ├── sdl │ │ ├── dev-clipboard.c │ │ ├── dev-event.c │ │ ├── host-compositor.c │ │ ├── host-event.c │ │ ├── host-graphics.c │ │ └── host-window.c │ └── win32 │ │ ├── dev-clipboard.c │ │ ├── dev-event.c │ │ ├── dev-file.c │ │ ├── dev-serial.c │ │ ├── dev-stdio.c │ │ ├── host-compositor-gdi.c │ │ ├── host-effect.c │ │ ├── host-event.c │ │ ├── host-graphics.c │ │ ├── host-lib.c │ │ ├── host-licensing.c │ │ ├── host-window.c │ │ └── rpic-test.c └── tools │ ├── core-ext.r │ ├── file-base.r │ ├── form-header.r │ ├── licensing-ext.r │ ├── make-boot.r │ ├── make-headers.r │ ├── make-host-ext.r │ ├── make-host-init.r │ ├── make-make.r │ ├── make-os-ext.r │ ├── make-reb-lib.r │ ├── rt-init.r │ ├── saphir-init.r │ ├── systems.r │ └── view-ext.r └── tests ├── dev-small.jpg ├── draw-test.r3 ├── draw-windows.png ├── draw.png ├── gfx-pre.r3 ├── text-test.r3 └── text-windows.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Custom for Visual Studio 2 | *.cs diff=csharp 3 | *.sln merge=union 4 | *.csproj merge=union 5 | *.vbproj merge=union 6 | *.fsproj merge=union 7 | *.dbproj merge=union 8 | 9 | # Standard to msysgit 10 | *.doc diff=astextplain 11 | *.DOC diff=astextplain 12 | *.docx diff=astextplain 13 | *.DOCX diff=astextplain 14 | *.dot diff=astextplain 15 | *.DOT diff=astextplain 16 | *.pdf diff=astextplain 17 | *.PDF diff=astextplain 18 | *.rtf diff=astextplain 19 | *.RTF diff=astextplain 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/libffi"] 2 | path = src/libffi 3 | url = git://github.com/atgreen/libffi.git 4 | [submodule "src/remotery"] 5 | path = src/remotery 6 | url = git@10.21.2.8:szeng/remotery.git 7 | [submodule "src/skia"] 8 | path = src/skia 9 | url = git@10.21.2.8:szeng/skia.git 10 | [submodule "src/reb-skia"] 11 | path = src/reb-skia 12 | url = git@10.21.2.8:szeng/reb-skia.git 13 | [submodule "src/src/SDL"] 14 | path = src/SDL 15 | url = https://github.com/SDL-mirror/SDL.git 16 | [submodule "src/angle"] 17 | path = src/angle 18 | url = https://chromium.googlesource.com/angle/angle 19 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Steps to compile Atronix (http://www.atronixengineering.com) flavor of Rebol 3 2 | 0. some directory variables: 3 | #top points to the top directory of source 4 | 1. get libffi compiled and installed 5 | #cd $(top)/src/libffi 6 | #./autogen.sh 7 | #./configure --prefix=`pwd`/../../make/libffi 8 | #make 9 | #make install 10 | 2. go back to top make directory 11 | #cd $(top)/make 12 | #make -f makefile-64 clean #ignore errors it generates 13 | #make -f makefile-64 r3-view-linux 14 | #possible makefiles are: 15 | a. makefile-64 for 64-bit Linux systems 16 | b. makefile-32 for 32-bit Linux systems 17 | c. makefile-mingw-32 for cross-compiling for 32-bit windows systems from Linux 18 | d. makefile-mingw-64 for cross-compileing for 64-bit windows sytems from Linux 19 | e. makefile-armv7 for ARMv7 linux systems 20 | 21 | Notes: only r3-view-linux is tested, i.e. r3-core-linux might not even build 22 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | REBOL [R3] Language Interpreter and Run-time Environment 2 | Copyright 2012 REBOL Technologies 3 | REBOL is a trademark of REBOL Technologies 4 | Additional code modifications and improvements Copyright 2012 Saphirion 5 | Licensed under the Apache License, Version 2.0 6 | See included LICENSE file for details 7 | 8 | 9 | Credits for Non-REBOL orginated C files and modules 10 | --------------------------------------------------- 11 | 12 | Unicode encoding/decoding functions: 13 | Copyright 2001-2004 Unicode, Inc. 14 | 15 | MD5: 16 | This software contains code derived from the RSA Data Security 17 | Inc. MD5 Message-Digest Algorithm, including various 18 | modifications by Spyglass Inc., Carnegie Mellon University, and 19 | Bell Communications Research, Inc (Bellcore). 20 | 21 | SHA1: 22 | Copyright 1995-1998 Eric Young (eay@cryptsoft.com) 23 | All rights reserved. 24 | 25 | ZLIB general purpose compression library: 26 | Version 1.1.2, March 19th, 1998 27 | Copyright 1995-1998 Jean-loup Gailly and Mark Adler 28 | 29 | JPEG decoder: 30 | Copyright 1994-1996, Thomas G. Lane. 31 | This file is part of the Independent JPEG Group's software. 32 | 33 | dtoa: 34 | The author of this software is David M. Gay. 35 | Copyright (c) 1991, 2000, 2001 by Lucent Technologies. 36 | 37 | bigint: 38 | Copyright (c) 2007, Cameron Rich 39 | 40 | AES: 41 | Copyright (c) 2007, Cameron Rich 42 | 43 | DH: 44 | Copyright (c) 2013 Richard Smolak 45 | 46 | RC4: 47 | Copyright (c) 2007, Cameron Rich 48 | 49 | LodePNG: 50 | Copyright (c) 2005-2013 Lode Vandevenne 51 | 52 | Anti-Grain Geometry: 53 | Copyright (C) 2002-2005 Maxim Shemanarev 54 | 55 | qsort: 56 | Copyright (c) 1992, 1993 The Regents of the University of California. 57 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Rebol [R3] Source Code Distribution 2 | Date: 12-Dec-2012 3 | Version: 2.101.0 4 | From: Carl Sassenrath 5 | Web: www.rebol.com 6 | 7 | 8 | Build Target: 9 | 10 | This first release is intended for non-Windows systems like Linux, Mac, BSD, 11 | Android, etc. However, it will build for Windows, but I've not included the 12 | typical MSVC project files. I'll try to get that added, but it's not that 13 | tough to create one yourself. You will need to set struct align to 4 bytes. 14 | 15 | 16 | About the Makefile: 17 | 18 | You might notice that the makefile is a bit old-fashioned. That's because I 19 | still support Rebol on some very old systems that don't offer newer makefile 20 | features. So, please keep that in mind and stick with this simple format. 21 | 22 | Also, the makefile is built by Rebol. Typing "make make" will rebuild it, 23 | and you can also select a different platform target by providing 24 | the Rebol platform identifier typing e.g. "make make OS_ID=0.4.4" (Linux 25 | Libc6 2.11 platform version). 26 | 27 | 28 | Build Instructions: 29 | 30 | Parts of Rebol are built by Rebol. So, to build it, you'll need to download a 31 | running binary into the local make directory. Call it r3-make. 32 | 33 | The build happens in the make directory. It will create an obj sub-dir for 34 | storing the object files. I prefer this over mixing the source and object 35 | files into the same directory. 36 | 37 | You may need to do "make clean" for clean make session. 38 | 39 | The biggest step is to do the "make prep" which will use Rebol to configure 40 | and build a number of important C header files. 41 | 42 | If you are building for a new platform that has no existing Rebol, you can use 43 | "make prep" to build all the files you need on an existing platform and copy 44 | them to the new platform. 45 | 46 | After the prep, just run "make" or "make r3" and the rest of the system will 47 | build. 48 | 49 | 50 | Toolchain Note: 51 | 52 | Rebol builds on many different compilers over a range of systems. Although 53 | the C source doesn't strictly follow any one standard, it's quite portable 54 | and I've yet to find a toolchain that won't build it. You can even cross 55 | compile it for embedded systems quite easily. If you run into a problem, 56 | it's probably something fairly simple. Don't over complicate it. 57 | 58 | 59 | Note to Contributors: 60 | 61 | I welcome your help with porting Rebol to many more devices and making various 62 | improvements. I just ask that you: 63 | 64 | 1. Keep code clear and simple. 65 | 2. Document unusual code, reasoning, or gotchas. 66 | 3. Use same style for code, vars, indent(4), comments, etc. 67 | 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 68 | 5. Test everything, then test it again. 69 | 70 | Enjoy your new Rebol freedom, 71 | 72 | -Carl 73 | 74 | Bug reporting note: 75 | 76 | Report bugs, wishes, etc. at the 77 | 78 | http://curecode.org/rebol3/view-tickets.rsp 79 | 80 | site. -------------------------------------------------------------------------------- /make/PESpin_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/PESpin_x64.exe -------------------------------------------------------------------------------- /make/makefile-32: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-32 2 | TO_OS?= TO_LINUX_X86 3 | OS_ID?= 0.4.4 4 | BIT="-m32" 5 | EXTRA_VIEW_CFLAGS=-DUSE_GTK_FILECHOOSER -DUSE_XSHM 6 | LIBFFI_A=libffi.$(MAKEFILE)/lib32/libffi.a 7 | PKG_CONFIG=PKG_CONFIG_PATH=/usr/lib32/pkgconfig pkg-config 8 | 9 | MD=makefiles 10 | 11 | include $(MD)/common-defs 12 | include $(MD)/linux-common-defs 13 | 14 | HOST=$(HOST_COMMON) \ 15 | $(HOST_LINUX) 16 | 17 | GFX=$(GFX_COMMON) \ 18 | $(GFX_LINUX) 19 | 20 | AGG=$(AGG_COMMON) \ 21 | $(AGG_LINUX) 22 | 23 | include $(MD)/common-targets 24 | include $(MD)/linux-common-targets 25 | -------------------------------------------------------------------------------- /make/makefile-64: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-64 2 | TO_OS= TO_LINUX_X64 3 | OS_ID= 0.4.40 4 | EXTRA_VIEW_CFLAGS=-DUSE_GTK_FILECHOOSER -DUSE_XSHM 5 | LIBFFI_A=libffi.$(MAKEFILE)/lib/libffi.a 6 | PKG_CONFIG=pkg-config 7 | 8 | MD=makefiles 9 | 10 | include $(MD)/common-defs 11 | include $(MD)/linux-common-defs 12 | 13 | HOST=$(HOST_COMMON) \ 14 | $(HOST_LINUX) 15 | 16 | GFX=$(GFX_COMMON) \ 17 | $(GFX_LINUX) 18 | 19 | AGG=$(AGG_COMMON) \ 20 | $(AGG_LINUX) 21 | 22 | include $(MD)/common-targets 23 | include $(MD)/linux-common-targets 24 | -------------------------------------------------------------------------------- /make/makefile-64-sdl: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-64 2 | TO_OS= TO_LINUX_X64 3 | OS_ID= 0.4.40 4 | EXTRA_VIEW_CFLAGS=-DUSE_GTK_FILECHOOSER 5 | #LIBFFI_A=libffi/lib/libffi.a 6 | LIBFFI_A=-lffi 7 | INCL=-I/usr/include/SDL2 8 | 9 | MD=makefiles 10 | 11 | include $(MD)/common-defs 12 | include $(MD)/linux-common-defs-sdl 13 | 14 | HOST=$(HOST_COMMON) \ 15 | $(HOST_LINUX) 16 | 17 | GFX=$(GFX_COMMON) \ 18 | $(GFX_LINUX) 19 | 20 | AGG=$(AGG_COMMON) \ 21 | $(AGG_LINUX) 22 | 23 | LIBREBSKIA=$(HOME)/work/reb-skia.git/build-linux/librebskia.a \ 24 | $(HOME)/work/reb-skia.git/build-linux/libunibreak/lib/libunibreak.a \ 25 | $(HOME)/work/skia.git/out/Debug/libskia.a \ 26 | -lpthread -lEGL 27 | 28 | LIBREBSKIA=$(HOME)/work/reb-skia.git/build-linux-release/librebskia.a \ 29 | $(HOME)/work/reb-skia.git/build-linux-release/libunibreak/lib/libunibreak.a \ 30 | $(HOME)/work/skia.git/out/Release/libskia.a \ 31 | -lpthread -lEGL 32 | 33 | LIBREBSKIA=../src/reb-skia/build-linux-release/librebskia.a \ 34 | ../src/reb-skia/build-linux-release/libunibreak/lib/libunibreak.a \ 35 | ../src/skia/out/Release/libskia.a \ 36 | -lpthread -lEGL 37 | 38 | #LIBREBSKIA=../src/reb-skia/build-linux/librebskia.a \ 39 | # ../src/reb-skia/build-linux/libunibreak/lib/libunibreak.a \ 40 | # ../src/skia/out/Release/libskia.a \ 41 | # -lpthread -lEGL 42 | # 43 | #LIBREBSKIA=../src/reb-skia/build-linux/librebskia.a \ 44 | # ../src/reb-skia/build-linux/libunibreak/lib/libunibreak.a \ 45 | # ../src/skia/out/Debug/libskia.a \ 46 | # -lpthread -lEGL 47 | 48 | include $(MD)/common-targets 49 | include $(MD)/linux-common-targets-sdl 50 | -------------------------------------------------------------------------------- /make/makefile-aarch64: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-aarch64 2 | TO_OS?= TO_LINUX_AARCH64 3 | OS_ID?= 0.4.22 4 | BIT= 5 | EXTRA_VIEW_CFLAGS=-DUSE_GTK_FILECHOOSER -DUSE_XSHM 6 | LIBFFI_A=libffi.$(MAKEFILE)/lib/libffi.a 7 | PKG_CONFIG=pkg-config 8 | 9 | MD=makefiles 10 | 11 | TOOLS=~/work/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- 12 | 13 | include $(MD)/common-defs 14 | include $(MD)/linux-common-defs 15 | 16 | HOST=$(HOST_COMMON) \ 17 | $(HOST_LINUX) 18 | 19 | GFX=$(GFX_COMMON) \ 20 | $(GFX_LINUX) 21 | 22 | AGG=$(AGG_COMMON) \ 23 | $(AGG_LINUX) 24 | 25 | include $(MD)/common-targets 26 | include $(MD)/linux-common-targets 27 | -------------------------------------------------------------------------------- /make/makefile-armv7: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-armv7 2 | TO_OS?= TO_LINUX_ARM 3 | OS_ID?= 0.4.20 4 | BIT= 5 | EXTRA_VIEW_CFLAGS=-DUSE_GTK_FILECHOOSER -DUSE_XSHM 6 | LIBFFI_A=libffi.$(MAKEFILE)/lib/libffi.a 7 | 8 | MD=makefiles 9 | 10 | include $(MD)/common-defs 11 | include $(MD)/linux-common-defs 12 | 13 | HOST=$(HOST_COMMON) \ 14 | $(HOST_LINUX) 15 | 16 | GFX=$(GFX_COMMON) \ 17 | $(GFX_LINUX) 18 | 19 | AGG=$(AGG_COMMON) \ 20 | $(AGG_LINUX) 21 | 22 | include $(MD)/common-targets 23 | include $(MD)/linux-common-targets 24 | -------------------------------------------------------------------------------- /make/makefile-mingw-32: -------------------------------------------------------------------------------- 1 | MD=makefiles 2 | MAKEFILE = makefile-mingw-32 3 | 4 | TO_OS= TO_WIN32 5 | OS_ID= 0.3.1 6 | BIT= -m32 7 | 8 | TOOLS=/usr/bin/i686-w64-mingw32- 9 | INCL=/usr/i686-w64-mingw32/include/ 10 | LIBPATH=/usr/i686-w64-mingw32/lib/ 11 | 12 | include $(MD)/common-defs 13 | include $(MD)/mingw-common-defs 14 | 15 | HOST=$(HOST_COMMON) \ 16 | $(HOST_MINGW) 17 | 18 | GFX=$(GFX_COMMON) \ 19 | $(GFX_MINGW) 20 | 21 | AGG=$(AGG_COMMON) \ 22 | $(AGG_MINGW) 23 | 24 | include $(MD)/common-targets 25 | include $(MD)/mingw-common-targets 26 | -------------------------------------------------------------------------------- /make/makefile-mingw-64: -------------------------------------------------------------------------------- 1 | MD=makefiles 2 | MAKEFILE = makefile-mingw-64 3 | 4 | TO_OS?= TO_WIN32 5 | OS_ID?= 0.3.3 6 | BIT= -m64 7 | EXTRA_CFLAGS=-D__LLP64__ 8 | 9 | TOOLS=/usr/bin/x86_64-w64-mingw32- 10 | INCL=/usr/x86_64-w64-mingw32/include/ 11 | LIBPATH=/usr/x86_64-w64-mingw32/lib/ 12 | 13 | include $(MD)/common-defs 14 | include $(MD)/mingw-common-defs 15 | 16 | HOST=$(HOST_COMMON) \ 17 | $(HOST_MINGW) 18 | 19 | GFX=$(GFX_COMMON) \ 20 | $(GFX_MINGW) 21 | 22 | AGG=$(AGG_COMMON) \ 23 | $(AGG_MINGW) 24 | 25 | include $(MD)/common-targets 26 | include $(MD)/mingw-common-targets 27 | -------------------------------------------------------------------------------- /make/makefile-osx-64: -------------------------------------------------------------------------------- 1 | MAKEFILE=makefile-osx-64 2 | TO_OS?= TO_OSX_X64 3 | OS_ID?= 0.2.40 4 | EXTRA_VIEW_CFLAGS= 5 | LIBFFI_A=libffi.$(MAKEFILE)/lib/libffi.a 6 | PKG_CONFIG=pkg-config 7 | 8 | MD=makefiles 9 | 10 | INCL=/opt/X11/include 11 | LDFLAGS=-L/opt/X11/lib 12 | 13 | include $(MD)/common-defs 14 | include $(MD)/linux-common-defs 15 | BIN_SUFFIX= 16 | 17 | HOST=$(HOST_COMMON) \ 18 | $(HOST_POSIX) 19 | 20 | GFX=$(GFX_COMMON) \ 21 | $(GFX_LINUX) 22 | 23 | AGG=$(AGG_COMMON) \ 24 | $(AGG_LINUX) 25 | 26 | include $(MD)/common-targets 27 | include $(MD)/osx-common-targets 28 | -------------------------------------------------------------------------------- /make/makefiles/linux-common-defs: -------------------------------------------------------------------------------- 1 | BIN_SUFFIX= -linux 2 | CC ?= $(TOOLS)clang 3 | CXX ?= $(TOOLS)clang 4 | 5 | INCL ?= . 6 | INC= -I$(INCL) -I$S/include/ -I$S/codecs/ -I../src/freetype-2.4.12/include `$(PKG_CONFIG) freetype2 --cflags` -Ilibffi.$(MAKEFILE)/lib/libffi-3.1.1/include/ 7 | 8 | RAPI_FLAGS= $(CFLAGS) $(BIT) -Wno-pointer-sign -fvisibility=default -fPIC -ffloat-store 9 | HOST_CORE_FLAGS= $(CFLAGS) -Wno-pointer-sign -DREB_CORE -DMIN_OS -DREB_EXE $(BIT) -fvisibility=default -D_FILE_OFFSET_BITS=64 -DCUSTOM_STARTUP -ffloat-store 10 | HOST_VIEW_FLAGS= $(CFLAGS) -Wno-pointer-sign -DREB_EXE $(BIT) -fvisibility=default -D_FILE_OFFSET_BITS=64 -DCUSTOM_STARTUP -ffloat-store $(EXTRA_VIEW_CFLAGS) 11 | HFLAGS_FONT_CONFIG=`$(PKG_CONFIG) fontconfig --cflags` 12 | 13 | CLIB= -ldl -lm $(LIBFFI_A) 14 | GUI_CLIB= -ldl -lm -lstdc++ -lfreetype -L../src/freetype-2.4.12/objs/.libs/ `$(PKG_CONFIG) freetype2 --libs` -lXrandr -lX11 `$(PKG_CONFIG) fontconfig --libs` $(BIT) -lXext $(LDFLAGS) 15 | # REBOL builds various include files: 16 | REBOL= $(CD)r3-make-linux -qs 17 | 18 | HOST_POSIX = \ 19 | $(OBJ_DIR)/host-readline.o \ 20 | $(OBJ_DIR)/iso-639.o \ 21 | $(OBJ_DIR)/iso-3166.o 22 | 23 | HOST_LINUX = \ 24 | ${HOST_POSIX} \ 25 | $(OBJ_DIR)/dev-signal.o \ 26 | $(OBJ_DIR)/p-signal.o \ 27 | $(OBJ_DIR)/file-chooser-gtk.o 28 | 29 | GFX_LINUX= \ 30 | $(OBJ_DIR)/host-put-image.o \ 31 | $(OBJ_DIR)/keysym2ucs.o 32 | 33 | AGG_LINUX= \ 34 | $(OBJ_DIR)/agg_font_freetype.o\ 35 | $(OBJ_DIR)/agg_fontconfig.o 36 | -------------------------------------------------------------------------------- /make/makefiles/linux-common-defs-sdl: -------------------------------------------------------------------------------- 1 | BIN_SUFFIX= -linux 2 | CC ?= $(TOOLS)clang 3 | CXX ?= $(TOOLS)clang 4 | PKG_CONFIG ?= pkg-config 5 | 6 | INCL ?= . 7 | INC= $(INCL) -I$S/include/ -I$S/codecs/ -I../src/freetype-2.4.12/include `$(PKG_CONFIG) freetype2 --cflags` -Ilibffi.$(MAKEFILE)/lib/libffi-3.1.1/include/ -I../src/remotery/lib 8 | 9 | RAPI_FLAGS= $(CFLAGS) $(BIT) -Wno-pointer-sign -fvisibility=default -fPIC -ffloat-store 10 | HOST_CORE_FLAGS= $(CFLAGS) -Wno-pointer-sign -DREB_CORE -DMIN_OS -DREB_EXE $(BIT) -fvisibility=default -D_FILE_OFFSET_BITS=64 -DCUSTOM_STARTUP -ffloat-store 11 | HOST_VIEW_FLAGS= $(CFLAGS) -Wno-pointer-sign -DREB_EXE $(BIT) -fvisibility=default -D_FILE_OFFSET_BITS=64 -DCUSTOM_STARTUP -ffloat-store $(EXTRA_VIEW_CFLAGS) -DRMT_ENABLED=0 12 | HFLAGS_FONT_CONFIG=`$(PKG_CONFIG) fontconfig --cflags` 13 | 14 | CLIB= -ldl -lm $(LIBFFI_A) 15 | #GUI_CLIB= -ldl -lm -lstdc++ -lfreetype -L../src/freetype-2.4.12/objs/.libs/ `$(PKG_CONFIG) freetype2 --libs` `$(PKG_CONFIG) fontconfig --libs` $(BIT) $(LDFLAGS) -lSDL2 -lGL -Wl,--as-needed 16 | #GUI_CLIB= -ldl -lm -lstdc++ $(BIT) $(LDFLAGS) `$(PKG_CONFIG) fontconfig --libs` ../src/SDL/build-linux/libSDL2.a -lOpenGL -Wl,--as-needed 17 | GUI_CLIB= -ldl -lm -lstdc++ $(BIT) $(LDFLAGS) `$(PKG_CONFIG) fontconfig --libs` `$(PKG_CONFIG) sdl2 --libs` -lOpenGL -Wl,--as-needed 18 | # REBOL builds various include files: 19 | REBOL= $(CD)r3-make-linux -qs 20 | 21 | HOST_POSIX = \ 22 | $(OBJ_DIR)/host-readline.o \ 23 | $(OBJ_DIR)/iso-639.o \ 24 | $(OBJ_DIR)/iso-3166.o 25 | 26 | HOST_LINUX = \ 27 | ${HOST_POSIX} \ 28 | $(OBJ_DIR)/dev-signal.o \ 29 | $(OBJ_DIR)/p-signal.o \ 30 | $(OBJ_DIR)/file-chooser-gtk.o 31 | 32 | AGG_LINUX= \ 33 | $(OBJ_DIR)/agg_font_freetype.o\ 34 | $(OBJ_DIR)/agg_fontconfig.o 35 | -------------------------------------------------------------------------------- /make/makefiles/linux-common-targets: -------------------------------------------------------------------------------- 1 | $(OBJ_DIR)/keysym2ucs.o: $S/os/linux/keysym2ucs.c 2 | $(CC) $< $(HFLAGS) -o $@ 3 | 4 | $(OBJ_DIR)/iso-639.o: $S/os/linux/iso-639.c 5 | $(CC) $< $(HFLAGS) -o $@ 6 | 7 | $(OBJ_DIR)/iso-3166.o: $S/os/linux/iso-3166.c 8 | $(CC) $< $(HFLAGS) -o $@ 9 | 10 | $(OBJ_DIR)/host-put-image.o: $S/os/linux/host-put-image.cpp 11 | $(CXX) $< $(HFLAGS_CPP) -o $@ -I $S/agg 12 | 13 | $(OBJ_DIR)/agg_font_freetype.o: $S/agg/agg_font_freetype.cpp 14 | $(CXX) $< $(HFLAGS_CPP) -o $@ -I $S/agg 15 | 16 | $(OBJ_DIR)/agg_fontconfig.o:$S/agg/agg_fontconfig.cpp 17 | $(CXX) $< $(HFLAGS_CPP) $(HFLAGS_FONT_CONFIG) -o $@ 18 | 19 | $(OBJ_DIR)/file-chooser-gtk.o: $S/os/linux/file-chooser-gtk.c 20 | $(CC) $< $(HFLAGS) `$(PKG_CONFIG) gtk+-3.0 --cflags` -o $@ 21 | 22 | $(OBJ_DIR)/host-lib.o: $S/os/linux/host-lib.c 23 | $(CC) $S/os/linux/host-lib.c $(HFLAGS) -o $(OBJ_DIR)/host-lib.o 24 | 25 | $(OBJ_DIR)/host-readline.o: $S/os/linux/host-readline.c 26 | $(CC) $S/os/linux/host-readline.c $(HFLAGS) -o $(OBJ_DIR)/host-readline.o 27 | 28 | $(OBJ_DIR)/dev-stdio.o: $S/os/linux/dev-stdio.c 29 | $(CC) $S/os/linux/dev-stdio.c $(HFLAGS) -o $(OBJ_DIR)/dev-stdio.o 30 | 31 | $(OBJ_DIR)/dev-event.o: $S/os/linux/dev-event.c 32 | $(CC) $S/os/linux/dev-event.c $(HFLAGS) -o $(OBJ_DIR)/dev-event.o 33 | 34 | $(OBJ_DIR)/dev-file.o: $S/os/linux/dev-file.c 35 | $(CC) $S/os/linux/dev-file.c $(HFLAGS) -o $(OBJ_DIR)/dev-file.o 36 | 37 | $(OBJ_DIR)/p-signal.o: $S/core/p-signal.c 38 | $(CC) $S/core/p-signal.c $(RFLAGS) -o $(OBJ_DIR)/p-signal.o 39 | 40 | $(OBJ_DIR)/dev-serial.o: $S/os/linux/dev-serial.c 41 | $(CC) $S/os/linux/dev-serial.c $(HFLAGS) -o $(OBJ_DIR)/dev-serial.o 42 | 43 | $(OBJ_DIR)/dev-clipboard.o: $S/os/linux/dev-clipboard.c 44 | $(CC) $S/os/linux/dev-clipboard.c $(HFLAGS) -o $(OBJ_DIR)/dev-clipboard.o 45 | 46 | $(OBJ_DIR)/dev-signal.o: $S/os/linux/dev-signal.c 47 | $(CC) $S/os/linux/dev-signal.c $(HFLAGS) -o $(OBJ_DIR)/dev-signal.o 48 | 49 | $(OBJ_DIR)/host-graphics.o: $S/os/linux/host-graphics.c 50 | $(CC) $S/os/linux/host-graphics.c $(HFLAGS) -o $(OBJ_DIR)/host-graphics.o 51 | 52 | $(OBJ_DIR)/host-window.o: $S/os/linux/host-window.c 53 | $(CC) $S/os/linux/host-window.c $(HFLAGS) -o $(OBJ_DIR)/host-window.o 54 | 55 | $(OBJ_DIR)/host-event.o: $S/os/linux/host-event.c 56 | $(CC) $S/os/linux/host-event.c $(HFLAGS) -o $(OBJ_DIR)/host-event.o 57 | 58 | $(OBJ_DIR)/host-compositor.o: $S/os/linux/host-compositor.c 59 | $(CC) $S/os/linux/host-compositor.c $(HFLAGS) -o $(OBJ_DIR)/host-compositor.o 60 | -------------------------------------------------------------------------------- /make/makefiles/linux-common-targets-sdl: -------------------------------------------------------------------------------- 1 | $(OBJ_DIR)/iso-639.o: $S/os/linux/iso-639.c 2 | $(CC) $< $(HFLAGS) -o $@ 3 | 4 | $(OBJ_DIR)/iso-3166.o: $S/os/linux/iso-3166.c 5 | $(CC) $< $(HFLAGS) -o $@ 6 | 7 | $(OBJ_DIR)/agg_font_freetype.o: $S/agg/agg_font_freetype.cpp 8 | $(CXX) $< $(HFLAGS_CPP) -o $@ -I $S/agg 9 | 10 | $(OBJ_DIR)/agg_fontconfig.o:$S/agg/agg_fontconfig.cpp 11 | $(CXX) $< $(HFLAGS_CPP) $(HFLAGS_FONT_CONFIG) -o $@ 12 | 13 | $(OBJ_DIR)/file-chooser-gtk.o: $S/os/linux/file-chooser-gtk.c 14 | $(CC) $< $(HFLAGS) `$(PKG_CONFIG) gtk+-3.0 --cflags` -o $@ 15 | 16 | $(OBJ_DIR)/host-lib.o: $S/os/linux/host-lib.c 17 | $(CC) $S/os/linux/host-lib.c $(HFLAGS) -o $(OBJ_DIR)/host-lib.o 18 | 19 | $(OBJ_DIR)/host-readline.o: $S/os/linux/host-readline.c 20 | $(CC) $S/os/linux/host-readline.c $(HFLAGS) -o $(OBJ_DIR)/host-readline.o 21 | 22 | $(OBJ_DIR)/dev-stdio.o: $S/os/linux/dev-stdio.c 23 | $(CC) $S/os/linux/dev-stdio.c $(HFLAGS) -o $(OBJ_DIR)/dev-stdio.o 24 | 25 | $(OBJ_DIR)/dev-event.o: $S/os/sdl/dev-event.c 26 | $(CC) $S/os/sdl/dev-event.c $(HFLAGS) -o $(OBJ_DIR)/dev-event.o 27 | 28 | $(OBJ_DIR)/dev-file.o: $S/os/linux/dev-file.c 29 | $(CC) $S/os/linux/dev-file.c $(HFLAGS) -o $(OBJ_DIR)/dev-file.o 30 | 31 | $(OBJ_DIR)/p-signal.o: $S/core/p-signal.c 32 | $(CC) $S/core/p-signal.c $(RFLAGS) -o $(OBJ_DIR)/p-signal.o 33 | 34 | $(OBJ_DIR)/dev-serial.o: $S/os/linux/dev-serial.c 35 | $(CC) $S/os/linux/dev-serial.c $(HFLAGS) -o $(OBJ_DIR)/dev-serial.o 36 | 37 | $(OBJ_DIR)/dev-clipboard.o: $S/os/sdl/dev-clipboard.c 38 | $(CC) $S/os/sdl/dev-clipboard.c $(HFLAGS) -o $(OBJ_DIR)/dev-clipboard.o 39 | 40 | $(OBJ_DIR)/dev-signal.o: $S/os/linux/dev-signal.c 41 | $(CC) $S/os/linux/dev-signal.c $(HFLAGS) -o $(OBJ_DIR)/dev-signal.o 42 | 43 | $(OBJ_DIR)/host-graphics.o: $S/os/sdl/host-graphics.c 44 | $(CC) $S/os/sdl/host-graphics.c $(HFLAGS) -o $(OBJ_DIR)/host-graphics.o 45 | 46 | $(OBJ_DIR)/host-window.o: $S/os/sdl/host-window.c 47 | $(CC) $S/os/sdl/host-window.c $(HFLAGS) -I$(HOME)/work/reb-skia.git -o $(OBJ_DIR)/host-window.o 48 | 49 | $(OBJ_DIR)/host-event.o: $S/os/sdl/host-event.c 50 | $(CC) $S/os/sdl/host-event.c $(HFLAGS) -o $(OBJ_DIR)/host-event.o 51 | 52 | $(OBJ_DIR)/host-compositor.o: $S/os/sdl/host-compositor.c 53 | $(CC) $S/os/sdl/host-compositor.c $(HFLAGS) -I$S/reb-skia -o $(OBJ_DIR)/host-compositor.o 54 | -------------------------------------------------------------------------------- /make/makefiles/mingw-common-defs: -------------------------------------------------------------------------------- 1 | LIB_PRODUCT_NAME ?= atronix-view #note: this can be overriden by the HOST_PRODUCT_NAME 2 | HOST_PRODUCT_NAME ?= $(LIB_PRODUCT_NAME) 3 | BIN_SUFFIX= .exe 4 | CFLAGS ?= -O2 5 | INC= -I$(INCL) -I$S/include/ -I$S/codecs/ -Ilibffi.$(MAKEFILE)/lib/libffi-3.1.1/include/ 6 | RAPI_FLAGS= $(CFLAGS) -DUNICODE $(EXTRA_CFLAGS) -ffloat-store 7 | HOST_CORE_FLAGS= -DREB_CORE -DREB_EXE $(CFLAGS) -D_UNICODE -DUNICODE -DCUSTOM_STARTUP -D_FILE_OFFSET_BITS=64 -ffloat-store $(EXTRA_CFLAGS) 8 | HOST_VIEW_FLAGS= -DREB_EXE $(CFLAGS) -D_UNICODE -DUNICODE -DCUSTOM_STARTUP -D_FILE_OFFSET_BITS=64 -ffloat-store $(EXTRA_CFLAGS) 9 | ENCAP_CORE_FLAGS= -DENCAP -DEXT_LICENSING -DNOWINIOCTLTYPEDEFS $(HOST_CORE_FLAGS) 10 | ENCAP_VIEW_FLAGS= -DENCAP -DEXT_LICENSING -DNOWINIOCTLTYPEDEFS $(HOST_VIEW_FLAGS) 11 | RLIB_FLAGS= 12 | # Flags for core and for host: 13 | RFLAGS= -c $(BIT) -D$(TO_OS) -DREB_API $(RAPI_FLAGS) $(INC) 14 | HFLAGS= -c $(BIT) -D$(TO_OS) $(HOST_FLAGS) $(INC) 15 | #-DREB_CORE 16 | #CLIB= -lm -lwsock32 -lcomdlg32 -lgdi32 -lstdc++ -mwindows -Wl,--stack=4194300 17 | CLIB= -L$(LIBPATH)-L. -static-libgcc -lm -lwsock32 -lcomdlg32 -lgdi32 -liphlpapi -Wl,--stack=4194300 libffi.$(MAKEFILE)/lib/libffi.a 18 | GUI_CLIB= -L$(LIBPATH) -L. -static-libgcc -lm -lwsock32 -lcomdlg32 -lgdi32 -lmsimg32 -liphlpapi -Wl,--stack=4194300 -mwindows -static -lstdc++ libffi.$(MAKEFILE)/lib/libffi.dll.a 19 | 20 | UPX= $(CD)upx$(BIN_SUFFIX) --ultra-brute 21 | 22 | # REBOL builds various include files: 23 | REBOL= $(CD)r3-make -qs 24 | 25 | HOST_MINGW= 26 | 27 | AGG_MINGW= $(OBJ_DIR)/agg_font_win32_tt.o 28 | -------------------------------------------------------------------------------- /make/makefiles/mingw-common-targets: -------------------------------------------------------------------------------- 1 | $(OBJ_DIR)/host-licensing.o: $S/os/win32/host-licensing.c 2 | $(CC) $S/os/win32/host-licensing.c $(HFLAGS) -o $(OBJ_DIR)/host-licensing.o 3 | 4 | $(OBJ_DIR)/host-lib.o: $S/os/win32/host-lib.c 5 | $(CC) $S/os/win32/host-lib.c $(HFLAGS) -o $(OBJ_DIR)/host-lib.o 6 | 7 | $(OBJ_DIR)/dev-stdio.o: $S/os/win32/dev-stdio.c 8 | $(CC) $S/os/win32/dev-stdio.c $(HFLAGS) -o $(OBJ_DIR)/dev-stdio.o 9 | 10 | $(OBJ_DIR)/dev-file.o: $S/os/win32/dev-file.c 11 | $(CC) $S/os/win32/dev-file.c $(HFLAGS) -o $(OBJ_DIR)/dev-file.o 12 | 13 | $(OBJ_DIR)/dev-serial.o: $S/os/win32/dev-serial.c 14 | $(CC) $S/os/win32/dev-serial.c $(HFLAGS) -o $(OBJ_DIR)/dev-serial.o 15 | 16 | $(OBJ_DIR)/dev-event.o: $S/os/win32/dev-event.c 17 | $(CC) $S/os/win32/dev-event.c $(HFLAGS) -o $(OBJ_DIR)/dev-event.o 18 | 19 | $(OBJ_DIR)/dev-clipboard.o: $S/os/win32/dev-clipboard.c 20 | $(CC) $S/os/win32/dev-clipboard.c $(HFLAGS) -o $(OBJ_DIR)/dev-clipboard.o 21 | 22 | $(OBJ_DIR)/host-compositor.o: $S/os/win32/host-compositor-gdi.c 23 | $(CC) $S/os/win32/host-compositor-gdi.c $(HFLAGS) -o $(OBJ_DIR)/host-compositor.o 24 | 25 | $(OBJ_DIR)/host-graphics.o: $S/os/win32/host-graphics.c 26 | $(CC) $S/os/win32/host-graphics.c $(HFLAGS) -o $(OBJ_DIR)/host-graphics.o 27 | 28 | $(OBJ_DIR)/host-event.o: $S/os/win32/host-event.c 29 | $(CC) $S/os/win32/host-event.c $(HFLAGS) -o $(OBJ_DIR)/host-event.o 30 | 31 | $(OBJ_DIR)/host-window.o: $S/os/win32/host-window.c 32 | $(CC) $S/os/win32/host-window.c $(HFLAGS) -o $(OBJ_DIR)/host-window.o 33 | 34 | $(OBJ_DIR)/agg_font_win32_tt.o:$S/agg/agg_font_win32_tt.cpp 35 | $(CXX) $S/agg/agg_font_win32_tt.cpp $(HFLAGS) -o $(OBJ_DIR)/agg_font_win32_tt.o 36 | -------------------------------------------------------------------------------- /make/makefiles/osx-common-targets: -------------------------------------------------------------------------------- 1 | $(OBJ_DIR)/keysym2ucs.o: $S/os/linux/keysym2ucs.c 2 | $(CC) $< $(HFLAGS) -o $@ 3 | 4 | $(OBJ_DIR)/iso-639.o: $S/os/linux/iso-639.c 5 | $(CC) $< $(HFLAGS) -o $@ 6 | 7 | $(OBJ_DIR)/iso-3166.o: $S/os/linux/iso-3166.c 8 | $(CC) $< $(HFLAGS) -o $@ 9 | 10 | $(OBJ_DIR)/host-put-image.o: $S/os/linux/host-put-image.cpp 11 | $(CXX) $< $(HFLAGS_CPP) -o $@ -I $S/agg 12 | 13 | $(OBJ_DIR)/agg_font_freetype.o: $S/agg/agg_font_freetype.cpp 14 | $(CXX) $< $(HFLAGS_CPP) -o $@ -I $S/agg 15 | 16 | $(OBJ_DIR)/agg_fontconfig.o:$S/agg/agg_fontconfig.cpp 17 | $(CXX) $< $(HFLAGS_CPP) $(HFLAGS_FONT_CONFIG) -o $@ 18 | 19 | $(OBJ_DIR)/file-chooser-gtk.o: $S/os/linux/file-chooser-gtk.c 20 | $(CC) $< $(HFLAGS) `$(PKG_CONFIG) gtk+-3.0 --cflags` -o $@ 21 | 22 | $(OBJ_DIR)/host-lib.o: $S/os/osx/host-lib.c 23 | $(CC) $S/os/osx/host-lib.c $(HFLAGS) -o $(OBJ_DIR)/host-lib.o 24 | 25 | $(OBJ_DIR)/host-readline.o: $S/os/linux/host-readline.c 26 | $(CC) $S/os/linux/host-readline.c $(HFLAGS) -o $(OBJ_DIR)/host-readline.o 27 | 28 | $(OBJ_DIR)/dev-stdio.o: $S/os/linux/dev-stdio.c 29 | $(CC) $S/os/linux/dev-stdio.c $(HFLAGS) -o $(OBJ_DIR)/dev-stdio.o 30 | 31 | $(OBJ_DIR)/dev-event.o: $S/os/linux/dev-event.c 32 | $(CC) $S/os/linux/dev-event.c $(HFLAGS) -o $(OBJ_DIR)/dev-event.o 33 | 34 | $(OBJ_DIR)/dev-file.o: $S/os/linux/dev-file.c 35 | $(CC) $S/os/linux/dev-file.c $(HFLAGS) -o $(OBJ_DIR)/dev-file.o 36 | 37 | $(OBJ_DIR)/dev-serial.o: $S/os/linux/dev-serial.c 38 | $(CC) $S/os/linux/dev-serial.c $(HFLAGS) -o $(OBJ_DIR)/dev-serial.o 39 | 40 | $(OBJ_DIR)/dev-clipboard.o: $S/os/linux/dev-clipboard.c 41 | $(CC) $S/os/linux/dev-clipboard.c $(HFLAGS) -o $(OBJ_DIR)/dev-clipboard.o 42 | 43 | $(OBJ_DIR)/host-graphics.o: $S/os/linux/host-graphics.c 44 | $(CC) $S/os/linux/host-graphics.c $(HFLAGS) -o $(OBJ_DIR)/host-graphics.o 45 | 46 | $(OBJ_DIR)/host-window.o: $S/os/linux/host-window.c 47 | $(CC) $S/os/linux/host-window.c $(HFLAGS) -o $(OBJ_DIR)/host-window.o 48 | 49 | $(OBJ_DIR)/host-event.o: $S/os/linux/host-event.c 50 | $(CC) $S/os/linux/host-event.c $(HFLAGS) -o $(OBJ_DIR)/host-event.o 51 | 52 | $(OBJ_DIR)/host-compositor.o: $S/os/linux/host-compositor.c 53 | $(CC) $S/os/linux/host-compositor.c $(HFLAGS) -o $(OBJ_DIR)/host-compositor.o 54 | -------------------------------------------------------------------------------- /make/msvc/libffi/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : libffi Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this libffi library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | libffi.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | libffi.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /make/msvc/libffi/libffi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {6629d7e2-4912-4391-b5f8-f42cb847a58f} 18 | 19 | 20 | {08f320a9-1b49-4066-a7f4-e574dd7c3481} 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Header Files\x64 50 | 51 | 52 | Header Files\x64 53 | 54 | 55 | Header Files\Win32 56 | 57 | 58 | Header Files\Win32 59 | 60 | 61 | -------------------------------------------------------------------------------- /make/msvc/r3.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r3-view", "r3\r3-view.vcxproj", "{F11D3511-DBB7-440C-932D-ADD9409188E8}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5} = {793F0ABE-66E5-48C0-9690-3060FF08AFF5} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libffi", "libffi\libffi.vcxproj", "{793F0ABE-66E5-48C0-9690-3060FF08AFF5}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Win32 = Debug|Win32 16 | Debug|x64 = Debug|x64 17 | Release|Win32 = Release|Win32 18 | Release|x64 = Release|x64 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Debug|Win32.Build.0 = Debug|Win32 23 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Debug|x64.ActiveCfg = Debug|x64 24 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Debug|x64.Build.0 = Debug|x64 25 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Release|Win32.ActiveCfg = Release|Win32 26 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Release|Win32.Build.0 = Release|Win32 27 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Release|x64.ActiveCfg = Release|x64 28 | {F11D3511-DBB7-440C-932D-ADD9409188E8}.Release|x64.Build.0 = Release|x64 29 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Debug|Win32.ActiveCfg = Debug|Win32 30 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Debug|Win32.Build.0 = Debug|Win32 31 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Debug|x64.ActiveCfg = Debug|x64 32 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Debug|x64.Build.0 = Debug|x64 33 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Release|Win32.ActiveCfg = Release|Win32 34 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Release|Win32.Build.0 = Release|Win32 35 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Release|x64.ActiveCfg = Release|x64 36 | {793F0ABE-66E5-48C0-9690-3060FF08AFF5}.Release|x64.Build.0 = Release|x64 37 | EndGlobalSection 38 | GlobalSection(SolutionProperties) = preSolution 39 | HideSolutionNode = FALSE 40 | EndGlobalSection 41 | EndGlobal 42 | -------------------------------------------------------------------------------- /make/msvc/r3/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : r3 Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this r3 application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your r3 application. 9 | 10 | 11 | r3.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | r3.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | r3.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named r3.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /make/msvc/r3/prebuild.bat: -------------------------------------------------------------------------------- 1 | set REBOL=r3-view.exe 2 | set T=../../../src/tools 3 | set OS_ID=0.3.1 4 | set HOST_PRODUCT_NAME=atronix-view 5 | 6 | %REBOL% %T%/make-headers.r 7 | %REBOL% %T%/make-boot.r %OS_ID% %HOST_PRODUCT_NAME% 8 | %REBOL% %T%/make-os-ext.r 9 | %REBOL% %T%/make-reb-lib.r 10 | %REBOL% %T%/core-ext.r 11 | %REBOL% %T%/view-ext.r 12 | %REBOL% %T%/saphir-init.r 13 | -------------------------------------------------------------------------------- /make/msvc/r3/prebuild64.bat: -------------------------------------------------------------------------------- 1 | set REBOL=r3-view.exe 2 | set T=../../../src/tools 3 | set OS_ID=0.3.3 4 | set HOST_PRODUCT_NAME=atronix-view 5 | 6 | find /c "%OS_ID%" %T%/../boot/boot-code.r 7 | if %errorlevel% equ 1 goto notfound 8 | echo "Already processed" 9 | goto done 10 | :notfound 11 | %REBOL% %T%/make-headers.r 12 | %REBOL% %T%/make-boot.r %OS_ID% %HOST_PRODUCT_NAME% 13 | %REBOL% %T%/make-os-ext.r 14 | %REBOL% %T%/make-reb-lib.r 15 | %REBOL% %T%/core-ext.r 16 | %REBOL% %T%/view-ext.r 17 | %REBOL% %T%/saphir-init.r 18 | 19 | :done 20 | -------------------------------------------------------------------------------- /make/msvc/r3/r3-view.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/msvc/r3/r3-view.exe -------------------------------------------------------------------------------- /make/r3-make-linux: -------------------------------------------------------------------------------- 1 | r3-make -------------------------------------------------------------------------------- /make/r3-make-osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/r3-make-osx -------------------------------------------------------------------------------- /make/r3-make-osxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/r3-make-osxi -------------------------------------------------------------------------------- /make/r3-make.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/r3-make.exe -------------------------------------------------------------------------------- /make/settings.ini: -------------------------------------------------------------------------------- 1 | [options] 2 | exit_when_done=1 3 | auto_run=1 4 | compress_res=1 5 | backup_file=0 6 | checksum=1 7 | remove_oep=0 8 | debug_blocker=0 9 | section_leave=1 10 | section_user=0 11 | section_name= 12 | import_resolving=2 13 | compression=1 14 | password_protection=0 15 | [advanced_settings] 16 | nanomites=100 17 | -------------------------------------------------------------------------------- /make/tests/libs.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/make/tests/libs.so -------------------------------------------------------------------------------- /make/tests/ms-drives.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | msvcrt: make library! %msvcrt.dll 4 | getdrives: make routine! compose/deep [ 5 | [return: [uint32]] 6 | (msvcrt) "_getdrives" 7 | ] 8 | 9 | maps: getdrives 10 | i: 0 11 | while [i < 26] [ 12 | unless zero? maps and shift 1 i [ 13 | print rejoin [to char! (to integer! #"A") + i ":"] 14 | ] 15 | ++ i 16 | ] 17 | close msvcrt 18 | -------------------------------------------------------------------------------- /make/tests/qsort.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | recycle/torture 4 | 5 | 6 | f: func [ 7 | a [integer!] "pointer to an integer" 8 | b [integer!] "pointer to an integer" 9 | ][ 10 | i: make struct! compose/deep [ 11 | [raw-memory: (a)] 12 | i [int32] 13 | ] 14 | j: make struct! compose/deep [ 15 | [raw-memory: (b)] 16 | i [int32] 17 | ] 18 | case [ 19 | i/i = j/i [0] 20 | i/i < j/i [-1] 21 | i/i > j/i [1] 22 | ] 23 | ] 24 | 25 | cb: make callback! [ 26 | [ 27 | a [pointer] 28 | b [pointer] 29 | return: [int32] 30 | ] 31 | :f 32 | ] 33 | 34 | libc: make library! %libc.so.6 35 | 36 | x64?: 40 = fifth system/version 37 | size_t: either x64? ['int64]['int32] 38 | qsort: make routine! compose/deep [ 39 | [ 40 | base [pointer] 41 | nmemb [(size_t)] 42 | size [(size_t)] 43 | comp [pointer] 44 | ] 45 | (libc) "qsort" 46 | ] 47 | 48 | array: make vector! [integer! 32 5 [10 8 2 9 5]] 49 | print ["array:" mold array] 50 | qsort array 5 4 (reflect cb 'addr) 51 | print ["array:" mold array] ; [2 5 8 9 10] 52 | 53 | close libc 54 | -------------------------------------------------------------------------------- /make/tests/so-main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct base { 4 | int bi; 5 | }; 6 | 7 | struct c { 8 | struct base bs; 9 | int i[2]; 10 | int j; 11 | }; 12 | 13 | struct d { 14 | struct base bs; 15 | float f; 16 | double d; 17 | }; 18 | 19 | void read_s (struct c a) 20 | { 21 | printf("a.bs.bi: %d, a.i[0]: %d, a.i[1]: %d, a.j: %d\n", a.bs.bi, a.i[0], a.i[1], a.j); 22 | } 23 | void read_s10 (struct c a, 24 | struct d a1, 25 | struct c a2, 26 | struct d a3, 27 | struct c a4, 28 | struct c a5, 29 | struct c a6, 30 | struct c a7, 31 | struct c a8, 32 | struct c a9) 33 | { 34 | printf("a.bs.bi: %d, a.i[0]: %d, a.i[1]: %d, a.j: %d\n", a.bs.bi, a.i[0], a.i[1], a.j); 35 | //printf("a1.bs.bi: %d, a1.i[0]: %d, a1.i[1]: %d, a1.j: %d\n", a1.bs.bi, a1.i[0], a1.i[1], a1.j); 36 | printf("a1.bs.bi: %d, a1.f: %f, a1.d: %f\n", a1.bs.bi, a1.f, a1.d); 37 | printf("a2.bs.bi: %d, a2.i[0]: %d, a2.i[1]: %d, a2.j: %d\n", a2.bs.bi, a2.i[0], a2.i[1], a2.j); 38 | printf("a3.bs.bi: %d, a3.f: %f, a3.d: %f\n", a3.bs.bi, a3.f, a3.d); 39 | printf("a9.bs.bi: %d, a9.i[0]: %d, a9.i[1]: %d, a9.j: %d\n", a9.bs.bi, a9.i[0], a9.i[1], a9.j); 40 | a9.bs.bi = 12345; 41 | } 42 | 43 | struct c return_s (int i) 44 | { 45 | struct c cs; 46 | cs.j = i; 47 | return cs; 48 | } 49 | -------------------------------------------------------------------------------- /make/tests/test-ffi.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | recycle/torture 3 | libc: make library! %libc.so.6 4 | ;fopen: make routine! compose [library: (libc) name: "fopen" return: 'pointer [pointer pointer]] 5 | ;fclose: make routine! compose [library: (libc) name: "fclose" return: 'int32 [pointer]] 6 | ;fwrite: make routine! compose [library: (libc) name: "fwrite" return: 'int64 [pointer int64 int64 pointer]] 7 | fopen: make routine! compose [[ path [pointer] mode [pointer] return: [pointer]] (libc) "fopen"] 8 | 9 | fclose: make routine! compose [[ fp [pointer] return: [int32] ] (libc) "fclose"] 10 | 11 | fwrite: make routine! compose [[ ptr [pointer] size [int64] nmemb [int64] stream [int64] return: [int64] ] (libc) "fwrite"] 12 | 13 | fread: make routine! compose [[ ptr [pointer] size [int64] nmemb [int64] stream [int64] return: [int64] ] (libc) "fread"] 14 | 15 | fseek: make routine! compose [[ fp [pointer] offset [int64] where [int32] return: [int32]] (libc) "fseek"] 16 | 17 | fp: fopen "/tmp/test.txt" "w+" 18 | cnt: "hello world" 19 | fwrite cnt length? cnt 1 fp 20 | 21 | buf: make struct! [s [uint8 [128]]] 22 | fseek fp 0 0 23 | fread (reflect buf 'addr) length? buf 1 fp 24 | print ["read:" to string! values-of buf "(" values-of buf ")"] 25 | 26 | a: "XXXXXXXXXXXXXX" 27 | fseek fp 0 0 28 | fread a length? a 1 fp 29 | print ["read: " a] 30 | fclose fp 31 | 32 | ;struct tm { 33 | ; int tm_sec; /* Seconds (0-60) */ 34 | ; int tm_min; /* Minutes (0-59) */ 35 | ; int tm_hour; /* Hours (0-23) */ 36 | ; int tm_mday; /* Day of the month (1-31) */ 37 | ; int tm_mon; /* Month (0-11) */ 38 | ; int tm_year; /* Year - 1900 */ 39 | ; int tm_wday; /* Day of the week (0-6, Sunday = 0) */ 40 | ; int tm_yday; /* Day in the year (0-365, 1 Jan = 0) */ 41 | ; int tm_isdst; /* Daylight saving time */ 42 | ; }; 43 | 44 | tm: make struct! [ 45 | tm_sec [int32] 46 | tm_min [int32] 47 | tm_hour [int32] ; /* Hours (0-23) */ 48 | tm_mday [int32] ; /* Day of the month (1-31) */ 49 | tm_mon [int32] ; /* Month (0-11) */ 50 | tm_year [int32] ; /* Year - 1900 */ 51 | tm_wday [int32] ; /* Day of the week (0-6, Sunday = 0) */ 52 | tm_yday [int32] ; /* Day in the year (0-365, 1 Jan = 0) */ 53 | tm_isdst [int32]; /* Daylight saving time */ 54 | ] 55 | time_t: make struct! [ 56 | t [int64] 57 | ] 58 | 59 | time: make routine! compose [[t [pointer] return: [int64]] (libc) "time"] 60 | print ["time:" time (reflect time_t 'addr)] 61 | localtime_r: make routine! compose [[t [pointer] tm [pointer] return: [int64]] (libc) "localtime_r"] 62 | 63 | print ["localtime:" localtime_r (reflect time_t 'addr) (reflect tm 'addr)] 64 | 65 | print ["tm:" mold tm] 66 | -------------------------------------------------------------------------------- /make/tests/test-struct.r: -------------------------------------------------------------------------------- 1 | REBOL[] 2 | recycle/torture 3 | a: make struct! [ 4 | bs [struct! [bi [int32]]] 5 | i [int32 [2]] 6 | j [int32] 7 | ] 8 | print ["a:" mold a] 9 | 10 | -------------------------------------------------------------------------------- /make/tests/varargs.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | recycle/torture 4 | 5 | libc: switch fourth system/version [ 6 | 3 [ 7 | make library! %msvcrt.dll 8 | ] 9 | 4 [ 10 | make library! %libc.so.6 11 | ] 12 | ] 13 | 14 | printf: make routine! [ 15 | [ 16 | "An example of wrapping variadic functions" 17 | fmt [pointer] "fixed" 18 | ... "variadic" 19 | return: [int32] 20 | ] 21 | libc "printf" 22 | ] 23 | 24 | sprintf: make routine! [ 25 | [ 26 | "An example of wrapping variadic functions" 27 | buf [pointer] "destination buffer, must be big enough" 28 | fmt [pointer] "fixed" 29 | ... "variadic" 30 | return: [int32] 31 | ] 32 | libc "sprintf" 33 | ] 34 | 35 | i: 1000 36 | j: 0.0 37 | printf reduce [ 38 | join "i: %d, %f" newline 39 | i [int32] 40 | j [float] 41 | ] 42 | 43 | printf compose [ 44 | "hello %p%c" 45 | ;10.0 46 | "ffi" [pointer] 47 | ;"ffi" 48 | (to integer! newline) [int8] 49 | ] 50 | 51 | printf compose [ 52 | "hello %s%c" 53 | "world" [pointer] 54 | (to integer! newline) [int8] 55 | ] 56 | 57 | printf compose [ 58 | "hello %s%c" 59 | "ffi" [pointer] 60 | (to integer! newline) [int8] 61 | ] 62 | 63 | h: make struct! [ 64 | a [uint8 [128]] 65 | ] 66 | len: sprintf reduce [ 67 | addr-of h 68 | join "hello %s" newline 69 | "world" [pointer] 70 | ] 71 | prin ["h:" copy/part to string! values-of h len] 72 | -------------------------------------------------------------------------------- /make/vcbuild.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Allow to explicitly specify the desired Visual Studio version 4 | IF /I "%1" == "vc12" GOTO TRY_VS12 5 | IF /I "%1" == "vc10" GOTO TRY_VS10 6 | IF /I "%1" == "vc9" GOTO TRY_VS9 7 | 8 | REM vs9 is VS 2008 9 | :TRY_VS9 10 | CALL "%VS90COMNTOOLS%\vsvars32.bat" 2>NUL 11 | IF NOT ERRORLEVEL 1 GOTO BUILD 12 | 13 | REM vs10 is VS 2010 14 | :TRY_VS10 15 | CALL "%VS100COMNTOOLS%\vsvars32.bat" 2>NUL 16 | IF NOT ERRORLEVEL 1 GOTO BUILD 17 | 18 | REM vs12 is VS 2012 19 | :TRY_VS12 20 | CALL "%VS110COMNTOOLS%\vsvars32.bat" 2>NUL 21 | IF NOT ERRORLEVEL 1 GOTO BUILD 22 | 23 | ECHO Visual Studio 2012, 2010, or 2008 doesn't seem to be installed 24 | EXIT /B 1 25 | 26 | :BUILD 27 | nmake -f makefile.vc all 28 | 29 | -------------------------------------------------------------------------------- /make/xcode/r3/r3.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /make/xcode/r3/r3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /make/xcode/r3/r3.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /release/android/clouds.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/android/clouds.jpg -------------------------------------------------------------------------------- /release/android/demo-script.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/android/demo-script.apk -------------------------------------------------------------------------------- /release/android/demo-script.r3: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | #do [include-ctx/push [%../../../r3-gui/release/]] 4 | 5 | #include-check %r3-gui.r3 6 | 7 | #do [include-ctx/pop] 8 | 9 | dpi: gui-metric 'screen-dpi 10 | gui-metric/set 'unit-size dpi / 96 11 | scr: round/floor (gui-metric 'work-size) - gui-metric 'title-size 12 | 13 | img: decode 'jpeg #include-binary %clouds.jpg 14 | ;print "" 15 | 16 | view/options [ 17 | vgroup [ 18 | vpanel sky [ 19 | image img 20 | vtight [ 21 | title "Hello world!" 22 | text "This REBOL script has been encapped for Android. " 23 | button "Close" on-action [quit] 24 | ] options [box-model: 'frame show-mode: 'fixed gob-offset: 10x10 max-hint: [150 auto]] 25 | ] options [ 26 | max-hint: [800 auto] 27 | border-size: [1x1 1x1] 28 | border-color: black 29 | ] 30 | ] options [ 31 | max-hint: 'keep 32 | pane-align: 'center 33 | ] 34 | when [rotate] on-action [ 35 | win: arg/gob/data 36 | bg: first faces? win 37 | win/facets/max-hint: 38 | bg/facets/max-hint: 39 | as-pair arg/offset/x max arg/offset/y win/facets/intern/min-heights/1 40 | update-face/no-show/content bg 41 | ] 42 | ][ 43 | offset: 0x0 44 | max-hint: scr 45 | ] 46 | -------------------------------------------------------------------------------- /release/android/r3-droid.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/android/r3-droid.apk -------------------------------------------------------------------------------- /release/linux/libfreetype.so.6.10.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/libfreetype.so.6.10.1 -------------------------------------------------------------------------------- /release/linux/libr3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/libr3.so -------------------------------------------------------------------------------- /release/linux/r3-core-host-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/r3-core-host-linux -------------------------------------------------------------------------------- /release/linux/r3-core-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/r3-core-linux -------------------------------------------------------------------------------- /release/linux/r3-view-host-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/r3-view-host-linux -------------------------------------------------------------------------------- /release/linux/r3-view-linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/linux/r3-view-linux -------------------------------------------------------------------------------- /release/osx/libfreetype.6.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/libfreetype.6.dylib -------------------------------------------------------------------------------- /release/osx/libr3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/libr3.dylib -------------------------------------------------------------------------------- /release/osx/r3-core-host-osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/r3-core-host-osx -------------------------------------------------------------------------------- /release/osx/r3-core-osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/r3-core-osx -------------------------------------------------------------------------------- /release/osx/r3-view-host-osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/r3-view-host-osx -------------------------------------------------------------------------------- /release/osx/r3-view-osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osx/r3-view-osx -------------------------------------------------------------------------------- /release/osxi/libfreetype.6.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/libfreetype.6.dylib -------------------------------------------------------------------------------- /release/osxi/libr3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/libr3.dylib -------------------------------------------------------------------------------- /release/osxi/r3-core-host-osxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/r3-core-host-osxi -------------------------------------------------------------------------------- /release/osxi/r3-core-osxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/r3-core-osxi -------------------------------------------------------------------------------- /release/osxi/r3-view-host-osxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/r3-view-host-osxi -------------------------------------------------------------------------------- /release/osxi/r3-view-osxi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/osxi/r3-view-osxi -------------------------------------------------------------------------------- /release/win32-x64/r3-core-host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32-x64/r3-core-host.exe -------------------------------------------------------------------------------- /release/win32-x64/r3-core.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32-x64/r3-core.exe -------------------------------------------------------------------------------- /release/win32-x64/r3-view-host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32-x64/r3-view-host.exe -------------------------------------------------------------------------------- /release/win32-x64/r3-view.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32-x64/r3-view.exe -------------------------------------------------------------------------------- /release/win32-x64/r3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32-x64/r3.dll -------------------------------------------------------------------------------- /release/win32/r3-core-host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32/r3-core-host.exe -------------------------------------------------------------------------------- /release/win32/r3-core.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32/r3-core.exe -------------------------------------------------------------------------------- /release/win32/r3-view-host.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32/r3-view-host.exe -------------------------------------------------------------------------------- /release/win32/r3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/release/win32/r3.dll -------------------------------------------------------------------------------- /src/agg/agg_arc.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // Arc vertex generator 17 | // 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef AGG_ARC_INCLUDED 21 | #define AGG_ARC_INCLUDED 22 | 23 | #include 24 | #include "agg_basics.h" 25 | 26 | namespace agg 27 | { 28 | 29 | //=====================================================================arc 30 | // 31 | // See Implementation agg_arc.cpp 32 | // 33 | class arc 34 | { 35 | public: 36 | arc() : m_scale(1.0), m_initialized(false) {} 37 | arc(double x, double y, 38 | double rx, double ry, 39 | double a1, double a2, 40 | bool ccw=true); 41 | 42 | void init(double x, double y, 43 | double rx, double ry, 44 | double a1, double a2, 45 | bool ccw=true); 46 | 47 | void approximation_scale(double s); 48 | double approximation_scale() const { return m_scale; } 49 | 50 | void rewind(unsigned); 51 | unsigned vertex(double* x, double* y); 52 | 53 | private: 54 | void normalize(double a1, double a2, bool ccw); 55 | 56 | double m_x; 57 | double m_y; 58 | double m_rx; 59 | double m_ry; 60 | double m_angle; 61 | double m_start; 62 | double m_end; 63 | double m_scale; 64 | double m_da; 65 | bool m_ccw; 66 | bool m_initialized; 67 | unsigned m_path_cmd; 68 | }; 69 | 70 | 71 | } 72 | 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /src/agg/agg_arrowhead.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // Simple arrowhead/arrowtail generator 17 | // 18 | //---------------------------------------------------------------------------- 19 | #ifndef AGG_ARROWHEAD_INCLUDED 20 | #define AGG_ARROWHEAD_INCLUDED 21 | 22 | #include "agg_basics.h" 23 | 24 | namespace agg 25 | { 26 | 27 | //===============================================================arrowhead 28 | // 29 | // See implementation agg_arrowhead.cpp 30 | // 31 | class arrowhead 32 | { 33 | public: 34 | arrowhead(); 35 | 36 | void head(double d1, double d2, double d3, double d4) 37 | { 38 | m_head_d1 = d1; 39 | m_head_d2 = d2; 40 | m_head_d3 = d3; 41 | m_head_d4 = d4; 42 | m_head_flag = true; 43 | } 44 | 45 | void head() { m_head_flag = true; } 46 | void no_head() { m_head_flag = false; } 47 | void tail_head() { m_tail_head_flag = true; } 48 | void no_tail_head() { m_tail_head_flag = false; } 49 | void head_tail() { m_head_tail_flag = true; } 50 | void no_head_tail() { m_head_tail_flag = false; } 51 | 52 | void tail(double d1, double d2, double d3, double d4) 53 | { 54 | m_tail_d1 = d1; 55 | m_tail_d2 = d2; 56 | m_tail_d3 = d3; 57 | m_tail_d4 = d4; 58 | m_tail_flag = true; 59 | } 60 | 61 | void tail() { m_tail_flag = true; } 62 | void no_tail() { m_tail_flag = false; } 63 | 64 | void rewind(unsigned path_id); 65 | unsigned vertex(double* x, double* y); 66 | 67 | private: 68 | double m_head_d1; 69 | double m_head_d2; 70 | double m_head_d3; 71 | double m_head_d4; 72 | double m_tail_d1; 73 | double m_tail_d2; 74 | double m_tail_d3; 75 | double m_tail_d4; 76 | bool m_head_flag; 77 | bool m_head_tail_flag; 78 | bool m_tail_flag; 79 | bool m_tail_head_flag; 80 | double m_coord[16]; 81 | unsigned m_cmd[8]; 82 | unsigned m_curr_id; 83 | unsigned m_curr_coord; 84 | }; 85 | 86 | } 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/agg/agg_bitset_iterator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_BITSET_ITERATOR_INCLUDED 17 | #define AGG_BITSET_ITERATOR_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | 21 | namespace agg 22 | { 23 | 24 | class bitset_iterator 25 | { 26 | public: 27 | bitset_iterator(const int8u* bits, unsigned offset = 0) : 28 | m_bits(bits + (offset >> 3)), 29 | m_mask(0x80 >> (offset & 7)) 30 | {} 31 | 32 | void operator ++ () 33 | { 34 | m_mask >>= 1; 35 | if(m_mask == 0) 36 | { 37 | ++m_bits; 38 | m_mask = 0x80; 39 | } 40 | } 41 | 42 | unsigned bit() const 43 | { 44 | return (*m_bits) & m_mask; 45 | } 46 | 47 | private: 48 | const int8u* m_bits; 49 | int8u m_mask; 50 | }; 51 | 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/agg/agg_bspline.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // class bspline 17 | // 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef AGG_BSPLINE_INCLUDED 21 | #define AGG_BSPLINE_INCLUDED 22 | 23 | #include "agg_basics.h" 24 | 25 | namespace agg 26 | { 27 | //----------------------------------------------------------------bspline 28 | // A very simple class of Bi-cubic Spline interpolation. 29 | // First call init(num, x[], y[]) where num - number of source points, 30 | // x, y - arrays of X and Y values respectively. Here Y must be a function 31 | // of X. It means that all the X-coordinates must be arranged in the ascending 32 | // order. 33 | // Then call get(x) that calculates a value Y for the respective X. 34 | // The class supports extrapolation, i.e. you can call get(x) where x is 35 | // outside the given with init() X-range. Extrapolation is a simple linear 36 | // function. 37 | // 38 | // See Implementation agg_bspline.cpp 39 | //------------------------------------------------------------------------ 40 | class bspline 41 | { 42 | public: 43 | ~bspline(); 44 | bspline(); 45 | bspline(int num); 46 | bspline(int num, const double* x, const double* y); 47 | 48 | void init(int num); 49 | void add_point(double x, double y); 50 | void prepare(); 51 | 52 | void init(int num, const double* x, const double* y); 53 | 54 | double get(double x) const; 55 | double get_stateful(double x) const; 56 | 57 | private: 58 | bspline(const bspline&); 59 | const bspline& operator = (const bspline&); 60 | 61 | static void bsearch(int n, const double *x, double x0, int *i); 62 | double extrapolation_left(double x) const; 63 | double extrapolation_right(double x) const; 64 | double interpolation(double x, int i) const; 65 | 66 | int m_max; 67 | int m_num; 68 | double* m_x; 69 | double* m_y; 70 | double* m_am; 71 | mutable int m_last_idx; 72 | }; 73 | 74 | 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/agg/agg_config.h: -------------------------------------------------------------------------------- 1 | #ifndef AGG_CONFIG_INCLUDED 2 | #define AGG_CONFIG_INCLUDED 3 | 4 | #pragma warning(disable : 4615) 5 | 6 | #define AGG_WIN9X_COMPLIANT // Unicode not supported at this time. 7 | 8 | // This file can be used to redefine the default basic types such as: 9 | // 10 | // AGG_INT8 11 | // AGG_INT8U 12 | // AGG_INT16 13 | // AGG_INT16U 14 | // AGG_INT32 15 | // AGG_INT32U 16 | // AGG_INT64 17 | // AGG_INT64U 18 | // 19 | // Just replace this file with new defines if necessary. 20 | // For example, if your compiler doesn't have a 64 bit integer type 21 | // you can still use AGG if you define the follows: 22 | // 23 | // #define AGG_INT64 int 24 | // #define AGG_INT64U unsigned 25 | // 26 | // It will result in overflow in 16 bit-per-component image/pattern resampling 27 | // but it won't result any crash and the rest of the library will remain 28 | // fully functional. 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/agg/agg_conv_bspline.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | #ifndef AGG_CONV_BSPLINE_INCLUDED 16 | #define AGG_CONV_BSPLINE_INCLUDED 17 | 18 | #include "agg_basics.h" 19 | #include "agg_vcgen_bspline.h" 20 | #include "agg_conv_adaptor_vcgen.h" 21 | 22 | 23 | namespace agg 24 | { 25 | 26 | //---------------------------------------------------------conv_bspline 27 | template 28 | struct conv_bspline : public conv_adaptor_vcgen 29 | { 30 | typedef conv_adaptor_vcgen base_type; 31 | 32 | conv_bspline(VertexSource& vs) : 33 | conv_adaptor_vcgen(vs) {} 34 | 35 | void interpolation_step(double v) { base_type::generator().interpolation_step(v); } 36 | double interpolation_step() const { return base_type::generator().interpolation_step(); } 37 | 38 | private: 39 | conv_bspline(const conv_bspline&); 40 | const conv_bspline& 41 | operator = (const conv_bspline&); 42 | }; 43 | 44 | } 45 | 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/agg/agg_conv_dash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // conv_dash 17 | // 18 | //---------------------------------------------------------------------------- 19 | #ifndef AGG_CONV_DASH_INCLUDED 20 | #define AGG_CONV_DASH_INCLUDED 21 | 22 | #include "agg_basics.h" 23 | #include "agg_vcgen_dash.h" 24 | #include "agg_conv_adaptor_vcgen.h" 25 | 26 | namespace agg 27 | { 28 | 29 | //---------------------------------------------------------------conv_dash 30 | template 31 | struct conv_dash : public conv_adaptor_vcgen 32 | { 33 | typedef Markers marker_type; 34 | typedef conv_adaptor_vcgen base_type; 35 | 36 | conv_dash(VertexSource& vs) : 37 | conv_adaptor_vcgen(vs) 38 | { 39 | } 40 | 41 | void remove_all_dashes() 42 | { 43 | base_type::generator().remove_all_dashes(); 44 | } 45 | 46 | void add_dash(double dash_len, double gap_len) 47 | { 48 | base_type::generator().add_dash(dash_len, gap_len); 49 | } 50 | 51 | void dash_start(double ds) 52 | { 53 | base_type::generator().dash_start(ds); 54 | } 55 | 56 | void shorten(double s) { base_type::generator().shorten(s); } 57 | double shorten() const { return base_type::generator().shorten(); } 58 | 59 | private: 60 | conv_dash(const conv_dash&); 61 | const conv_dash& 62 | operator = (const conv_dash&); 63 | }; 64 | 65 | 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/agg/agg_conv_segmentator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_CONV_SEGMENTATOR_INCLUDED 17 | #define AGG_CONV_SEGMENTATOR_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_conv_adaptor_vpgen.h" 21 | #include "agg_vpgen_segmentator.h" 22 | 23 | namespace agg 24 | { 25 | 26 | //========================================================conv_segmentator 27 | template 28 | struct conv_segmentator : public conv_adaptor_vpgen 29 | { 30 | typedef conv_adaptor_vpgen base_type; 31 | 32 | conv_segmentator(VertexSource& vs) : 33 | conv_adaptor_vpgen(vs) {} 34 | 35 | void approximation_scale(double s) { base_type::vpgen().approximation_scale(s); } 36 | double approximation_scale() const { return base_type::vpgen().approximation_scale(); } 37 | 38 | private: 39 | conv_segmentator(const conv_segmentator&); 40 | const conv_segmentator& 41 | operator = (const conv_segmentator&); 42 | }; 43 | 44 | 45 | } 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/agg/agg_conv_transform.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // class conv_transform 17 | // 18 | //---------------------------------------------------------------------------- 19 | #ifndef AGG_CONV_TRANSFORM_INCLUDED 20 | #define AGG_CONV_TRANSFORM_INCLUDED 21 | 22 | #include "agg_basics.h" 23 | #include "agg_trans_affine.h" 24 | 25 | namespace agg 26 | { 27 | 28 | //----------------------------------------------------------conv_transform 29 | template class conv_transform 30 | { 31 | public: 32 | conv_transform(VertexSource& source, const Transformer& tr) : 33 | m_source(&source), m_trans(&tr) {} 34 | 35 | void set_source(VertexSource& source) { m_source = &source; } 36 | 37 | void rewind(unsigned path_id) 38 | { 39 | m_source->rewind(path_id); 40 | } 41 | 42 | unsigned vertex(double* x, double* y) 43 | { 44 | unsigned cmd = m_source->vertex(x, y); 45 | if(is_vertex(cmd)) 46 | { 47 | m_trans->transform(x, y); 48 | } 49 | return cmd; 50 | } 51 | 52 | void transformer(const Transformer& tr) 53 | { 54 | m_trans = &tr; 55 | } 56 | 57 | private: 58 | conv_transform(const conv_transform&); 59 | const conv_transform& 60 | operator = (const conv_transform&); 61 | 62 | VertexSource* m_source; 63 | const Transformer* m_trans; 64 | }; 65 | 66 | 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/agg/agg_render_scanlines.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_RENDER_SCANLINES_INCLUDED 17 | #define AGG_RENDER_SCANLINES_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | 21 | namespace agg 22 | { 23 | //========================================================render_scanlines 24 | template 25 | void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren) 26 | { 27 | if(ras.rewind_scanlines()) 28 | { 29 | sl.reset(ras.min_x(), ras.max_x()); 30 | ren.prepare(unsigned(ras.max_x() - ras.min_x() + 2), unsigned(ras.max_y() - ras.min_y())); 31 | 32 | while(ras.sweep_scanline(sl)) 33 | { 34 | ren.render(sl); 35 | } 36 | #ifdef AGG_OPENGL 37 | ren.finish(); 38 | #endif 39 | } 40 | } 41 | 42 | 43 | //========================================================render_all_paths 44 | template 46 | void render_all_paths(Rasterizer& ras, 47 | Scanline& sl, 48 | Renderer& r, 49 | VertexSource& vs, 50 | const ColorStorage& as, 51 | const PathId& path_id, 52 | unsigned num_paths) 53 | { 54 | for(unsigned i = 0; i < num_paths; i++) 55 | { 56 | ras.reset(); 57 | ras.add_path(vs, path_id[i]); 58 | r.color(as[i]); 59 | render_scanlines(ras, sl, r); 60 | } 61 | } 62 | 63 | 64 | } 65 | 66 | #endif 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/agg/agg_rounded_rect.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // Rounded rectangle vertex generator 17 | // 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef AGG_ROUNDED_RECT_INCLUDED 21 | #define AGG_ROUNDED_RECT_INCLUDED 22 | 23 | #include "agg_basics.h" 24 | #include "agg_arc.h" 25 | 26 | namespace agg 27 | { 28 | //------------------------------------------------------------rounded_rect 29 | // 30 | // See Implemantation agg_rounded_rect.cpp 31 | // 32 | class rounded_rect 33 | { 34 | public: 35 | rounded_rect() {} 36 | rounded_rect(double x1, double y1, double x2, double y2, double r); 37 | 38 | void rect(double x1, double y1, double x2, double y2); 39 | void radius(double r); 40 | void radius(double rx, double ry); 41 | void radius(double rx_bottom, double ry_bottom, double rx_top, double ry_top); 42 | void radius(double rx1, double ry1, double rx2, double ry2, 43 | double rx3, double ry3, double rx4, double ry4); 44 | void normalize_radius(); 45 | 46 | void approximation_scale(double s) { m_arc.approximation_scale(s); } 47 | double approximation_scale() const { return m_arc.approximation_scale(); } 48 | 49 | void rewind(unsigned); 50 | unsigned vertex(double* x, double* y); 51 | 52 | private: 53 | double m_x1; 54 | double m_y1; 55 | double m_x2; 56 | double m_y2; 57 | double m_rx1; 58 | double m_ry1; 59 | double m_rx2; 60 | double m_ry2; 61 | double m_rx3; 62 | double m_ry3; 63 | double m_rx4; 64 | double m_ry4; 65 | unsigned m_status; 66 | arc m_arc; 67 | }; 68 | 69 | } 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /src/agg/agg_shorten_path.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_SHORTEN_PATH_INCLUDED 17 | #define AGG_SHORTEN_PATH_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_vertex_sequence.h" 21 | 22 | namespace agg 23 | { 24 | 25 | //===========================================================shorten_path 26 | template 27 | void shorten_path(VertexSequence& vs, double s, unsigned closed = 0) 28 | { 29 | typedef typename VertexSequence::value_type vertex_type; 30 | 31 | if(s > 0.0 && vs.size() > 1) 32 | { 33 | double d; 34 | int n = int(vs.size() - 2); 35 | while(n) 36 | { 37 | d = vs[n].dist; 38 | if(d > s) break; 39 | vs.remove_last(); 40 | s -= d; 41 | --n; 42 | } 43 | if(vs.size() < 2) 44 | { 45 | vs.remove_all(); 46 | } 47 | else 48 | { 49 | n = vs.size() - 1; 50 | vertex_type& prev = vs[n-1]; 51 | vertex_type& last = vs[n]; 52 | d = (prev.dist - s) / prev.dist; 53 | double x = prev.x + (last.x - prev.x) * d; 54 | double y = prev.y + (last.y - prev.y) * d; 55 | last.x = x; 56 | last.y = y; 57 | if(!prev(last)) vs.remove_last(); 58 | vs.close(closed != 0); 59 | } 60 | } 61 | } 62 | 63 | 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/agg/agg_span_allocator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_SPAN_ALLOCATOR_INCLUDED 17 | #define AGG_SPAN_ALLOCATOR_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | 21 | namespace agg 22 | { 23 | //----------------------------------------------------------span_allocator 24 | template class span_allocator 25 | { 26 | public: 27 | typedef ColorT color_type; 28 | 29 | //-------------------------------------------------------------------- 30 | ~span_allocator() 31 | { 32 | delete [] m_span; 33 | } 34 | 35 | //-------------------------------------------------------------------- 36 | span_allocator() : 37 | m_max_span_len(0), 38 | m_span(0) 39 | { 40 | } 41 | 42 | //-------------------------------------------------------------------- 43 | color_type* allocate(unsigned max_span_len) 44 | { 45 | if(max_span_len > m_max_span_len) 46 | { 47 | delete [] m_span; 48 | m_span = new color_type[m_max_span_len = max_span_len]; 49 | } 50 | return m_span; 51 | } 52 | 53 | //-------------------------------------------------------------------- 54 | color_type* span() 55 | { 56 | return m_span; 57 | } 58 | 59 | private: 60 | //-------------------------------------------------------------------- 61 | span_allocator(const span_allocator&); 62 | const span_allocator& operator = (const span_allocator&); 63 | 64 | unsigned m_max_span_len; 65 | color_type* m_span; 66 | }; 67 | } 68 | 69 | 70 | #endif 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/agg/agg_span_converter.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_SPAN_CONVERTER_INCLUDED 17 | #define AGG_SPAN_CONVERTER_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | 21 | namespace agg 22 | { 23 | //----------------------------------------------------------span_converter 24 | template class span_converter 25 | { 26 | public: 27 | typedef typename SpanGenerator::color_type color_type; 28 | 29 | span_converter(SpanGenerator& span_gen, Conv& conv) : 30 | m_span_gen(&span_gen), m_conv(&conv) {} 31 | 32 | //-------------------------------------------------------------------- 33 | void prepare(unsigned max_span_len, unsigned num_spans) 34 | { 35 | m_span_gen->prepare(max_span_len); 36 | } 37 | 38 | //-------------------------------------------------------------------- 39 | color_type* generate(int x, int y, unsigned len) 40 | { 41 | color_type* span = m_span_gen->generate(x, y, len); 42 | m_conv->convert(span, x, y, len); 43 | return span; 44 | } 45 | 46 | private: 47 | SpanGenerator* m_span_gen; 48 | Conv* m_conv; 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/agg/agg_span_generator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_SPAN_GENERATOR_INCLUDED 17 | #define AGG_SPAN_GENERATOR_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_span_allocator.h" 21 | 22 | namespace agg 23 | { 24 | 25 | //==========================================================span_generator 26 | template class span_generator 27 | { 28 | public: 29 | typedef ColorT color_type; 30 | typedef Allocator alloc_type; 31 | 32 | //-------------------------------------------------------------------- 33 | span_generator(alloc_type& alloc) : m_alloc(&alloc) {} 34 | 35 | //-------------------------------------------------------------------- 36 | void allocator(alloc_type& alloc) { m_alloc = &alloc; } 37 | alloc_type& allocator() { return *m_alloc; } 38 | 39 | //-------------------------------------------------------------------- 40 | void prepare(unsigned max_span_len, unsigned num_spans) 41 | { 42 | m_alloc->allocate(max_span_len); 43 | } 44 | 45 | private: 46 | alloc_type* m_alloc; 47 | }; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/agg/agg_span_solid.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | // 16 | // span_solid_rgba8 17 | // 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef AGG_SPAN_SOLID_INCLUDED 21 | #define AGG_SPAN_SOLID_INCLUDED 22 | 23 | #include "agg_basics.h" 24 | #include "agg_span_generator.h" 25 | 26 | namespace agg 27 | { 28 | //--------------------------------------------------------------span_solid 29 | template > 30 | class span_solid : public span_generator 31 | { 32 | public: 33 | typedef Allocator alloc_type; 34 | typedef ColorT color_type; 35 | typedef span_generator base_type; 36 | 37 | //-------------------------------------------------------------------- 38 | span_solid(alloc_type& alloc) : base_type(alloc) {} 39 | 40 | //-------------------------------------------------------------------- 41 | void color(const color_type& c) { m_color = c; } 42 | const color_type& color() const { return m_color; } 43 | 44 | //-------------------------------------------------------------------- 45 | color_type* generate(int x, int y, unsigned len) 46 | { 47 | color_type* span = base_type::allocator().span(); 48 | do 49 | { 50 | *span++ = m_color; 51 | } 52 | while(--len); 53 | return base_type::allocator().span(); 54 | } 55 | 56 | private: 57 | color_type m_color; 58 | }; 59 | 60 | 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/agg/agg_vcgen_bspline.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_VCGEN_BSPLINE_INCLUDED 17 | #define AGG_VCGEN_BSPLINE_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_array.h" 21 | #include "agg_bspline.h" 22 | 23 | 24 | namespace agg 25 | { 26 | 27 | //==========================================================vcgen_bspline 28 | class vcgen_bspline 29 | { 30 | enum status_e 31 | { 32 | initial, 33 | ready, 34 | polygon, 35 | end_poly, 36 | stop 37 | }; 38 | 39 | public: 40 | typedef pod_deque vertex_storage; 41 | 42 | vcgen_bspline(); 43 | 44 | void interpolation_step(double v) { m_interpolation_step = v; } 45 | double interpolation_step() const { return m_interpolation_step; } 46 | 47 | // Vertex Generator Interface 48 | void remove_all(); 49 | void add_vertex(double x, double y, unsigned cmd); 50 | 51 | // Vertex Source Interface 52 | void rewind(unsigned path_id); 53 | unsigned vertex(double* x, double* y); 54 | 55 | private: 56 | vcgen_bspline(const vcgen_bspline&); 57 | const vcgen_bspline& operator = (const vcgen_bspline&); 58 | 59 | vertex_storage m_src_vertices; 60 | bspline m_spline_x; 61 | bspline m_spline_y; 62 | double m_interpolation_step; 63 | unsigned m_closed; 64 | status_e m_status; 65 | unsigned m_src_vertex; 66 | double m_cur_abscissa; 67 | double m_max_abscissa; 68 | }; 69 | 70 | } 71 | 72 | 73 | #endif 74 | 75 | -------------------------------------------------------------------------------- /src/agg/agg_vcgen_markers_term.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_VCGEN_MARKERS_TERM_INCLUDED 17 | #define AGG_VCGEN_MARKERS_TERM_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_vertex_sequence.h" 21 | 22 | namespace agg 23 | { 24 | 25 | //======================================================vcgen_markers_term 26 | // 27 | // See Implemantation agg_vcgen_markers_term.cpp 28 | // Terminal markers generator (arrowhead/arrowtail) 29 | // 30 | //------------------------------------------------------------------------ 31 | class vcgen_markers_term 32 | { 33 | public: 34 | vcgen_markers_term() : m_curr_id(0), m_curr_idx(0) {} 35 | 36 | // Vertex Generator Interface 37 | void remove_all(); 38 | void add_vertex(double x, double y, unsigned cmd); 39 | 40 | // Vertex Source Interface 41 | void rewind(unsigned path_id); 42 | unsigned vertex(double* x, double* y); 43 | 44 | private: 45 | vcgen_markers_term(const vcgen_markers_term&); 46 | const vcgen_markers_term& operator = (const vcgen_markers_term&); 47 | 48 | struct coord_type 49 | { 50 | double x, y; 51 | 52 | coord_type() {} 53 | coord_type(double x_, double y_) : x(x_), y(y_) {} 54 | }; 55 | 56 | typedef pod_deque coord_storage; 57 | 58 | coord_storage m_markers; 59 | unsigned m_curr_id; 60 | unsigned m_curr_idx; 61 | }; 62 | 63 | 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/agg/agg_vcgen_smooth_poly1.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_VCGEN_SMOOTH_POLY1_INCLUDED 17 | #define AGG_VCGEN_SMOOTH_POLY1_INCLUDED 18 | 19 | #include "agg_basics.h" 20 | #include "agg_vertex_sequence.h" 21 | 22 | 23 | namespace agg 24 | { 25 | 26 | //======================================================vcgen_smooth_poly1 27 | // 28 | // See Implementation agg_vcgen_smooth_poly1.cpp 29 | // Smooth polygon generator 30 | // 31 | //------------------------------------------------------------------------ 32 | class vcgen_smooth_poly1 33 | { 34 | enum status_e 35 | { 36 | initial, 37 | ready, 38 | polygon, 39 | ctrl_b, 40 | ctrl_e, 41 | ctrl1, 42 | ctrl2, 43 | end_poly, 44 | stop 45 | }; 46 | 47 | public: 48 | typedef vertex_sequence vertex_storage; 49 | 50 | vcgen_smooth_poly1(); 51 | 52 | void smooth_value(double v) { m_smooth_value = v * 0.5; } 53 | double smooth_value() const { return m_smooth_value * 2.0; } 54 | 55 | // Vertex Generator Interface 56 | void remove_all(); 57 | void add_vertex(double x, double y, unsigned cmd); 58 | 59 | // Vertex Source Interface 60 | void rewind(unsigned path_id); 61 | unsigned vertex(double* x, double* y); 62 | 63 | private: 64 | vcgen_smooth_poly1(const vcgen_smooth_poly1&); 65 | const vcgen_smooth_poly1& operator = (const vcgen_smooth_poly1&); 66 | 67 | void calculate(const vertex_dist& v0, 68 | const vertex_dist& v1, 69 | const vertex_dist& v2, 70 | const vertex_dist& v3); 71 | 72 | vertex_storage m_src_vertices; 73 | double m_smooth_value; 74 | unsigned m_closed; 75 | status_e m_status; 76 | unsigned m_src_vertex; 77 | double m_ctrl1_x; 78 | double m_ctrl1_y; 79 | double m_ctrl2_x; 80 | double m_ctrl2_y; 81 | }; 82 | 83 | } 84 | 85 | 86 | #endif 87 | 88 | -------------------------------------------------------------------------------- /src/agg/agg_vpgen_segmentator.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #include 17 | #include "agg_vpgen_segmentator.h" 18 | 19 | namespace agg 20 | { 21 | 22 | void vpgen_segmentator::move_to(double x, double y) 23 | { 24 | m_x1 = x; 25 | m_y1 = y; 26 | m_dx = 0.0; 27 | m_dy = 0.0; 28 | m_dl = 2.0; 29 | m_ddl = 2.0; 30 | m_cmd = path_cmd_move_to; 31 | } 32 | 33 | void vpgen_segmentator::line_to(double x, double y) 34 | { 35 | m_x1 += m_dx; 36 | m_y1 += m_dy; 37 | m_dx = x - m_x1; 38 | m_dy = y - m_y1; 39 | double len = sqrt(m_dx * m_dx + m_dy * m_dy) * m_approximation_scale; 40 | if(len < 1e-30) len = 1e-30; 41 | m_ddl = 1.0 / len; 42 | m_dl = (m_cmd == path_cmd_move_to) ? 0.0 : m_ddl; 43 | if(m_cmd == path_cmd_stop) m_cmd = path_cmd_line_to; 44 | } 45 | 46 | unsigned vpgen_segmentator::vertex(double* x, double* y) 47 | { 48 | if(m_cmd == path_cmd_stop) return path_cmd_stop; 49 | 50 | unsigned cmd = m_cmd; 51 | m_cmd = path_cmd_line_to; 52 | if(m_dl >= 1.0 - m_ddl) 53 | { 54 | m_dl = 1.0; 55 | m_cmd = path_cmd_stop; 56 | *x = m_x1 + m_dx; 57 | *y = m_y1 + m_dy; 58 | return cmd; 59 | } 60 | *x = m_x1 + m_dx * m_dl; 61 | *y = m_y1 + m_dy * m_dl; 62 | m_dl += m_ddl; 63 | return cmd; 64 | } 65 | 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/agg/agg_vpgen_segmentator.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Anti-Grain Geometry - Version 2.3 3 | // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 | // 5 | // Permission to copy, use, modify, sell and distribute this software 6 | // is granted provided this copyright notice appears in all copies. 7 | // This software is provided "as is" without express or implied 8 | // warranty, and with no claim as to its suitability for any purpose. 9 | // 10 | //---------------------------------------------------------------------------- 11 | // Contact: mcseem@antigrain.com 12 | // mcseemagg@yahoo.com 13 | // http://www.antigrain.com 14 | //---------------------------------------------------------------------------- 15 | 16 | #ifndef AGG_VPGEN_SEGMENTATOR_INCLUDED 17 | #define AGG_VPGEN_SEGMENTATOR_INCLUDED 18 | 19 | #include 20 | #include "agg_basics.h" 21 | 22 | namespace agg 23 | { 24 | 25 | //=======================================================vpgen_segmentator 26 | // 27 | // See Implementation agg_vpgen_segmentator.cpp 28 | // 29 | class vpgen_segmentator 30 | { 31 | public: 32 | vpgen_segmentator() : m_approximation_scale(1.0) {} 33 | 34 | void approximation_scale(double s) { m_approximation_scale = s; } 35 | double approximation_scale() const { return m_approximation_scale; } 36 | 37 | static bool auto_close() { return false; } 38 | static bool auto_unclose() { return false; } 39 | 40 | void reset() { m_cmd = path_cmd_stop; } 41 | void move_to(double x, double y); 42 | void line_to(double x, double y); 43 | unsigned vertex(double* x, double* y); 44 | 45 | private: 46 | double m_approximation_scale; 47 | double m_x1; 48 | double m_y1; 49 | double m_dx; 50 | double m_dy; 51 | double m_dl; 52 | double m_ddl; 53 | unsigned m_cmd; 54 | }; 55 | 56 | 57 | 58 | } 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /src/boot/booters.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Special boot native function specs" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | These are used to define natives and actions. 14 | Bind attributes for this block are: BIND_SET and SHALLOW 15 | } 16 | ] 17 | 18 | ; Special block used as spec to the datatype test functions (e.g. time?): 19 | ["Returns TRUE if it is this type." value [any-type!] 0] 20 | 21 | ; The native function must be defined first. This is a 22 | ; special boot function created manually within the C code. 23 | native: native [ 24 | {Creates native function (for internal usage only).} 25 | spec ; [block!] -- no check required, we know it is correct 26 | ] 27 | 28 | action: native [ 29 | {Creates datatype action (for internal usage only).} 30 | spec ; [block!] -- no check required, we know it is correct 31 | ] 32 | -------------------------------------------------------------------------------- /src/boot/modes.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Port modes" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | owner-read 15 | owner-write 16 | owner-execute 17 | group-read 18 | group-write 19 | group-execute 20 | world-read 21 | world-write 22 | world-execute 23 | -------------------------------------------------------------------------------- /src/boot/ops.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Infix operator symbol definitions" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | This table maps infix operator symbols to function names. 14 | } 15 | ] 16 | 17 | + add 18 | - subtract 19 | * multiply 20 | / divide 21 | // remainder 22 | ** power 23 | = equal? 24 | =? same? 25 | == strict-equal? 26 | != not-equal? 27 | <> not-equal? 28 | !== strict-not-equal? 29 | < lesser? 30 | <= lesser-or-equal? 31 | > greater? 32 | >= greater-or-equal? 33 | & and~ 34 | | or~ 35 | and and~ 36 | or or~ 37 | xor xor~ 38 | -------------------------------------------------------------------------------- /src/boot/platforms.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Platform definitions" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | Platform identification found in system object. 14 | } 15 | ] 16 | 17 | 1 Amiga [ 18 | 1 m68k20+ 19 | 2 m68k 20 | 3 ppc 21 | ] 22 | 23 | 2 Macintosh [ 24 | 1 mac-ppc 25 | 2 mac-m68k 26 | 3 mac-misc 27 | 4 osx-ppc 28 | 5 osx-x86 29 | 40 osx-x64 30 | ] 31 | 32 | 3 Windows [ 33 | 1 win32-x86 34 | 2 dec-alpha 35 | 40 win32-x64 36 | ] 37 | 38 | 4 Linux [ 39 | 1 libc5-x86 40 | 2 libc6-2-3-x86 41 | 3 libc6-2-5-x86 42 | 4 libc6-2-11-x86 43 | 10 libc6-ppc 44 | 20 libc6-arm 45 | 30 libc6-mips 46 | 40 libc-x64 47 | ] 48 | 49 | 5 Haiku [ 50 | 75 x86-32 51 | ] 52 | 53 | 6 BSDi [ 54 | 1 x86 55 | ] 56 | 57 | 7 FreeBSD [ 58 | 1 x86 59 | 2 elf-x86 60 | ] 61 | 62 | 8 NetBSD [ 63 | 1 x86 64 | 2 ppc 65 | 3 m68k 66 | 4 dec-alpha 67 | 5 sparc 68 | ] 69 | 70 | 9 OpenBSD [ 71 | 1 x86 72 | 2 ppc 73 | 3 m68k 74 | 4 elf-x86 75 | 5 sparc 76 | ] 77 | 78 | 10 Sun [ 79 | 1 sparc 80 | ] 81 | 82 | 11 SGI [] 83 | 84 | 12 HP [] 85 | 86 | 13 Android [ 87 | 1 arm 88 | ] 89 | 90 | 14 free-slot [] 91 | 92 | 15 WindowsCE [ 93 | 1 sh3 94 | 2 mips 95 | 5 arm 96 | 6 sh4 97 | ] 98 | -------------------------------------------------------------------------------- /src/boot/root.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Root context" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | Root system values. This context is hand-made very early at boot time 14 | to allow it to hold key system values during boot up. Most of these 15 | are put here to prevent them from being garbage collected. 16 | } 17 | Note: "See Task Context for per-task globals" 18 | ] 19 | 20 | self ; (hand-built CONTEXT! value - but, has no WORD table!) 21 | root ; the root context as a block (for GC protection) 22 | 23 | system ; system object 24 | errobj ; error object template 25 | strings ; low-level strings accessed via Boot_Strs[] (GC protection) 26 | typesets ; block of TYPESETs used by system; expandable 27 | noneval ; NONE value 28 | noname ; noname function word 29 | 30 | boot ; boot block defined in boot.r (GC'd after boot is done) 31 | 32 | -------------------------------------------------------------------------------- /src/boot/task.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Task context" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0. 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | Globals used for each task. Prevents GC of these values. 14 | See also the Root Context (program-wide globals) 15 | } 16 | ] 17 | 18 | self 19 | stack ; data stack 20 | ballast ; current memory ballast (used for GC) 21 | max-ballast ; ballast reset value 22 | this-error ; current error 23 | this-value ; for holding an error argument during throw back 24 | stack-error ; special stack error object 25 | this-context ; current context 26 | buf-emit ; temporary emit output block 27 | buf-words ; temporary word cache 28 | buf-utf8 ; UTF8 reused buffer 29 | buf-print ; temporary print output - used by raw print 30 | buf-form ; temporary form buffer - used by raw print 31 | buf-mold ; temporary mold buffer - used by mold 32 | mold-loop ; mold loop detection 33 | err-temps ; error temporaries 34 | 35 | -------------------------------------------------------------------------------- /src/boot/types-ext.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Extension datatypes" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Purpose: { 13 | Used to build C enums and definitions for extensions. 14 | } 15 | ] 16 | 17 | end 0 0 18 | unset * null 19 | none * null 20 | handle * ptr 21 | 22 | logic 4 32 23 | integer * 64 24 | decimal * 64 25 | percent * 64 26 | 27 | char 10 32 28 | pair * 64 29 | tuple * 64 30 | time * 64 31 | date * date 32 | 33 | word 16 sym 34 | set-word * sym 35 | get-word * sym 36 | lit-word * sym 37 | refinement * sym 38 | issue * sym 39 | 40 | string 24 ser 41 | file * ser 42 | email * ser 43 | url * ser 44 | tag * ser 45 | 46 | block 32 ser 47 | paren * ser 48 | path * ser 49 | set-path * ser 50 | get-path * ser 51 | lit-path * ser 52 | 53 | binary 40 ser 54 | bitset * ser 55 | vector * ser 56 | image * image 57 | 58 | gob 47 ser 59 | 60 | object 48 ptr 61 | module * ptr 62 | 63 | -------------------------------------------------------------------------------- /src/boot/version.r: -------------------------------------------------------------------------------- 1 | 3.1.0.3.1 2 | -------------------------------------------------------------------------------- /src/codecs/aes/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, Cameron Rich 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * * Neither the name of the axTLS project nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include // uint{8,16,32}_t 32 | 33 | /************************************************************************** 34 | * AES declarations 35 | **************************************************************************/ 36 | 37 | #define AES_MAXROUNDS 14 38 | #define AES_BLOCKSIZE 16 39 | #define AES_IV_SIZE 16 40 | 41 | typedef enum 42 | { 43 | AES_MODE_128, 44 | AES_MODE_256, 45 | AES_MODE_ENCRYPT, 46 | AES_MODE_DECRYPT 47 | } AES_MODE; 48 | 49 | typedef struct aes_key_st 50 | { 51 | uint16_t rounds; 52 | uint16_t key_size; 53 | uint32_t ks[(AES_MAXROUNDS+1)*8]; 54 | uint8_t iv[AES_IV_SIZE]; 55 | AES_MODE key_mode; 56 | } AES_CTX; 57 | 58 | void AES_set_key(AES_CTX *ctx, const uint8_t *key, 59 | const uint8_t *iv, AES_MODE mode); 60 | void AES_cbc_encrypt(AES_CTX *ctx, const uint8_t *msg, 61 | uint8_t *out, int length); 62 | void AES_cbc_decrypt(AES_CTX *ks, const uint8_t *in, uint8_t *out, int length); 63 | void AES_convert_key(AES_CTX *ctx); 64 | -------------------------------------------------------------------------------- /src/codecs/dh/dh.c: -------------------------------------------------------------------------------- 1 | /* 2 | Simple implementation of Diffie-Hellman algorithm (c) 2013 Richard Smolak 3 | The code uses Bigint implementation Copyright (c) 2007, Cameron Rich 4 | */ 5 | 6 | #include "dh.h" 7 | 8 | void DH_generate_key(DH_CTX *dh_ctx) 9 | { 10 | BI_CTX *bi_ctx = bi_initialize(); 11 | int len = dh_ctx->len; 12 | bigint *p = bi_import(bi_ctx, dh_ctx->p, len); //p modulus 13 | bigint *g = bi_import(bi_ctx, dh_ctx->g, dh_ctx->glen); //generator 14 | bigint *x, *gx; 15 | 16 | bi_permanent(g); 17 | 18 | //generate private key X 19 | get_random_NZ(len, dh_ctx->x); 20 | x = bi_import(bi_ctx, dh_ctx->x, len); 21 | bi_permanent(x); 22 | 23 | //calculate public key gx = g^x mod p 24 | bi_set_mod(bi_ctx, p, BIGINT_M_OFFSET); 25 | bi_ctx->mod_offset = BIGINT_M_OFFSET; 26 | gx = bi_mod_power(bi_ctx, g, x); 27 | bi_permanent(gx); 28 | 29 | bi_export(bi_ctx, x, dh_ctx->x, len); 30 | bi_export(bi_ctx, gx, dh_ctx->gx, len); 31 | 32 | bi_depermanent(g); 33 | bi_depermanent(x); 34 | bi_depermanent(gx); 35 | bi_free(bi_ctx, g); 36 | bi_free(bi_ctx, x); 37 | bi_free(bi_ctx, gx); 38 | 39 | bi_free_mod(bi_ctx, BIGINT_M_OFFSET); 40 | bi_terminate(bi_ctx); 41 | } 42 | 43 | void DH_compute_key(DH_CTX *dh_ctx) 44 | { 45 | BI_CTX *bi_ctx = bi_initialize(); 46 | int len = dh_ctx->len; 47 | bigint *p = bi_import(bi_ctx, dh_ctx->p, len); //p modulus 48 | bigint *x = bi_import(bi_ctx, dh_ctx->x, len); //private key 49 | bigint *gy = bi_import(bi_ctx, dh_ctx->gy, len); //public key(peer) 50 | bigint *k; //negotiated(session) key 51 | 52 | bi_permanent(x); 53 | bi_permanent(gy); 54 | 55 | //calculate session key k = gy^x mod p 56 | bi_set_mod(bi_ctx, p, BIGINT_M_OFFSET); 57 | bi_ctx->mod_offset = BIGINT_M_OFFSET; 58 | k = bi_mod_power(bi_ctx, gy, x); 59 | bi_permanent(k); 60 | 61 | bi_export(bi_ctx, k, dh_ctx->k, len); 62 | 63 | bi_depermanent(x); 64 | bi_depermanent(gy); 65 | bi_depermanent(k); 66 | bi_free(bi_ctx, x); 67 | bi_free(bi_ctx, gy); 68 | bi_free(bi_ctx, k); 69 | 70 | bi_free_mod(bi_ctx, BIGINT_M_OFFSET); 71 | bi_terminate(bi_ctx); 72 | } 73 | -------------------------------------------------------------------------------- /src/codecs/dh/dh.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple implementation of Diffie-Hellman algorithm (c) 2013 Richard Smolak 3 | The code uses Bigint implementation Copyright (c) 2007, Cameron Rich 4 | */ 5 | 6 | #include 7 | #include "../bigint/bigint.h" 8 | 9 | typedef struct 10 | { 11 | int len; //length of keys in bytes 12 | int glen; //length of generator in bytes 13 | uint8_t *p; // prime modulus 14 | uint8_t *g; // generator 15 | uint8_t *x; // private key 16 | uint8_t *gx; // public key(self) 17 | uint8_t *gy; // public key(peer) 18 | uint8_t *k; // negotiated key 19 | } 20 | DH_CTX; 21 | 22 | 23 | void DH_generate_key( 24 | DH_CTX *dh_ctx 25 | ); 26 | 27 | void DH_compute_key( 28 | DH_CTX *dh_ctx 29 | ); 30 | 31 | -------------------------------------------------------------------------------- /src/codecs/rc4/rc4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, Cameron Rich 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * * Neither the name of the axTLS project nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include "rc4.h" 32 | 33 | /** 34 | * Get ready for an encrypt/decrypt operation 35 | */ 36 | void RC4_setup(RC4_CTX *ctx, const uint8_t *key, int length) 37 | { 38 | int i, j = 0, k = 0, a; 39 | uint8_t *m; 40 | 41 | ctx->x = 0; 42 | ctx->y = 0; 43 | m = ctx->m; 44 | 45 | for (i = 0; i < 256; i++) 46 | m[i] = i; 47 | 48 | for (i = 0; i < 256; i++) 49 | { 50 | a = m[i]; 51 | j = (uint8_t)(j + a + key[k]); 52 | m[i] = m[j]; 53 | m[j] = a; 54 | 55 | if (++k >= length) 56 | k = 0; 57 | } 58 | } 59 | 60 | /** 61 | * Perform the encrypt/decrypt operation (can use it for either since 62 | * this is a stream cipher). 63 | * NOTE: *msg and *out must be the same pointer (performance tweak) 64 | */ 65 | void RC4_crypt(RC4_CTX *ctx, const uint8_t *msg, uint8_t *out, int length) 66 | { 67 | int i; 68 | uint8_t *m, x, y, a, b; 69 | 70 | x = ctx->x; 71 | y = ctx->y; 72 | m = ctx->m; 73 | 74 | for (i = 0; i < length; i++) 75 | { 76 | a = m[++x]; 77 | y += a; 78 | m[x] = b = m[y]; 79 | m[y] = a; 80 | out[i] ^= m[(uint8_t)(a + b)]; 81 | } 82 | 83 | ctx->x = x; 84 | ctx->y = y; 85 | } 86 | -------------------------------------------------------------------------------- /src/codecs/rc4/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, Cameron Rich 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * * Neither the name of the axTLS project nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #include 32 | 33 | /************************************************************************** 34 | * RC4 declarations 35 | **************************************************************************/ 36 | 37 | typedef struct 38 | { 39 | uint8_t x, y, m[256]; 40 | } RC4_CTX; 41 | 42 | void RC4_setup(RC4_CTX *s, const uint8_t *key, int length); 43 | void RC4_crypt(RC4_CTX *s, const uint8_t *msg, uint8_t *data, int length); 44 | -------------------------------------------------------------------------------- /src/core/a-globals.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Module: a-globals.c 23 | ** Summary: global variables 24 | ** Section: environment 25 | ** Author: Carl Sassenrath 26 | ** Notes: 27 | ** There are two types of global variables: 28 | ** process vars - single instance for main process 29 | ** thread vars - duplicated within each R3 task 30 | ** 31 | ***********************************************************************/ 32 | 33 | /* To do: there are still a few globals in various modules that need to be 34 | ** incorporated back into sys-globals.h. 35 | */ 36 | 37 | #include "sys-core.h" 38 | 39 | #undef PVAR 40 | #undef TVAR 41 | 42 | #define PVAR 43 | #define TVAR THREAD 44 | 45 | #include "sys-globals.h" 46 | -------------------------------------------------------------------------------- /src/core/a-stubs.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Module: a-stubs.c 23 | ** Summary: function stubs 24 | ** Section: environment 25 | ** Author: Carl Sassenrath 26 | ** Notes: 27 | ** 28 | ***********************************************************************/ 29 | 30 | #include "sys-core.h" 31 | -------------------------------------------------------------------------------- /src/core/b-main.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Module: b-main.c 23 | ** Summary: skip 24 | ** Section: bootstrap 25 | ** Author: Carl Sassenrath 26 | ** Notes: 27 | ** 28 | ***********************************************************************/ 29 | #include "sys-core.h" 30 | 31 | static REBARGS Main_Args; // Not multi-threaded 32 | 33 | /*********************************************************************** 34 | ** 35 | */ char *Prompt_User() 36 | /* 37 | ***********************************************************************/ 38 | { 39 | char *text; 40 | 41 | Prin("DSP: %d Mem: %d >> ", DSP, PG_Mem_Usage); 42 | text = Input_Str(); 43 | if (*text == '\n') exit(0); 44 | return text; 45 | } 46 | 47 | 48 | /*********************************************************************** 49 | ** 50 | */ int main(int argc, char **argv) 51 | /* 52 | ***********************************************************************/ 53 | { 54 | char *cmd; 55 | 56 | // Parse command line arguments. Done early. May affect REBOL boot. 57 | Parse_Args(argc, argv, &Main_Args); 58 | 59 | Print_Str("REBOL 3.0\n"); 60 | 61 | REBOL_Init(&Main_Args); 62 | 63 | // Evaluate user input: 64 | while (TRUE) { 65 | cmd = Prompt_User(); 66 | REBOL_Do_String(cmd); 67 | if (!IS_UNSET(DS_TOP)) { 68 | //if (DSP > 0) { 69 | if (!IS_ERROR(DS_TOP)) { 70 | Prin("== "); 71 | Print_Value(DS_TOP, 0, TRUE); 72 | } else 73 | Print_Value(DS_TOP, 0, FALSE); 74 | //} 75 | } 76 | //DS_DROP; // result 77 | } 78 | 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /src/core/c-task.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Module: c-task.c 23 | ** Summary: sub-task support 24 | ** Section: core 25 | ** Author: Carl Sassenrath 26 | ** Notes: INCOMPLETE IMPLEMENTATION (partially operational) 27 | ** 28 | ***********************************************************************/ 29 | 30 | /* 31 | Making a Task: 32 | 33 | 1. Local copies of: 34 | Main globals 35 | For data stack 36 | Interpreter flags 37 | Memory management 38 | Root series (all or part?) 39 | Data stack 40 | System object (for module) 41 | C stack (thread provided) 42 | 43 | 2. Share copies of: 44 | Boot strings and values 45 | System functions (natives and mezzanine) 46 | Word table 47 | Various sub-objects of system object 48 | 49 | Task Spec is a module definition. Needs new context. 50 | 51 | Questions: 52 | System object is already copied for local user context 53 | System blocks might hold references to local series (how to GC) 54 | Can system values (objects and functions) be modified by other 55 | tasks? How are they protected? Is it good enough that our local 56 | references to functions refer to the older ones? How can we 57 | "update" our references? 58 | */ 59 | 60 | #include "sys-core.h" 61 | 62 | /*********************************************************************** 63 | ** 64 | */ static void Launch_Task(REBVAL *task) 65 | /* 66 | ***********************************************************************/ 67 | { 68 | REBSER *body; 69 | 70 | Debug_Str("Begin Task"); 71 | 72 | Init_Task(); 73 | body = Clone_Block(VAL_MOD_BODY(task)); 74 | OS_TASK_READY(0); 75 | Do_Blk(body, 0); 76 | 77 | Debug_Str("End Task"); 78 | } 79 | 80 | 81 | /*********************************************************************** 82 | ** 83 | */ void Do_Task(REBVAL *task) 84 | /* 85 | ***********************************************************************/ 86 | { 87 | OS_CREATE_THREAD((void*)Launch_Task, task, 50000); 88 | } 89 | -------------------------------------------------------------------------------- /src/core/t-none.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Module: t-none.c 23 | ** Summary: none datatype 24 | ** Section: datatypes 25 | ** Author: Carl Sassenrath 26 | ** Notes: 27 | ** 28 | ***********************************************************************/ 29 | 30 | #include "sys-core.h" 31 | 32 | /*********************************************************************** 33 | ** 34 | */ REBINT CT_None(REBVAL *a, REBVAL *b, REBINT mode) 35 | /* 36 | ***********************************************************************/ 37 | { 38 | if (mode >= 0) return (VAL_TYPE(a) == VAL_TYPE(b)); 39 | return -1; 40 | } 41 | 42 | 43 | /*********************************************************************** 44 | ** 45 | */ REBFLG MT_None(REBVAL *out, REBVAL *data, REBCNT type) 46 | /* 47 | ***********************************************************************/ 48 | { 49 | VAL_SET(out, type); 50 | return TRUE; 51 | } 52 | 53 | 54 | /*********************************************************************** 55 | ** 56 | */ REBTYPE(None) 57 | /* 58 | ** ALSO used for unset! 59 | ** 60 | ***********************************************************************/ 61 | { 62 | REBVAL *val = D_ARG(1); 63 | 64 | switch (action) { 65 | 66 | case A_MAKE: 67 | case A_TO: 68 | if (IS_DATATYPE(val)) 69 | return VAL_DATATYPE(val) == REB_NONE ? R_NONE : R_UNSET; 70 | else 71 | return IS_NONE(val) ? R_NONE : R_UNSET; 72 | 73 | case A_TAILQ: 74 | if (IS_NONE(val)) return R_TRUE; 75 | goto trap_it; 76 | case A_INDEXQ: 77 | case A_LENGTHQ: 78 | case A_SELECT: 79 | case A_FIND: 80 | case A_REMOVE: 81 | case A_CLEAR: 82 | case A_TAKE: 83 | if (IS_NONE(val)) return R_NONE; 84 | default: 85 | trap_it: 86 | Trap_Action(VAL_TYPE(val), action); 87 | } 88 | 89 | return R_RET; 90 | } 91 | -------------------------------------------------------------------------------- /src/include/host-compositor.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Additional code modifications and improvements Copyright 2012 Saphirion AG 9 | ** 10 | ** Licensed under the Apache License, Version 2.0 (the "License"); 11 | ** you may not use this file except in compliance with the License. 12 | ** You may obtain a copy of the License at 13 | ** 14 | ** http://www.apache.org/licenses/LICENSE-2.0 15 | ** 16 | ** Unless required by applicable law or agreed to in writing, software 17 | ** distributed under the License is distributed on an "AS IS" BASIS, 18 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ** See the License for the specific language governing permissions and 20 | ** limitations under the License. 21 | ** 22 | ************************************************************************ 23 | ** 24 | ** Title: compositor API functions 25 | ** Author: Richard Smolak 26 | ** 27 | ************************************************************************ 28 | ** 29 | ** NOTE to PROGRAMMERS: 30 | ** 31 | ** 1. Keep code clear and simple. 32 | ** 2. Document unusual code, reasoning, or gotchas. 33 | ** 3. Use same style for code, vars, indent(4), comments, etc. 34 | ** 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 35 | ** 5. Test everything, then test it again. 36 | ** 37 | ***********************************************************************/ 38 | 39 | extern void* rebcmp_create(REBGOB* rootGob, REBGOB* gob, void *win); 40 | 41 | extern void rebcmp_destroy(void* context); 42 | 43 | //extern REBSER* Gob_To_Image(REBGOB *gob); 44 | 45 | extern void rebcmp_compose(void* context, REBGOB* winGob, REBGOB* gob, REBOOL only); 46 | 47 | extern void rebcmp_blit(void* context); 48 | 49 | extern REBYTE* rebcmp_get_buffer(void* context); 50 | 51 | extern void rebcmp_release_buffer(void* context); 52 | 53 | extern REBOOL rebcmp_resize_buffer(void* context, REBGOB* winGob); 54 | 55 | //extern REBINT Draw_Image(REBSER *image, REBSER *block); 56 | 57 | //extern REBINT Effect_Image(REBSER *image, REBSER *block); 58 | -------------------------------------------------------------------------------- /src/include/host-view.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Additional code modifications and improvements Copyright 2012 Saphirion AG 9 | ** 10 | ** Licensed under the Apache License, Version 2.0 (the "License"); 11 | ** you may not use this file except in compliance with the License. 12 | ** You may obtain a copy of the License at 13 | ** 14 | ** http://www.apache.org/licenses/LICENSE-2.0 15 | ** 16 | ** Unless required by applicable law or agreed to in writing, software 17 | ** distributed under the License is distributed on an "AS IS" BASIS, 18 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ** See the License for the specific language governing permissions and 20 | ** limitations under the License. 21 | ** 22 | ************************************************************************ 23 | ** 24 | ** Title: Misc View related shared definitions 25 | ** Author: Richard Smolak 26 | ** 27 | ************************************************************************ 28 | ** 29 | ** NOTE to PROGRAMMERS: 30 | ** 31 | ** 1. Keep code clear and simple. 32 | ** 2. Document unusual code, reasoning, or gotchas. 33 | ** 3. Use same style for code, vars, indent(4), comments, etc. 34 | ** 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 35 | ** 5. Test everything, then test it again. 36 | ** 37 | ***********************************************************************/ 38 | 39 | extern REBXYF log_size; 40 | extern REBXYF phys_size; 41 | 42 | #define LOG_COORD_X(p) ((p) * log_size.x) 43 | #define LOG_COORD_Y(p) ((p) * log_size.y) 44 | #define PHYS_COORD_X(p) ((p) * phys_size.x) 45 | #define PHYS_COORD_Y(p) ((p) * phys_size.y) 46 | 47 | typedef enum { 48 | SM_SCREEN_NUM, 49 | SM_SCREEN_WIDTH, 50 | SM_SCREEN_HEIGHT, 51 | SM_SCREEN_X, 52 | SM_SCREEN_Y, 53 | SM_VIRTUAL_SCREEN_WIDTH, 54 | SM_VIRTUAL_SCREEN_HEIGHT, 55 | SM_WORK_WIDTH, 56 | SM_WORK_HEIGHT, 57 | SM_TITLE_HEIGHT, 58 | SM_SCREEN_DPI_X, 59 | SM_SCREEN_DPI_Y, 60 | SM_BORDER_WIDTH, 61 | SM_BORDER_HEIGHT, 62 | SM_BORDER_FIXED_WIDTH, 63 | SM_BORDER_FIXED_HEIGHT, 64 | SM_WINDOW_MIN_WIDTH, 65 | SM_WINDOW_MIN_HEIGHT, 66 | SM_WORK_X, 67 | SM_WORK_Y 68 | } METRIC_TYPE; 69 | -------------------------------------------------------------------------------- /src/include/reb-args.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Program startup arguments 23 | ** Module: reb-args.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** Arg struct is used by R3 lib, so must not be modified. 27 | ** 28 | ***********************************************************************/ 29 | 30 | // REBOL startup option structure: 31 | typedef struct rebol_args { 32 | REBCNT options; 33 | REBCHR *script; 34 | REBCHR *args; 35 | REBCHR *do_arg; 36 | REBCHR *version; 37 | REBCHR *debug; 38 | REBCHR *import; 39 | REBCHR *secure; 40 | REBCHR *boot; 41 | REBCHR *exe_path; 42 | REBCHR *home_dir; 43 | } REBARGS; 44 | 45 | // REBOL arg option flags: 46 | // Must stay matched to system/catalog/boot-flags. 47 | enum arg_opts { 48 | ROF_EXT, 49 | 50 | ROF_SCRIPT, 51 | ROF_ARGS, 52 | ROF_DO, 53 | ROF_IMPORT, 54 | ROF_VERSION, 55 | ROF_DEBUG, 56 | ROF_SECURE, 57 | 58 | ROF_HELP, 59 | ROF_VERS, 60 | ROF_QUIET, 61 | ROF_VERBOSE, 62 | ROF_SECURE_MIN, 63 | ROF_SECURE_MAX, 64 | ROF_TRACE, 65 | ROF_HALT, 66 | ROF_CGI, 67 | ROF_BOOT, 68 | ROF_NO_WINDOW, 69 | 70 | ROF_IGNORE, // not an option 71 | }; 72 | 73 | #define RO_EXT (1<bits field contains a block of memory allocated with Make_Mem 35 | // of size (->w * ->h * 4). This will be freed by the 36 | // REBNATIVE(do_codec) in n-system.c 37 | // 38 | // If your codec routine returns CODI_BINARY, it is 39 | // expected that the ->data field contains a block of memory 40 | // allocated with Make_Mem of size ->len. This will be freed by 41 | // the REBNATIVE(do_codec) in n-system.c 42 | // 43 | // If your codec routine returns CODI_TEXT, it is 44 | // expected that the ->data field is 3rd input binary! argument in 45 | // the REBNATIVE(do_codec) in n-system.c 46 | // so the deallocation is left to GC 47 | // 48 | typedef struct reb_codec_image { 49 | int action; 50 | int w; 51 | int h; 52 | int len; 53 | int alpha; 54 | unsigned char *data; 55 | union { 56 | u32 *bits; 57 | void *other; 58 | }; 59 | int error; 60 | } REBCDI; 61 | 62 | typedef REBINT (*codo)(REBCDI *cdi); 63 | 64 | // Media types: 65 | enum { 66 | CODI_ERROR, 67 | CODI_CHECK, // error code is inverted result (IDENTIFY) 68 | CODI_BINARY, 69 | CODI_TEXT, 70 | CODI_IMAGE, 71 | CODI_SOUND, 72 | CODI_BLOCK, 73 | }; 74 | 75 | // Codec commands: 76 | enum { 77 | CODI_IDENTIFY, 78 | CODI_DECODE, 79 | CODI_ENCODE, 80 | }; 81 | 82 | // Codec errors: 83 | enum { 84 | CODI_ERR_NA = 1, // Feature not available 85 | CODI_ERR_NO_ACTION, // Requested action unknown 86 | CODI_ERR_ENCODING, // Encoding method not supported 87 | CODI_ERR_SIGNATURE, // Header signature is not correct 88 | CODI_ERR_BIT_LEN, // Bit length is not supported 89 | CODI_ERR_BAD_TABLE, // Image tables are wrong 90 | CODI_ERR_BAD_DATA, // Generic 91 | }; 92 | -------------------------------------------------------------------------------- /src/include/reb-defs.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Miscellaneous structures and definitions 23 | ** Module: reb-defs.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** This file is used by internal and external C code. It 27 | ** should not depend on many other header files prior to it. 28 | ** 29 | ***********************************************************************/ 30 | 31 | #ifndef REB_DEFS_H // due to sequences within the lib build itself 32 | #define REB_DEFS_H 33 | 34 | #ifndef REB_DEF 35 | typedef void *REBSER; 36 | typedef void *REBOBJ; 37 | #endif 38 | 39 | #pragma pack(4) 40 | 41 | // X/Y coordinate pair as floats: 42 | typedef struct rebol_xy_float { 43 | float x; 44 | float y; 45 | } REBXYF; 46 | 47 | // X/Y coordinate pair as integers: 48 | typedef struct rebol_xy_int { 49 | int x; 50 | int y; 51 | } REBXYI; 52 | 53 | #define REBPAR REBXYI // temporary until all sources are converted 54 | 55 | // Standard date and time: 56 | typedef struct rebol_dat { 57 | int year; 58 | int month; 59 | int day; 60 | int time; 61 | int nano; 62 | int zone; 63 | } REBOL_DAT; // not same as REBDAT 64 | 65 | #pragma pack() 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /src/include/reb-event.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: REBOL event definitions 23 | ** Module: reb-event.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | // Note: size must be 12 bytes on 32-bit or 16 on 64-bit! 30 | 31 | #pragma pack(4) 32 | typedef struct rebol_event { 33 | u8 type; // event id (mouse-move, mouse-button, etc) 34 | u8 flags; // special flags 35 | u8 win; // window id 36 | u8 model; // port, object, gui, callback 37 | u32 data; // an x/y position or keycode (raw/decoded) 38 | union { 39 | REBREQ *req; // request (for device events) 40 | void *ser; // port or object 41 | }; 42 | } REBEVT; 43 | #pragma pack() 44 | 45 | // Special event flags: 46 | 47 | enum { 48 | EVF_COPIED, // event data has been copied 49 | EVF_HAS_XY, // map-event will work on it 50 | EVF_DOUBLE, // double click detected 51 | EVF_CONTROL, 52 | EVF_SHIFT, 53 | }; 54 | 55 | 56 | // Event port data model 57 | 58 | enum { 59 | EVM_DEVICE, // I/O request holds the port pointer 60 | EVM_PORT, // event holds port pointer 61 | EVM_OBJECT, // event holds object frame pointer 62 | EVM_GUI, // GUI event uses system/view/event/port 63 | EVM_CALLBACK, // Callback event uses system/ports/callback port 64 | }; 65 | 66 | // Special messages 67 | #define WM_DNS (WM_USER+100) 68 | -------------------------------------------------------------------------------- /src/include/reb-file.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Special file device definitions 23 | ** Module: reb-file.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | // RFM - REBOL File Modes 30 | enum { 31 | RFM_READ = 0, 32 | RFM_WRITE, 33 | RFM_APPEND, 34 | RFM_SEEK, 35 | RFM_NEW, 36 | RFM_READONLY, 37 | RFM_TRUNCATE, 38 | RFM_RESEEK, // file index has moved, reseek 39 | RFM_NAME_MEM, // converted name allocated in mem 40 | RFM_DIR = 16, 41 | }; 42 | 43 | // RFE - REBOL File Error 44 | enum { 45 | RFE_BAD_PATH = 1, 46 | RFE_NO_MODES, // No file modes specified 47 | RFE_OPEN_FAIL, // File open failed 48 | RFE_BAD_SEEK, // Seek not supported for this file 49 | RFE_NO_HANDLE, // File struct has no handle 50 | RFE_NO_SEEK, // Seek action failed 51 | RFE_BAD_READ, // Read failed (general) 52 | RFE_BAD_WRITE, // Write failed (general) 53 | RFE_DISK_FULL, // No space on target volume 54 | }; 55 | 56 | #define MAX_FILE_NAME 1022 57 | -------------------------------------------------------------------------------- /src/include/reb-filereq.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: File requestor definitions 23 | ** Module: reb-filereq.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | #define MAX_FILE_REQ_BUF (16*1024) 30 | 31 | #pragma pack(4) 32 | typedef struct Reb_File_Requestor { 33 | REBCNT flags; // multi, load/save, unicode 34 | REBCHR *title; // title of requestor 35 | REBCHR *button; // button name 36 | REBCHR *dir; // dir path 37 | REBCHR *files; // buffer to hold results 38 | REBCHR *filter; // buffer to hold results 39 | REBINT len; // length of buffer 40 | } REBRFR; 41 | #pragma pack() 42 | 43 | // File Request Flags: 44 | enum { 45 | FRF_MULTI, 46 | FRF_SAVE, 47 | FRF_KEEP, 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /src/include/reb-host.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Include files for hosting 23 | ** Module: reb-host.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | #include "reb-config.h" 30 | 31 | #include "reb-c.h" 32 | #include "reb-ext.h" // includes reb-defs.h 33 | #include "reb-args.h" 34 | #include "reb-device.h" 35 | #include "reb-file.h" 36 | #include "reb-event.h" 37 | #include "reb-evtypes.h" 38 | #include "reb-net.h" 39 | #include "reb-filereq.h" 40 | 41 | #include "reb-gob.h" 42 | #include "reb-lib.h" 43 | 44 | enum SKIA_DRIVER { 45 | SKIA_DRIVER_AUTO, 46 | SKIA_DRIVER_OPENGL, 47 | SKIA_DRIVER_CPU 48 | }; -------------------------------------------------------------------------------- /src/include/reb-math.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Math related definitions 23 | ** Module: reb-math.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | // Decimal number formatting specifications: 30 | typedef struct Reb_Deci_Spec { 31 | REBDEC dec; // number to form 32 | REBINT len; // # of digits requested 33 | REBCHR *out; // result: string of digits (no point or sign) 34 | REBINT point; // result: position of decimal point 35 | REBINT sign; // result: sign of number 36 | } REBDCS; 37 | -------------------------------------------------------------------------------- /src/include/reb-net.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Network device definitions 23 | ** Module: reb-net.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | // REBOL Socket types: 30 | enum socket_types { 31 | RST_UDP, // TCP or UDP 32 | RST_LISTEN = 8, // LISTEN 33 | RST_REVERSE, // DNS reverse 34 | }; 35 | 36 | // REBOL Socket Modes (state flags) 37 | enum { 38 | RSM_OPEN = 0, // socket is allocated 39 | RSM_ATTEMPT, // attempting connection 40 | RSM_CONNECT, // connection is open 41 | RSM_BIND, // socket is bound to port 42 | RSM_LISTEN, // socket is listening (TCP) 43 | RSM_SEND, // sending 44 | RSM_RECEIVE, // receiving 45 | RSM_ACCEPT, // an inbound connection 46 | }; 47 | 48 | #define IPA(a,b,c,d) (a<<24 | b<<16 | c<<8 | d) 49 | -------------------------------------------------------------------------------- /src/include/reb-series.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: REBOL series structure 23 | ** Module: reb-series.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** WARNING: struct size may change -- do not malloc() 27 | ** 28 | ***********************************************************************/ 29 | 30 | struct rebol_series { 31 | REBYTE *data; 32 | REBCNT tail; 33 | REBCNT rest; 34 | REBINT info; 35 | #if defined(__LP64__) || defined(__LLP64__) 36 | REBCNT padding; /* make the size multiple of sizeof(pointer) */ 37 | #endif 38 | REBCNT size; // Temp - size of image w/h 39 | // OPTIONAL Extensions 40 | }; 41 | 42 | #define SERIES_TAIL(s) ((s)->tail) 43 | #define SERIES_DATA(s) ((s)->data) 44 | 45 | #define BLK_HEAD(s) ((REBVAL *)((s)->data)) 46 | #define STR_HEAD(s) ((REBYTE *)((s)->data)) 47 | 48 | #define IMG_SIZE(s) ((s)->size) 49 | #define IMG_WIDE(s) ((s)->size & 0xffff) 50 | #define IMG_HIGH(s) ((s)->size >> 16) 51 | #define IMG_DATA(s) ((REBYTE *)((s)->data)) 52 | -------------------------------------------------------------------------------- /src/include/sys-dec-to-char.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** REBOL is a trademark of REBOL Technologies 6 | ** 7 | ** Copyright 2012 Saphirion AG 8 | ** 9 | ** Licensed under the Apache License, Version 2.0 (the "License"); 10 | ** you may not use this file except in compliance with the License. 11 | ** You may obtain a copy of the License at 12 | ** 13 | ** http://www.apache.org/licenses/LICENSE-2.0 14 | ** 15 | ** Unless required by applicable law or agreed to in writing, software 16 | ** distributed under the License is distributed on an "AS IS" BASIS, 17 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ** See the License for the specific language governing permissions and 19 | ** limitations under the License. 20 | ** 21 | ************************************************************************ 22 | ** 23 | ** Summary: Decimal conversion wrapper 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | char *dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve); 30 | double STRTOD(const char *s00, char **se); 31 | -------------------------------------------------------------------------------- /src/include/sys-deci-funcs.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Deci Datatype Functions 23 | ** Module: sys-deci-funcs.h 24 | ** Notes: 25 | ** 26 | ***********************************************************************/ 27 | 28 | /* unary operators - logic */ 29 | REBFLG deci_is_zero (const deci a); 30 | 31 | /* unary operators - deci */ 32 | deci deci_abs (deci a); 33 | deci deci_negate (deci a); 34 | 35 | /* binary operators - logic */ 36 | REBFLG deci_is_equal (deci a, deci b); 37 | REBFLG deci_is_lesser_or_equal (deci a, deci b); 38 | REBFLG deci_is_same (deci a, deci b); 39 | 40 | /* binary operators - deci */ 41 | deci deci_add (deci a, deci b); 42 | deci deci_subtract (deci a, deci b); 43 | deci deci_multiply (const deci a, const deci b); 44 | deci deci_divide (deci a, deci b); 45 | deci deci_mod (deci a, deci b); 46 | 47 | /* conversion to deci */ 48 | deci int_to_deci (REBI64 a); 49 | deci decimal_to_deci (REBDEC a); 50 | deci string_to_deci (REBYTE *s, REBYTE **endptr); 51 | deci binary_to_deci(REBYTE *s); 52 | 53 | /* conversion to other datatypes */ 54 | REBI64 deci_to_int (const deci a); 55 | REBDEC deci_to_decimal (const deci a); 56 | REBINT deci_to_string(REBYTE *string, const deci a, const REBYTE symbol, const REBYTE point); 57 | REBYTE *deci_to_binary(REBYTE binary[12], const deci a); 58 | 59 | /* math functions */ 60 | deci deci_ldexp (deci a, REBINT e); 61 | deci deci_truncate (deci a, deci b); 62 | deci deci_away (deci a, deci b); 63 | deci deci_floor (deci a, deci b); 64 | deci deci_ceil (deci a, deci b); 65 | deci deci_half_even (deci a, deci b); 66 | deci deci_half_away (deci a, deci b); 67 | deci deci_half_truncate (deci a, deci b); 68 | deci deci_half_ceil (deci a, deci b); 69 | deci deci_half_floor (deci a, deci b); 70 | deci deci_sign (deci a); 71 | -------------------------------------------------------------------------------- /src/include/sys-deci.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: Deci Datatype 23 | ** Module: sys-deci.h 24 | ** Notes: 25 | ** 26 | ***********************************************************************/ 27 | 28 | typedef struct deci { 29 | unsigned m0:32; /* significand, lowest part */ 30 | unsigned m1:32; /* significand, continuation */ 31 | unsigned m2:23; /* significand, highest part */ 32 | unsigned s:1; /* sign, 0 means nonnegative, 1 means nonpositive */ 33 | int e:8; /* exponent */ 34 | } deci; 35 | 36 | -------------------------------------------------------------------------------- /src/include/sys-net.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: System network definitions 23 | ** Module: sys-net.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | //----- Windows - "Network standards? What network standards?" -Bill G. 30 | #ifdef TO_WIN32 31 | 32 | #include 33 | 34 | #define GET_ERROR WSAGetLastError() 35 | #define IOCTL ioctlsocket 36 | #define CLOSE_SOCKET closesocket 37 | 38 | #define NE_ISCONN WSAEISCONN 39 | #define NE_WOULDBLOCK WSAEWOULDBLOCK 40 | #define NE_INPROGRESS WSAEINPROGRESS 41 | #define NE_ALREADY WSAEALREADY 42 | #define NE_NOTCONN WSAENOTCONN 43 | #define NE_INVALID WSAEINVAL 44 | 45 | //----- BSD - The network standard the rest of the world uses 46 | #else 47 | 48 | #ifdef TO_AMIGA 49 | typedef char __BYTE; 50 | typedef unsigned char __UBYTE; 51 | typedef char * __STRPTR; 52 | typedef long __LONG; 53 | #endif 54 | 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #define GET_ERROR errno 63 | #define IOCTL ioctl 64 | #define CLOSE_SOCKET close 65 | #define SOCKET unsigned int 66 | 67 | #define NE_ISCONN EISCONN 68 | #define NE_WOULDBLOCK EAGAIN // see include/asm/errno.h 69 | #define NE_INPROGRESS EINPROGRESS 70 | #define NE_ALREADY EALREADY 71 | #define NE_NOTCONN ENOTCONN 72 | #define NE_INVALID EINVAL 73 | 74 | // Null Win32 functions: 75 | #define WSADATA int 76 | 77 | // FreeBSD mystery define: 78 | #ifndef u_int32_t 79 | #define u_int32_t long 80 | #endif 81 | 82 | #ifndef HOSTENT 83 | typedef struct hostent HOSTENT; 84 | #endif 85 | 86 | #ifndef MAXGETHOSTSTRUCT 87 | #define MAXGETHOSTSTRUCT ((sizeof(struct hostent)+15) & ~15) 88 | #endif 89 | 90 | #endif // BSD 91 | 92 | typedef struct sockaddr_in SOCKAI; // Internet extensions 93 | 94 | #define BAD_SOCKET (~0) 95 | #define MAX_TRANSFER 32000 // Max send/recv buffer size 96 | #define MAX_HOST_NAME 256 // Max length of host name 97 | -------------------------------------------------------------------------------- /src/include/sys-state.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Licensed under the Apache License, Version 2.0 (the "License"); 9 | ** you may not use this file except in compliance with the License. 10 | ** You may obtain a copy of the License at 11 | ** 12 | ** http://www.apache.org/licenses/LICENSE-2.0 13 | ** 14 | ** Unless required by applicable law or agreed to in writing, software 15 | ** distributed under the License is distributed on an "AS IS" BASIS, 16 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ** See the License for the specific language governing permissions and 18 | ** limitations under the License. 19 | ** 20 | ************************************************************************ 21 | ** 22 | ** Summary: CPU State 23 | ** Module: sys-state.h 24 | ** Author: Carl Sassenrath 25 | ** Notes: 26 | ** 27 | ***********************************************************************/ 28 | 29 | 30 | // Create this on your local stack frame or globally: 31 | typedef struct { // State variables to save 32 | jmp_buf cpu_state; 33 | jmp_buf *last_jmp_buf; 34 | REBSER *error; 35 | const void *remotery_sample; 36 | REBINT dsp; 37 | REBINT dsf; 38 | REBINT hold_tail; // Tail for GC_Protect 39 | REBINT asp; // Auxiliary Stack Pointer 40 | } REBOL_STATE; 41 | 42 | // Save current state info into a structure: 43 | // g is Saved_State or Halt_State. 44 | #define PUSH_STATE(s, g) do {\ 45 | (s).last_jmp_buf = g;\ 46 | (s).dsp = DSP;\ 47 | (s).dsf = DSF;\ 48 | (s).asp = SERIES_TAIL(AS_Series);\ 49 | (s).hold_tail = GC_Protect->tail;\ 50 | (s).error = 0;\ 51 | } while(0) 52 | 53 | #define POP_STATE(s, g) do {\ 54 | g = (s).last_jmp_buf;\ 55 | DSP = (s).dsp;\ 56 | DSF = (s).dsf;\ 57 | SERIES_TAIL(AS_Series) = (s).asp;\ 58 | GC_Protect->tail = (s).hold_tail;\ 59 | } while (0) 60 | 61 | // Do not restore prior state: 62 | #define DROP_STATE(s, g) g = (s).last_state 63 | 64 | // Set the pointer for the prior state: 65 | #define SET_STATE(s, g) g = &(s).cpu_state 66 | 67 | // Store all CPU registers into the structure: 68 | #ifdef HAS_POSIX_SIGNAL 69 | #define SET_JUMP(s) sigsetjmp((s).cpu_state, 1) 70 | #define LONG_JUMP(s, v) siglongjmp((s), (v)) 71 | #else 72 | #define SET_JUMP(s) setjmp((s).cpu_state) 73 | #define LONG_JUMP(s, v) longjmp((s), (v)) 74 | #endif 75 | -------------------------------------------------------------------------------- /src/mezz/base-constants.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Boot Base: Constants and Equates" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: { 13 | This code is evaluated just after actions, natives, sysobj, and other lower 14 | levels definitions. This file intializes a minimal working environment 15 | that is used for the rest of the boot. 16 | } 17 | ] 18 | 19 | ; NOTE: The system is not fully booted at this point, so only simple 20 | ; expressions are allowed. Anything else will crash the boot. 21 | 22 | ;-- Standard constants: 23 | on: true 24 | off: false 25 | yes: true 26 | no: false 27 | zero: 0 28 | 29 | ;-- Special values: 30 | REBOL: system 31 | sys: system/contexts/sys 32 | lib: system/contexts/lib 33 | 34 | ;-- Char constants: 35 | null: #"^(NULL)" 36 | space: #" " 37 | sp: space 38 | backspace: #"^(BACK)" 39 | bs: backspace 40 | tab: #"^-" 41 | newline: #"^/" 42 | newpage: #"^l" 43 | slash: #"/" 44 | backslash: #"\" 45 | escape: #"^(ESC)" 46 | cr: #"^M" 47 | lf: newline 48 | crlf: "^M^J" 49 | 50 | ;-- Function synonyms: 51 | q: :quit 52 | !: :not 53 | min: :minimum 54 | max: :maximum 55 | abs: :absolute 56 | empty?: :tail? 57 | ---: :comment 58 | bind?: :bound? 59 | 60 | rebol.com: http://www.rebol.com 61 | -------------------------------------------------------------------------------- /src/mezz/base-debug.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Boot Base: Debug Functions" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: { 13 | This code is evaluated just after actions, natives, sysobj, and other lower 14 | levels definitions. This file intializes a minimal working environment 15 | that is used for the rest of the boot. 16 | } 17 | ] 18 | 19 | probe: func [ 20 | {Debug print a molded value and returns that same value.} 21 | value [any-type!] 22 | ][ 23 | print mold :value 24 | :value 25 | ] 26 | 27 | ??: func [ 28 | {Debug print a word, path, or block of such, followed by its molded value.} 29 | 'name "Word, path, and block to obtain values." 30 | /local out 31 | ][ 32 | case [ 33 | any [ 34 | word? :name 35 | path? :name 36 | ][ 37 | print ajoin [name ": " mold name: get :name] 38 | ] 39 | block? :name [ 40 | out: make string! 50 41 | foreach word name [ 42 | either any [ 43 | word? :word 44 | path? :word 45 | ][ 46 | repend out [word ": " mold get word " "] 47 | ][ 48 | repend out [mold word " "] 49 | ] 50 | ] 51 | print out 52 | ] 53 | true [probe :name] 54 | ] 55 | :name 56 | ] 57 | 58 | boot-print: func [ 59 | "Prints during boot when not quiet." 60 | data 61 | ][ 62 | unless system/options/quiet [print :data] 63 | ] 64 | 65 | loud-print: func [ 66 | "Prints during boot when verbose." 67 | data 68 | ][ 69 | if system/options/flags/verbose [print :data] 70 | ] 71 | -------------------------------------------------------------------------------- /src/mezz/base-series.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Boot Base: Series Functions" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: { 13 | This code is evaluated just after actions, natives, sysobj, and other lower 14 | levels definitions. This file intializes a minimal working environment 15 | that is used for the rest of the boot. 16 | } 17 | ] 18 | 19 | repend: func [ 20 | "Appends a reduced value to a series and returns the series head." 21 | series [series! port! map! gob! object! bitset!] {Series at point to insert (modified)} 22 | value {The value to insert} 23 | /part {Limits to a given length or position} 24 | length [number! series! pair!] 25 | /only {Inserts a series as a series} 26 | /dup {Duplicates the insert a specified number of times} 27 | count [number! pair!] 28 | ][ 29 | apply :append [series reduce :value part length only dup count] 30 | ] 31 | 32 | join: func [ 33 | "Concatenates values." 34 | value "Base value" 35 | rest "Value or block of values" 36 | ][ 37 | value: either series? :value [copy value] [form :value] 38 | repend value :rest 39 | ] 40 | 41 | reform: func [ 42 | "Forms a reduced block and returns a string." 43 | value "Value to reduce and form" 44 | ;/with "separator" 45 | ][ 46 | form reduce :value 47 | ] 48 | -------------------------------------------------------------------------------- /src/mezz/boot-files.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Boot: System Contexts" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: "Used by tools/make-boot.r" 13 | ] 14 | 15 | ;-- base: low-level boot in lib context: 16 | [ 17 | %base-constants.r 18 | %base-funcs.r 19 | %base-series.r 20 | %base-files.r 21 | %base-debug.r 22 | %base-defs.r 23 | ] 24 | 25 | ;-- sys: low-level sys context: 26 | [ 27 | %sys-base.r 28 | %sys-ports.r 29 | %sys-codec.r ; export to lib! 30 | %sys-load.r 31 | %sys-start.r 32 | ] 33 | 34 | ;-- lib: mid-level lib context: 35 | [ 36 | %mezz-types.r 37 | %mezz-func.r 38 | %mezz-debug.r 39 | %mezz-control.r 40 | %mezz-save.r 41 | %mezz-series.r 42 | %mezz-files.r 43 | %mezz-shell.r 44 | %mezz-math.r 45 | %mezz-help.r ; move dump-obj! 46 | %mezz-banner.r 47 | %mezz-colors.r 48 | %mezz-tail.r 49 | ] 50 | 51 | ;-- protocols: 52 | [ 53 | %prot-http.r 54 | ] 55 | -------------------------------------------------------------------------------- /src/mezz/dial-effect.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL Internal Dialect: Graphic Effects" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: "Modification requires recompiling affected source files." 13 | ] 14 | 15 | system/dialects/effect: context [ 16 | 17 | type-spec: [] 18 | 19 | add: [image! image!] 20 | alphamul: [image! integer!] 21 | aspect: [image! word! word! decimal!] 22 | blur: [image!] 23 | colorify: [image! tuple! integer!] 24 | colorize: [image! tuple!] 25 | convolve: [image! block! decimal! integer! logic!] 26 | contrast: [image! integer!] 27 | crop: [image! pair! pair!] 28 | difference: [image! image! tuple!] 29 | emboss: [image!] 30 | extend: [image! pair! pair!] 31 | fit: [image! word! word! decimal!] 32 | flip: [image! pair!] 33 | gradcol: [image! pair! tuple! tuple!] 34 | gradient: [image! pair! tuple! tuple!] 35 | gradmul: [image! pair! tuple! tuple!] 36 | grayscale: [image!] 37 | hsv: [image! tuple!] 38 | invert: [image!] 39 | key: [image! tuple!] 40 | luma: [image! integer!] 41 | mix: [image! image!] 42 | multiply: [image! image! tuple! integer!] 43 | reflect: [image! pair!] 44 | rotate: [image! integer!] 45 | shadow: [image! pair! pair! tuple! decimal! word!] 46 | sharpen: [image!] 47 | tile: [image! pair!] 48 | tile-view: [image!] 49 | tint: [image! integer!] 50 | 51 | ;not yet 52 | comment { 53 | clip: [] 54 | } 55 | ;-- EFFECTS Options: 56 | 57 | ;SHADOW option 58 | only: 59 | 60 | ;FIT options 61 | nearest: 62 | bilinear: 63 | bicubic: 64 | gaussian: 65 | resample: none 66 | ] 67 | -------------------------------------------------------------------------------- /src/mezz/dial-text.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL Internal Dialect: Rich Text" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Note: "Modification requires recompiling affected source files." 13 | ] 14 | 15 | system/dialects/text: context [ 16 | 17 | type-spec: [string! tuple!] 18 | 19 | bold: [logic!] 20 | italic: [logic!] 21 | underline: [logic!] 22 | font: [object!] 23 | para: [object!] 24 | size: [integer!] 25 | shadow: [pair! tuple! integer!] 26 | scroll: [pair!] 27 | drop: [integer!] 28 | anti-alias: [logic!] 29 | newline: [] 30 | caret: [object!] 31 | center: [] 32 | left: [] 33 | right: [] 34 | 35 | ; Aliases 36 | b: 37 | i: 38 | u: 39 | nl: 40 | none 41 | 42 | ] 43 | -------------------------------------------------------------------------------- /src/mezz/mezz-banner.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Startup Banner" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | make-banner: func [ 15 | "Build startup banner." 16 | fmt /local str star spc a b s 17 | ][ 18 | if string? fmt [return fmt] ; aleady built 19 | str: make string! 200 20 | star: append/dup make string! 74 #"*" 74 21 | spc: format ["**" 70 "**"] "" 22 | parse fmt [ 23 | some [ 24 | [ 25 | set a string! (s: format ["** " 68 "**"] a) 26 | | '= set a [string! | word! | set-word!] [ 27 | b: 28 | path! (b: get b/1) 29 | | word! (b: get b/1) 30 | | block! (b: reform b/1) 31 | | string! (b: b/1) 32 | ] 33 | (s: format ["** " 11 55 "**"] reduce [a b]) 34 | | '* (s: star) 35 | | '- (s: spc) 36 | ] 37 | (append append str s newline) 38 | ] 39 | ] 40 | str 41 | ] 42 | 43 | sys/boot-banner: make-banner [ 44 | * 45 | - 46 | "Atronix REBOL 3.1" 47 | - 48 | = Copyright: "2012 REBOL Technologies" 49 | = "" "2013~2017 Atronix Engineering Inc." 50 | = "" "2018-2019 Atronix Aquisition Corp." 51 | = "" "All rights reserved." 52 | = Website: "www.atronixengineering.com" 53 | - 54 | = Version: system/version 55 | = Platform: system/platform 56 | = Build: system/build 57 | - 58 | = Language: system/locale/language* 59 | = Locale: system/locale/locale* 60 | = Home: [to-local-file system/options/home] 61 | - 62 | * 63 | ] 64 | 65 | sys/boot-help: 66 | {Important notes: 67 | 68 | * Sandbox and security are not available. 69 | * Direct access to TCP HTTP required (no proxies). 70 | * Default web browser must be available. 71 | 72 | Special functions: 73 | 74 | Demo - run demo launcher (from saphirion.com) 75 | Help - show built-in help information 76 | Upgrade - check for newer releases 77 | } 78 | 79 | ;print make-banner boot-banner halt 80 | ;print boot-help 81 | -------------------------------------------------------------------------------- /src/mezz/mezz-colors.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL View: Standard Colors" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | black: 0.0.0 15 | coal: 64.64.64 16 | gray: 128.128.128 17 | pewter: 170.170.170 18 | silver: 192.192.192 19 | snow: 240.240.240 20 | white: 255.255.255 21 | 22 | blue: 0.0.255 23 | green: 0.255.0 24 | red: 255.0.0 25 | 26 | cyan: 0.255.255 27 | magenta: 255.0.255 28 | yellow: 255.255.0 29 | 30 | yello: 255.240.120 ; selection yellow 31 | navy: 0.0.128 32 | leaf: 0.128.0 33 | teal: 0.128.128 34 | maroon: 128.0.0 35 | olive: 128.128.0 36 | purple: 128.0.128 37 | 38 | orange: 255.150.10 39 | oldrab: 72.72.16 40 | brown: 139.69.19 41 | coffee: 76.26.0 42 | sienna: 160.82.45 43 | crimson: 220.20.60 44 | violet: 72.0.90 45 | brick: 178.34.34 46 | pink: 255.164.200 47 | gold: 255.205.40 48 | tan: 222.184.135 49 | beige: 255.228.196 50 | ivory: 255.255.240 51 | linen: 250.240.230 52 | khaki: 179.179.126 53 | rebolor: 142.128.110 54 | wheat: 245.222.129 55 | aqua: 40.100.130 56 | forest: 0.48.0 57 | water: 80.108.142 58 | papaya: 255.80.37 59 | sky: 164.200.255 60 | mint: 100.136.116 61 | 62 | reblue: 38.58.108 63 | base-color: 200.200.200 64 | -------------------------------------------------------------------------------- /src/mezz/mezz-control.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Control" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | launch: func [ 15 | {Runs a script as a separate process; return immediately.} 16 | script [file! string! none!] "The name of the script" 17 | /args arg [string! block! none!] "Arguments to the script" 18 | /wait "Wait for the process to terminate" 19 | ][ 20 | if file? script [script: to-local-file clean-path script] 21 | args: reduce [to-local-file system/options/boot script] 22 | if arg [append args arg] 23 | either wait [call/wait args] [call args] 24 | ] 25 | -------------------------------------------------------------------------------- /src/mezz/mezz-debug.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Debug" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | dt: delta-time: function [ 15 | {Delta-time - returns the time it takes to evaluate the block.} 16 | block [block!] 17 | ][ 18 | start: stats/timer 19 | do block 20 | stats/timer - start 21 | ] 22 | 23 | dp: delta-profile: func [ 24 | {Delta-profile of running a specific block.} 25 | block [block!] 26 | /local start end 27 | ][ 28 | start: values-of stats/profile 29 | do block 30 | end: values-of stats/profile 31 | foreach num start [ 32 | change end end/1 - num 33 | end: next end 34 | ] 35 | start: make system/standard/stats [] 36 | set start head end 37 | start 38 | ] 39 | 40 | speed?: function [ 41 | "Returns approximate speed benchmarks [eval cpu memory file-io]." 42 | /no-io "Skip the I/O test" 43 | /times "Show time for each test" 44 | ][ 45 | result: copy [] 46 | foreach block [ 47 | [ 48 | loop 100'000 [ 49 | ; measure more than just loop func 50 | ; typical load: 1 set, 2 data, 1 op, 4 trivial funcs 51 | x: 1 * index? back next "x" 52 | x: 1 * index? back next "x" 53 | x: 1 * index? back next "x" 54 | x: 1 * index? back next "x" 55 | ] 56 | calc: [100'000 / secs / 100] ; arbitrary calc 57 | ][ 58 | tmp: make binary! 500'000 59 | insert/dup tmp "abcdefghij" 50000 60 | loop 10 [ 61 | random tmp 62 | decompress compress tmp 63 | ] 64 | calc: [(length? tmp) * 10 / secs / 1900] 65 | ][ 66 | repeat n 40 [ 67 | change/dup tmp to-char n 500'000 68 | ] 69 | calc: [(length? tmp) * 40 / secs / 1024 / 1024] 70 | ][ 71 | unless no-io [ 72 | write file: %tmp-junk.txt "" ; force security request before timer 73 | tmp: make string! 32000 * 5 74 | insert/dup tmp "test^/" 32000 75 | loop 100 [ 76 | write file tmp 77 | read file 78 | ] 79 | delete file 80 | calc: [(length? tmp) * 100 * 2 / secs / 1024 / 1024] 81 | ] 82 | ] 83 | ][ 84 | secs: now/precise 85 | calc: 0 86 | recycle 87 | do block 88 | secs: to decimal! difference now/precise secs 89 | append result to integer! do calc 90 | if times [append result secs] 91 | ] 92 | result 93 | ] 94 | -------------------------------------------------------------------------------- /src/mezz/mezz-func.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Function Helpers" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | clos: func [ 15 | {Defines a closure function.} 16 | spec [block!] {Help string (opt) followed by arg words (and opt type and string)} 17 | body [block!] {The body block of the function} 18 | ][ 19 | make closure! copy/deep reduce [spec body] 20 | ] 21 | 22 | closure: func [ 23 | {Defines a closure function with all set-words as locals.} 24 | spec [block!] {Help string (opt) followed by arg words (and opt type and string)} 25 | body [block!] {The body block of the function} 26 | /with {Define or use a persistent object (self)} 27 | object [object! block! map!] {The object or spec} 28 | /extern words [block!] {These words are not local} 29 | ][ 30 | ; Copy the spec and add /local to the end if not found 31 | unless find spec: copy/deep spec /local [append spec [ 32 | /local ; In a block so the generated source gets the newlines 33 | ]] 34 | ; Make a full copy of the body, to allow reuse of the original 35 | body: copy/deep body 36 | ; Collect all set-words in the body as words to be used as locals, and add 37 | ; them to the spec. Don't include the words already in the spec or object. 38 | insert find/tail spec /local collect-words/deep/set/ignore body either with [ 39 | ; Make our own local object if a premade one is not provided 40 | unless object? object [object: make object! object] 41 | bind body object ; Bind any object words found in the body 42 | ; Ignore the words in the spec and those in the object. The spec needs 43 | ; to be copied since the object words shouldn't be added to the locals. 44 | append append append copy spec 'self words-of object words ; ignore 'self too 45 | ][ 46 | ; Don't include the words in the spec, or any extern words. 47 | either extern [append copy spec words] [spec] 48 | ] 49 | make closure! reduce [spec body] 50 | ] 51 | 52 | has: func [ 53 | {A shortcut to define a function that has local variables but no arguments.} 54 | vars [block!] {List of words that are local to the function} 55 | body [block!] {The body block of the function} 56 | ][ 57 | make function! reduce [head insert copy/deep vars /local copy/deep body] 58 | ] 59 | 60 | context: func [ 61 | {Defines a unique object.} 62 | blk [block!] {Object words and values (modified)} 63 | ][ 64 | make object! blk 65 | ] 66 | 67 | map: func [ 68 | {Make a map value (hashed associative block).} 69 | val 70 | ][ 71 | make map! :val 72 | ] 73 | 74 | task: func [ 75 | {Creates a task.} 76 | spec [block!] {Name or spec block} 77 | body [block!] {The body block of the task} 78 | ][ 79 | make task! copy/deep reduce [spec body] 80 | ] 81 | -------------------------------------------------------------------------------- /src/mezz/mezz-math.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Math" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | mod: func [ 15 | "Compute a nonnegative remainder of A divided by B." 16 | ; In fact the function tries to find the remainder, 17 | ; that is "almost non-negative" 18 | ; Example: 0.15 - 0.05 - 0.1 // 0.1 is negative, 19 | ; but it is "almost" zero, i.e. "almost non-negative" 20 | [catch] 21 | a [number! money! time!] 22 | b [number! money! time!] "Must be nonzero." 23 | /local r 24 | ] [ 25 | ; Compute the smallest non-negative remainder 26 | all [negative? r: a // b r: r + b] 27 | ; Use abs a for comparisons 28 | a: abs a 29 | ; If r is "almost" b (i.e. negligible compared to b), the 30 | ; result will be r - b. Otherwise the result will be r 31 | either all [a + r = (a + b) positive? r + r - b] [r - b] [r] 32 | ] 33 | 34 | modulo: func [ 35 | {Wrapper for MOD that handles errors like REMAINDER. Negligible values (compared to A and B) are rounded to zero.} 36 | ;[catch] 37 | a [number! money! time!] 38 | b [number! money! time!] "Absolute value will be used" 39 | /local r 40 | ] [ 41 | ; Coerce B to a type compatible with A 42 | any [number? a b: make a b] 43 | ; Get the "accurate" MOD value 44 | r: mod a abs b 45 | ; If the MOD result is "near zero", w.r.t. A and B, 46 | ; return 0--the "expected" result, in human terms. 47 | ; Otherwise, return the result we got from MOD. 48 | either any [a - r = a r + b = b] [make r 0] [r] 49 | ] 50 | 51 | sign?: func [ 52 | "Returns sign of number as 1, 0, or -1 (to use as multiplier)." 53 | number [number! money! time!] 54 | ][ 55 | case [ 56 | positive? number [1] 57 | negative? number [-1] 58 | true [0] 59 | ] 60 | ] 61 | 62 | minimum-of: func [ 63 | {Finds the smallest value in a series} 64 | series [series!] {Series to search} 65 | /skip {Treat the series as records of fixed size} 66 | size [integer!] 67 | /local spot 68 | ][ 69 | size: any [size 1] 70 | if 1 > size [cause-error 'script 'out-of-range size] 71 | spot: series 72 | forskip series size [ 73 | if lesser? first series first spot [spot: series] 74 | ] 75 | spot 76 | ] 77 | 78 | maximum-of: func [ 79 | {Finds the largest value in a series} 80 | series [series!] {Series to search} 81 | /skip {Treat the series as records of fixed size} 82 | size [integer!] 83 | /local spot 84 | ][ 85 | size: any [size 1] 86 | if 1 > size [cause-error 'script 'out-of-range size] 87 | spot: series 88 | forskip series size [ 89 | if greater? first series first spot [spot: series] 90 | ] 91 | spot 92 | ] 93 | -------------------------------------------------------------------------------- /src/mezz/mezz-shell.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: Shell-like Command Functions" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | ls: :list-dir 15 | pwd: :what-dir 16 | rm: :delete 17 | mkdir: :make-dir 18 | 19 | cd: func [ 20 | "Change directory (shell shortcut function)." 21 | 'path [file! word! path! unset! string!] "Accepts %file, :variables and just words (as dirs)" 22 | ][ 23 | switch type?/word :path [ 24 | unset! [print what-dir] 25 | file! [change-dir path] 26 | string! [change-dir to-rebol-file path] 27 | word! path! [change-dir to-file path] 28 | ] 29 | ] 30 | 31 | more: func [ 32 | "Print file (shell shortcut function)." 33 | 'file [file! word! path! string!] "Accepts %file and also just words (as file names)" 34 | ][ 35 | print deline to-string read switch type?/word :file [ 36 | file! [file] 37 | string! [to-rebol-file file] 38 | word! path! [to-file file] 39 | ] 40 | ] 41 | -------------------------------------------------------------------------------- /src/mezz/mezz-tail.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: End of Mezz" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | funco: :func ; save it for expert usage 15 | 16 | ; Final FUNC definition: 17 | func: funco [ 18 | {Defines a user function with given spec and body.} 19 | spec [block!] {Help string (opt) followed by arg words (and opt type and string)} 20 | body [block!] {The body block of the function} 21 | ][ 22 | make function! copy/deep reduce [spec body] ; (now it deep copies) 23 | ] 24 | 25 | ; Quick test runner (temporary): 26 | t: does [do %test.r] 27 | -------------------------------------------------------------------------------- /src/mezz/mezz-types.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Mezzanine: To-Type Helpers" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | ] 13 | 14 | ; These must be listed now, because there is no longer a global context for mezz functions: 15 | ; Are we sure we really want all these?? -Carl A108 16 | to-logic: to-integer: to-decimal: to-percent: to-money: to-char: to-pair: 17 | to-tuple: to-time: to-date: to-binary: to-string: to-file: to-email: to-url: to-tag: 18 | to-bitset: to-image: to-vector: to-block: to-paren: 19 | to-path: to-set-path: to-get-path: to-lit-path: to-map: to-datatype: to-typeset: 20 | to-word: to-set-word: to-get-word: to-lit-word: to-refinement: to-issue: 21 | to-command: to-closure: to-function: to-object: to-module: to-error: to-port: to-gob: 22 | to-event: 23 | none 24 | 25 | ; Auto-build the functions for the above TO-* words. 26 | use [word] [ 27 | foreach type system/catalog/datatypes [ 28 | ; The list above determines what will be made here: 29 | if in lib word: make word! head remove back tail ajoin ["to-" type] [ 30 | ; Add doc line only if this build has autodocs: 31 | set in lib :word func either string? first spec-of :make [ 32 | reduce [reform ["Converts to" form type "value."] 'value] 33 | ][ 34 | [value] 35 | ] compose [to (type) :value] 36 | ] 37 | ] 38 | ] 39 | -------------------------------------------------------------------------------- /src/mezz/saphir-patches.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "Saphir - patch file" 3 | ] 4 | 5 | ;enable console on next print,probe etc. 6 | console-output true 7 | 8 | if system/version/4 = 13 [ ;android temp encapper boot code 9 | use [data][ 10 | if data: get-encap-data [ 11 | do load decode 'text decompress decloak data "droiddebug" 12 | quit 13 | ] 14 | ] 15 | ] 16 | -------------------------------------------------------------------------------- /src/mezz/sys-codec.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "REBOL 3 Boot Sys: Encoder and Decoder" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Context: sys 13 | Note: { 14 | The boot binding of this module is SYS then LIB deep. 15 | Any non-local words not found in those contexts WILL BE 16 | UNBOUND and will error out at runtime! 17 | } 18 | ] 19 | 20 | decode: function [ 21 | {Decodes a series of bytes into the related datatype (e.g. image!).} 22 | type [word!] {Media type (jpeg, png, etc.)} 23 | data [binary!] {The data to decode} 24 | ][ 25 | unless all [ 26 | cod: select system/codecs type 27 | data: do-codec cod/entry 'decode data 28 | ][ 29 | cause-error 'access 'no-codec type 30 | ] 31 | data 32 | ] 33 | 34 | encode: function [ 35 | {Encodes a datatype (e.g. image!) into a series of bytes.} 36 | type [word!] {Media type (jpeg, png, etc.)} 37 | data [image! binary! string!] {The data to encode} 38 | /options opts [block!] {Special encoding options} 39 | ][ 40 | unless all [ 41 | cod: select system/codecs type 42 | ;encode patch replacing internal PNG encoder crash for now 43 | data: switch/default cod/name [ 44 | png [ 45 | lib/to-png data 46 | ] 47 | ][ 48 | do-codec cod/entry 'encode data 49 | ] 50 | ][ 51 | cause-error 'access 'no-codec type 52 | ] 53 | data 54 | ] 55 | 56 | encoding?: function [ 57 | "Returns the media codec name for given binary data. (identify)" 58 | data [binary!] 59 | ][ 60 | foreach [name codec] system/codecs [ 61 | if do-codec codec/entry 'identify data [ 62 | return name 63 | ] 64 | ] 65 | none 66 | ] 67 | 68 | export [decode encode encoding?] 69 | -------------------------------------------------------------------------------- /src/os/linux/host-put-image.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" { 6 | #include "reb-host.h" 7 | #include "host-lib.h" //for OS_Make 8 | #include "host-window.h" 9 | } 10 | #include "util/agg_color_conv.h" 11 | #include "util/agg_color_conv_rgb8.h" 12 | 13 | 14 | extern "C" void put_image(Display *display, 15 | Drawable drawable, 16 | GC gc, 17 | XImage * image, 18 | int w, 19 | int h, 20 | pixmap_format_t sys_pixmap_format) 21 | { 22 | char *old_data = image->data; 23 | agg::rendering_buffer src((unsigned char*)image->data, w, h, w * 4); 24 | unsigned char *tmp = new unsigned char [global_x_info->bpp / 8 * w * h]; 25 | assert(tmp != (unsigned char*) image->data); 26 | agg::rendering_buffer dest(tmp, w, h, w * global_x_info->bpp / 8); 27 | switch (sys_pixmap_format) { 28 | case pix_format_bgr555: 29 | agg::color_conv(&dest, &src, agg::color_conv_bgra32_to_rgb555()); 30 | break; 31 | case pix_format_bgr565: 32 | agg::color_conv(&dest, &src, agg::color_conv_bgra32_to_rgb565()); 33 | break; 34 | case pix_format_rgba32: 35 | agg::color_conv(&dest, &src, agg::color_conv_bgra32_to_rgba32()); 36 | break; 37 | default: 38 | RL_Print((REBYTE*)"Unsupported pix_format: %d\n", sys_pixmap_format); 39 | delete [] tmp; 40 | return; 41 | } 42 | image->data = (char*)tmp; 43 | XPutImage(display, 44 | drawable, 45 | gc, 46 | image, 47 | 0, 0, //src x, y 48 | 0, 0, //dest x, y 49 | w, h); 50 | delete [] tmp; 51 | image->data = old_data; 52 | } 53 | -------------------------------------------------------------------------------- /src/os/linux/host-window.h: -------------------------------------------------------------------------------- 1 | #ifndef _HOST_WINDOW_H_ 2 | #define _HOST_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define REB_WINDOW_BORDER_WIDTH 0 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | enum selection_status { 15 | SEL_STATUS_NONE, 16 | SEL_STATUS_COPY_TARGETS_CONVERTED, 17 | SEL_STATUS_COPY_DATA_CONVERTED, 18 | SEL_STATUS_COPY_DATA, 19 | SEL_STATUS_COPY_INCR_DATA, 20 | SEL_STATUS_COPY_INCR_WAIT, 21 | SEL_STATUS_COPY_DONE, 22 | SEL_STATUS_PASTE_INCR, 23 | SEL_STATUS_PASTE_DONE 24 | }; 25 | 26 | typedef enum { 27 | pix_format_undefined, 28 | pix_format_bgr555 = 0, 29 | pix_format_bgr565, 30 | pix_format_rgba32, 31 | pix_format_bgra32 32 | } pixmap_format_t; 33 | 34 | typedef struct { 35 | Window win; /* the hidden window for copy and paste */ 36 | enum selection_status status; 37 | Atom target; 38 | Atom property; 39 | char *data; 40 | REBCNT data_length; 41 | } selection_t; 42 | 43 | typedef struct x_atom_node { 44 | Atom atom; 45 | char *name; 46 | struct x_atom_node *next; 47 | } x_atom_node_t; 48 | 49 | typedef struct { 50 | struct x_atom_node *next; 51 | } x_atom_list_t; 52 | 53 | Atom x_atom_list_find_atom(x_atom_list_t *list, 54 | Display *display, 55 | const char* atom_name, 56 | unsigned char only_if_exists); 57 | 58 | void x_atom_list_free(x_atom_list_t *list); 59 | 60 | typedef struct { 61 | Display *display; 62 | Screen *default_screen; 63 | Visual *default_visual; 64 | int default_depth; 65 | int bpp; 66 | pixmap_format_t sys_pixmap_format; 67 | selection_t selection; /* for copy and paste */ 68 | Window leader_window; 69 | x_atom_list_t *x_atom_list; 70 | Atom *net_supported; 71 | long n_net_supported; /* size of net_supported */ 72 | #ifdef USE_XSHM 73 | REBOOL has_xshm; 74 | #endif 75 | REBOOL has_double_buffer; 76 | size_t max_request_size; 77 | } x_info_t; 78 | 79 | typedef struct { 80 | Window x_id; 81 | Window x_parent_id; 82 | Region exposed_region; 83 | XdbeBackBuffer x_back_buffer; 84 | unsigned int old_width; 85 | unsigned int old_height; 86 | unsigned int window_flags; /* last window flags from _NET_WM_STATE */ 87 | unsigned char mapped; /* windows has to be mapped before calling PutImage */ 88 | } host_window_t; 89 | 90 | extern x_info_t *global_x_info; 91 | 92 | void* Find_Window(REBGOB *gob); 93 | REBGOB *Find_Gob_By_Window(Window win); 94 | void OS_Init_Windows(); 95 | void OS_Update_Window(REBGOB *gob); 96 | void* OS_Open_Window(REBGOB *gob); 97 | void OS_Close_Window(REBGOB *gob); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /src/os/linux/iso-3166.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "iso-3166.h" 3 | 4 | const char ** iso3166_find_entry_by_2_code(const char* code) 5 | { 6 | int i = 0; 7 | if (code == NULL || strlen(code) != 2) { 8 | return NULL; 9 | } 10 | for(i = 0; i < sizeof(iso_3166_table)/sizeof(iso_3166_table[0]); i ++) { 11 | const char **inner = iso_3166_table[i]; 12 | if (inner[0] != NULL && !strncasecmp(inner[0], code, 3)) { 13 | return inner; 14 | } 15 | } 16 | 17 | return NULL; 18 | } 19 | -------------------------------------------------------------------------------- /src/os/linux/iso-639.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "iso-639.h" 3 | 4 | const char ** iso639_find_entry_by_2_code(const char* code) 5 | { 6 | int i = 0; 7 | if (code == NULL || strlen(code) != 2) { 8 | return NULL; 9 | } 10 | for(i = 0; i < sizeof(iso_639_table)/sizeof(iso_639_table[0]); i ++) { 11 | const char **inner = iso_639_table[i]; 12 | if (inner[2] != NULL && !strncasecmp(inner[2], code, 3)) { 13 | return inner; 14 | } 15 | } 16 | 17 | return NULL; 18 | } 19 | -------------------------------------------------------------------------------- /src/os/linux/iso3166.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | inp: %iso3166.txt 4 | cnt: read inp 5 | if #{EFBBBF} = to binary! copy/part cnt 3 [ ;UTF8 BOM 6 | cnt: skip cnt 3 7 | ] 8 | 9 | ;cnt: to string! cnt 10 | ;print ["string cnt BOM:" mold copy/part cnt 3] 11 | 12 | lower: charset [#"a" - #"z"] 13 | letter: charset [#"a" - #"z" #"A" - #"Z"] 14 | header: { 15 | /* 16 | DO NOT EDIT 17 | Generated by rebol iso3166.r 18 | */ 19 | /* code-2, country name 20 | */ 21 | const char* iso_3166_table[][2] = ^{ 22 | } 23 | outp: %iso-3166.h 24 | write outp header 25 | emit: func [cnt] [ 26 | ;print ["writing" cnt] 27 | write/append outp cnt 28 | ] 29 | 30 | binary-to-chex: func [ 31 | bin [binary! any-string!] 32 | /local ret c 33 | ][ 34 | print ["bin: " mold bin] 35 | ret: copy "" 36 | foreach c bin [ 37 | append ret join "\x" skip to-hex to integer! to char! c 6 38 | ] 39 | ret 40 | ] 41 | 42 | capitalize: func [ 43 | n 44 | ][ 45 | ret: copy "" 46 | words: parse n "" 47 | foreach w words [ 48 | case [ 49 | w = "OF" [ 50 | append ret "of " 51 | ] 52 | w = "U.S." [ 53 | append ret "U.S." 54 | ] 55 | 'else [ 56 | append ret join uppercase first w reduce [lowercase next w " "] 57 | ] 58 | ] 59 | ] 60 | 61 | remove back tail ret ;remove the extra space 62 | head ret 63 | ] 64 | 65 | parse cnt [ 66 | some [ 67 | copy name to ";" 68 | ";" copy code-2 to "^/" 69 | (emit rejoin [{^{"} code-2 {", "} binary-to-chex capitalize name {"^},^/}]) 70 | "^/" 71 | ] 72 | ] 73 | 74 | emit "^};" 75 | -------------------------------------------------------------------------------- /src/os/linux/iso639.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | inp: %ISO-639-2_utf-8.txt 4 | cnt: read inp 5 | if #{EFBBBF} = to binary! copy/part cnt 3 [ ;UTF8 BOM 6 | cnt: skip cnt 3 7 | ] 8 | 9 | ;cnt: to string! cnt 10 | ;print ["string cnt BOM:" mold copy/part cnt 3] 11 | 12 | lower: charset [#"a" - #"z"] 13 | letter: charset [#"a" - #"z" #"A" - #"Z"] 14 | header: { 15 | /* 16 | DO NOT EDIT 17 | Generated by rebol3 locale.r 18 | */ 19 | /* An alpha-3 (bibliographic) code, an alpha-3 (terminologic) code (when given), an alpha-2 code (when given), an English name, and a French name */ 20 | const char* iso_639_table[][5] = ^{ 21 | } 22 | outp: %iso-639.h 23 | write outp header 24 | emit: func [cnt] [ 25 | ;print ["writing" cnt] 26 | write/append outp cnt 27 | ] 28 | 29 | binary-to-chex: func [ 30 | bin [binary! any-string!] 31 | /local ret c 32 | ][ 33 | print ["bin: " mold bin] 34 | ret: copy "" 35 | foreach c bin [ 36 | append ret join "\x" skip to-hex to integer! to char! c 6 37 | ] 38 | ret 39 | ] 40 | 41 | EOL: charset [#"^/" #"^M"] 42 | 43 | parse cnt [ 44 | some [ 45 | copy temp to "|" (emit rejoin [{^{"} temp {", }]) ;3-letter code 46 | "|" [copy temp 3 lower (emit rejoin [{"} temp {"}]) | none (emit "NULL")] (emit ", ") ; terminologic 47 | "|" [copy temp 2 lower (emit rejoin [{"} temp {"}]) | none (emit "NULL")] (emit ", ") ; 2-letter code 48 | "|" copy temp to "|" (emit rejoin [{"} temp {", }]) ;language name in English 49 | "|" copy temp to "^/" (emit rejoin [{"} binary-to-chex temp {"^},^/}]) ;lanuage name in french language 50 | EOL 51 | ] 52 | ] 53 | 54 | emit "^};" 55 | -------------------------------------------------------------------------------- /src/os/linux/keysym2ucs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This module converts keysym values into the corresponding ISO 10646-1 3 | * (UCS, Unicode) values. 4 | */ 5 | 6 | #include 7 | 8 | int keysym2ucs(KeySym keysym); 9 | -------------------------------------------------------------------------------- /src/os/porting-templates/host-effect.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Additional code modifications and improvements Copyright 2012 Saphirion AG 9 | ** 10 | ** Licensed under the Apache License, Version 2.0 (the "License"); 11 | ** you may not use this file except in compliance with the License. 12 | ** You may obtain a copy of the License at 13 | ** 14 | ** http://www.apache.org/licenses/LICENSE-2.0 15 | ** 16 | ** Unless required by applicable law or agreed to in writing, software 17 | ** distributed under the License is distributed on an "AS IS" BASIS, 18 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ** See the License for the specific language governing permissions and 20 | ** limitations under the License. 21 | ** 22 | ************************************************************************ 23 | ** 24 | ** Title: EFFECT Dialect Backend 25 | ** Author: Richard Smolak, Carl Sassenrath 26 | ** Purpose: Evaluates effect commands; calls graphics functions. 27 | ** Tools: make-host-ext.r 28 | ** 29 | ************************************************************************ 30 | ** 31 | ** NOTE to PROGRAMMERS: 32 | ** 33 | ** 1. Keep code clear and simple. 34 | ** 2. Document unusual code, reasoning, or gotchas. 35 | ** 3. Use same style for code, vars, indent(4), comments, etc. 36 | ** 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 37 | ** 5. Test everything, then test it again. 38 | ** 39 | ***********************************************************************/ 40 | 41 | #include "reb-host.h" 42 | //#include "host-lib.h" 43 | 44 | //#define INCLUDE_EXT_DATA 45 | //#include "host-ext-effect.h" 46 | 47 | //***** Externs ***** 48 | 49 | //***** Locals ***** 50 | 51 | static u32* effect_ext_words; 52 | 53 | /*********************************************************************** 54 | ** 55 | */ RXIEXT int RXD_Effect(int cmd, RXIFRM *frm, REBCEC *ctx) 56 | /* 57 | ** EFFECT command dispatcher. 58 | ** 59 | ***********************************************************************/ 60 | { 61 | switch (cmd) { 62 | 63 | case CMD_EFFECT_INIT_WORDS: 64 | effect_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1)); 65 | break; 66 | 67 | default: 68 | return RXR_NO_COMMAND; 69 | } 70 | return RXR_UNSET; 71 | } 72 | -------------------------------------------------------------------------------- /src/os/win32/host-effect.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | ** 3 | ** REBOL [R3] Language Interpreter and Run-time Environment 4 | ** 5 | ** Copyright 2012 REBOL Technologies 6 | ** REBOL is a trademark of REBOL Technologies 7 | ** 8 | ** Additional code modifications and improvements Copyright 2012 Saphirion AG 9 | ** 10 | ** Licensed under the Apache License, Version 2.0 (the "License"); 11 | ** you may not use this file except in compliance with the License. 12 | ** You may obtain a copy of the License at 13 | ** 14 | ** http://www.apache.org/licenses/LICENSE-2.0 15 | ** 16 | ** Unless required by applicable law or agreed to in writing, software 17 | ** distributed under the License is distributed on an "AS IS" BASIS, 18 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ** See the License for the specific language governing permissions and 20 | ** limitations under the License. 21 | ** 22 | ************************************************************************ 23 | ** 24 | ** Title: EFFECT Dialect Backend 25 | ** Author: Richard Smolak, Carl Sassenrath 26 | ** Purpose: Evaluates effect commands; calls graphics functions. 27 | ** Tools: make-host-ext.r 28 | ** 29 | ************************************************************************ 30 | ** 31 | ** NOTE to PROGRAMMERS: 32 | ** 33 | ** 1. Keep code clear and simple. 34 | ** 2. Document unusual code, reasoning, or gotchas. 35 | ** 3. Use same style for code, vars, indent(4), comments, etc. 36 | ** 4. Keep in mind Linux, OS X, BSD, big/little endian CPUs. 37 | ** 5. Test everything, then test it again. 38 | ** 39 | ***********************************************************************/ 40 | 41 | #include "reb-host.h" 42 | //#include "host-lib.h" 43 | 44 | //#define INCLUDE_EXT_DATA 45 | //#include "host-ext-effect.h" 46 | 47 | //***** Externs ***** 48 | 49 | //***** Locals ***** 50 | 51 | static u32* effect_ext_words; 52 | 53 | /*********************************************************************** 54 | ** 55 | */ RXIEXT int RXD_Effect(int cmd, RXIFRM *frm, REBCEC *ctx) 56 | /* 57 | ** EFFECT command dispatcher. 58 | ** 59 | ***********************************************************************/ 60 | { 61 | switch (cmd) { 62 | 63 | case CMD_EFFECT_INIT_WORDS: 64 | effect_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1)); 65 | break; 66 | 67 | default: 68 | return RXR_NO_COMMAND; 69 | } 70 | return RXR_UNSET; 71 | } 72 | -------------------------------------------------------------------------------- /src/os/win32/host-licensing.c: -------------------------------------------------------------------------------- 1 | #include "reb-host.h" 2 | 3 | #define INCLUDE_EXT_DATA 4 | #include "host-ext-licensing.h" 5 | 6 | #include "../../c-code/extensions/licensing/src/odprintf.c" 7 | #include "../../c-code/extensions/licensing/src/licensing.c" 8 | #include "../../c-code/extensions/licensing/src/r3-ext.c" 9 | 10 | 11 | extern int RX_Call(int cmd, RXIFRM *frm, void *data); 12 | 13 | RL_LIB *RL; // Link back to reb-lib from embedded extensions 14 | 15 | /*********************************************************************** 16 | ** 17 | */ void Init_Licensing_Ext(void) 18 | /* 19 | ** Initialize special variables of the core extension. 20 | ** 21 | ***********************************************************************/ 22 | { 23 | RL = RL_Extend((REBYTE *)(&RX_licensing[0]), (RXICAL)&RX_Call); 24 | } 25 | -------------------------------------------------------------------------------- /src/tools/core-ext.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "REBOL Core extension generator" 3 | Author: "Richard Smolak" 4 | Copyright: {2010 2011 2012 2013 Saphirion AG, Zug, Switzerland} 5 | License: { 6 | Licensed under the Apache License, Version 2.0. 7 | See: http://www.apache.org/licenses/LICENSE-2.0 8 | } 9 | ] 10 | 11 | do %make-host-ext.r 12 | 13 | emit-file %host-ext-core [ 14 | %../boot/core.r 15 | ] 16 | -------------------------------------------------------------------------------- /src/tools/form-header.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | System: "REBOL [R3] Language Interpreter and Run-time Environment" 3 | Title: "Standard source code header" 4 | Rights: { 5 | Copyright 2012 REBOL Technologies 6 | REBOL is a trademark of REBOL Technologies 7 | } 8 | License: { 9 | Licensed under the Apache License, Version 2.0 10 | See: http://www.apache.org/licenses/LICENSE-2.0 11 | } 12 | Author: "Carl Sassenrath" 13 | ] 14 | 15 | bv: load %../boot/version.r 16 | 17 | form-header: func [title [string!] file [file!] /gen by] [ 18 | print ["..." title] 19 | by: either gen [ 20 | rejoin [{** AUTO-GENERATED FILE - Do not modify. (From: } by {)^/**^/}] 21 | ][""] 22 | 23 | rejoin [ 24 | {/*********************************************************************** 25 | ** 26 | ** REBOL [R3] Language Interpreter and Run-time Environment 27 | ** Copyright 2012 REBOL Technologies 28 | ** REBOL is a trademark of REBOL Technologies 29 | ** Licensed under the Apache License, Version 2.0 30 | ** This is a code-generated file. 31 | ** 32 | ************************************************************************ 33 | ** 34 | ** Title: } title { 35 | ** Build: A} bv/3 { 36 | ** Date: } now/date { 37 | ** File: } file { 38 | ** 39 | } by 40 | {***********************************************************************/ 41 | 42 | } 43 | ] 44 | ] 45 | -------------------------------------------------------------------------------- /src/tools/licensing-ext.r: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | do %make-host-ext.r 4 | 5 | emit-file %host-ext-licensing [ 6 | %../../../c-code/extensions/licensing/include/make-ext-input.r3 7 | ] 8 | -------------------------------------------------------------------------------- /src/tools/rt-init.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "Original REBOL host init code generator" 3 | Author: "Richard Smolak" 4 | Copyright: {2010 2011 2012 2013 Saphirion AG, Zug, Switzerland} 5 | License: { 6 | Licensed under the Apache License, Version 2.0. 7 | See: http://www.apache.org/licenses/LICENSE-2.0 8 | } 9 | ] 10 | 11 | do %make-host-init.r 12 | 13 | include-vid: off 14 | 15 | ; Files to include in the host program: 16 | files: [ 17 | %mezz/prot-http.r 18 | ; %mezz/view-colors.r 19 | ] 20 | 21 | vid-files: [ 22 | %mezz/dial-draw.r 23 | %mezz/dial-text.r 24 | %mezz/dial-effect.r 25 | %mezz/view-funcs.r 26 | %mezz/vid-face.r 27 | %mezz/vid-events.r 28 | %mezz/vid-styles.r 29 | %mezz/mezz-splash.r 30 | ] 31 | 32 | if include-vid [append files vid-files] 33 | 34 | 35 | code: load-files files 36 | 37 | save %boot/host-init.r code 38 | 39 | write-c-file %include/host-init.h code 40 | -------------------------------------------------------------------------------- /src/tools/saphir-init.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "Saphir host init code generator" 3 | Author: "Richard Smolak" 4 | Copyright: {2010 2011 2012 2013 Saphirion AG, Zug, Switzerland} 5 | License: { 6 | Licensed under the Apache License, Version 2.0. 7 | See: http://www.apache.org/licenses/LICENSE-2.0 8 | } 9 | ] 10 | 11 | do %make-host-init.r 12 | 13 | ; Files to include in the host program: 14 | files: [ 15 | %mezz/prot-tls.r 16 | %mezz/prot-http.r 17 | %mezz/saphir-patches.r 18 | ] 19 | 20 | code: load-files files 21 | 22 | save %boot/host-init.r code 23 | 24 | write-c-file %include/host-init.h code 25 | -------------------------------------------------------------------------------- /src/tools/view-ext.r: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "View extensions code generator" 3 | Author: "Richard Smolak" 4 | Copyright: {2010 2011 2012 2013 Saphirion AG, Zug, Switzerland} 5 | License: { 6 | Licensed under the Apache License, Version 2.0. 7 | See: http://www.apache.org/licenses/LICENSE-2.0 8 | } 9 | ] 10 | 11 | do %make-host-ext.r 12 | 13 | emit-file %host-ext-graphics [ 14 | %../boot/graphics.r 15 | %../mezz/view-funcs.r 16 | ] 17 | 18 | emit-file %host-ext-draw [ 19 | %../boot/draw.r 20 | ] 21 | 22 | emit-file %host-ext-shape [ 23 | %../boot/shape.r 24 | ] 25 | 26 | emit-file %host-ext-text [ 27 | %../boot/text.r 28 | ] 29 | -------------------------------------------------------------------------------- /tests/dev-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/tests/dev-small.jpg -------------------------------------------------------------------------------- /tests/draw-windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/tests/draw-windows.png -------------------------------------------------------------------------------- /tests/draw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/tests/draw.png -------------------------------------------------------------------------------- /tests/text-test.r3: -------------------------------------------------------------------------------- 1 | REBOL [Title: "Basic TEXT test"] 2 | 3 | do %gfx-pre.r3 4 | 5 | find-file: funct [ 6 | dir [file!] 7 | file [file!] 8 | ][ 9 | foreach f read dir [ 10 | fn: dir/:f 11 | either dir? fn [ 12 | if fn: find-file fn file [ 13 | return fn 14 | ] 15 | ][ 16 | if file = f [ 17 | return to string! fn 18 | ] 19 | ] 20 | ] 21 | return none 22 | ] 23 | 24 | find-font: funct [ 25 | "Simple way how to find specific font file on Linux" 26 | font-name [string! file!] 27 | ][ 28 | font-dirs: copy [] 29 | 30 | fonts-cfg: to-string read %/etc/fonts/fonts.conf 31 | 32 | parse/all fonts-cfg [ 33 | some [ 34 | thru {} copy dir to {} (append font-dirs dirize to-file dir) 35 | ] 36 | ] 37 | foreach font-dir probe font-dirs [ 38 | if all [ 39 | exists? font-dir 40 | f: find-file font-dir font-name 41 | ][ 42 | return f 43 | ] 44 | ] 45 | return none 46 | ] 47 | 48 | fnt-uni: make system/standard/font [ 49 | size: 28 50 | ] 51 | 52 | switch system/version/4 [ 53 | 3 [ ; Windows 54 | fnt-uni/name: "Arial Unicode MS" 55 | ] 56 | 4 [ ; Linux 57 | fnt-uni/name: find-font %FreeSans.ttf 58 | ] 59 | ] 60 | 61 | draw-block: to-draw [ 62 | text [ 63 | anti-alias 64 | font fnt-uni 65 | size 28 66 | underline 67 | bold 68 | "Unicode text works in HostKit!" 69 | drop 2 70 | newline 71 | size 11 72 | "You need 'Arial Unicode MS' truetype font for this demo or some other font with wide range of unicode support" 73 | newline 74 | drop 1 75 | underline off 76 | bold off 77 | navy 78 | "Arabic - ضطفقحڭڦڞ۞" 79 | newline 80 | "Armenian - ՅՌՎՑՓ" 81 | newline 82 | "Bengali - তঃঊঋঐকতোতৢ" 83 | newline 84 | "Chinese - ㌇㌌㌚㌫㍀㍌㍖" 85 | newline 86 | "Czech - ěščřžýáíéňď" 87 | newline 88 | "Greek - αβγδεζ" 89 | newline 90 | "German - äßÖöü" 91 | newline 92 | "Hebrew - סאבגדהוט" 93 | newline 94 | "Hiragana - ばぬぢぽみゆあ" 95 | newline 96 | "Katakana - ゼヂネポヸダジ" 97 | newline 98 | "Panjabi - ੨ਫ਼ਓਔੴ" 99 | newline 100 | "Russian - ДφψЗлйжҒ" 101 | newline 102 | "Thai - ฑญฆญจบฟ" 103 | newline 104 | "Tibetan - གྷཆ༰༯༲༬༣༇༈༊ང྆ཀྵ" 105 | ] 106 | ] copy [] 107 | 108 | print "Generating TEXT graphics.." 109 | img: make image! [420x640 164.200.255] 110 | write %text.png encode 'png draw img draw-block 111 | print "Output has been succesfully written to text.png file." 112 | halt 113 | -------------------------------------------------------------------------------- /tests/text-windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsx/r3/9c0f38a174ee62355ce5e4df1db86e56a1a7feec/tests/text-windows.png --------------------------------------------------------------------------------