ifdef CONFIG
VERSION = 0.97
+ GIT_LABEL = $(shell git describe --all --long)
BUNDLE = Factor.app
LIBPATH = -L/usr/X11R6/lib
include $(CONFIG)
- CFLAGS = -Wall $(SITE_CFLAGS)
+ CFLAGS = -Wall \
+ -DFACTOR_VERSION="$(VERSION)" \
+ -DFACTOR_GIT_LABEL="$(GIT_LABEL)" \
+ $(SITE_CFLAGS)
ifdef DEBUG
CFLAGS += -g -DFACTOR_DEBUG
BOOTIMAGE_VERSION = latest
!ENDIF
+!IF !DEFINED(VERSION)
+VERSION = version-missing
+!ENDIF
+
+!IF !DEFINED(GIT_LABEL)
+GIT_LABEL = git-label-missing
+!ENDIF
+
!IF DEFINED(PLATFORM)
LINK_FLAGS = /nologo shell32.lib
-CL_FLAGS = /nologo /O2 /WX /W3 /D_CRT_SECURE_NO_WARNINGS
+CL_FLAGS = /nologo /O2 /WX /W3 /D_CRT_SECURE_NO_WARNINGS /DFACTOR_VERSION=$(VERSION) /DFACTOR_GIT_LABEL=$(GIT_LABEL)
CL_FLAGS_VISTA = /D_WIN32_WINNT=0x0600
+!IF DEFINED(DEBUG)
+LINK_FLAGS = $(LINK_FLAGS) /DEBUG
+CL_FLAGS = $(CL_FLAGS) /Zi /DFACTOR_DEBUG
+!ENDIF
+
!IF "$(PLATFORM)" == "x86-32"
LINK_FLAGS = $(LINK_FLAGS) /safeseh
PLAF_DLL_OBJS = vm\os-windows-x86.32.obj vm\safeseh.obj vm\cpu-x86.obj
documents.elements fry hashtables help help.markup help.tips io
io.styles kernel lexer listener locals make math models
models.arrow models.delay namespaces parser prettyprint
-quotations sequences source-files.errors strings threads
+quotations sequences source-files.errors strings system threads
tools.errors.model ui ui.commands ui.gadgets ui.gadgets.buttons
ui.gadgets.editors ui.gadgets.glass ui.gadgets.labeled
ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar
: introduction. ( -- )
tip-of-the-day. nl
- { $strong "Press " { $snippet "F1" } " at any time for help." } print-content nl nl ;
+ { $strong "Press " { $snippet "F1" } " at any time for help." } print-content nl
+ version-info print-content nl nl ;
: listener-thread ( listener -- )
dup listener-streams [
) else goto nocl\r
)\r
\r
+git describe --all --long > git_label.tmp\r
+set /p git_label= < git_label.tmp\r
+\r
+set version=0.97\r
+\r
if %_bootimage_version%==clean (\r
set _git_branch=clean-windows-%_target%\r
set _bootimage_path=clean/windows-%_target%\r
echo upstream "clean-windows-*" branch corresponding to the current\r
echo platform and the corresponding boot image is downloaded.\r
goto :EOF\r
-\r
OS=`echo $1 | cut -d '-' -f 1`
ARCH=`echo $1 | cut -d '-' -f 2`
WORD=`echo $1 | cut -d '-' -f 3`
-
+
if [[ $OS == linux && $ARCH == ppc ]] ; then WORD=32; fi
if [[ $OS == linux && $ARCH == arm ]] ; then WORD=32; fi
if [[ $OS == macosx && $ARCH == ppc ]] ; then WORD=32; fi
}
update_script_changed() {
- invoke_git diff --stat `invoke_git merge-base HEAD FETCH_HEAD` FETCH_HEAD | grep 'build-support.factor\.sh' >/dev/null
+ invoke_git diff --stat `invoke_git merge-base HEAD FETCH_HEAD` FETCH_HEAD | grep 'build-support.factor\.sh' >/dev/null
}
git_fetch_factorcode() {
utf8 alien>string ;
GENERIC: symbol>string ( symbol(s) -- string )
+
+: special-object>string ( n -- str )
+ special-object (symbol>string) ;
+
M: byte-array symbol>string (symbol>string) ;
M: array symbol>string [ (symbol>string) ] map ", " join ;
[
- OBJ-CPU special-object utf8 alien>string string>cpu \ cpu set-global
- OBJ-OS special-object utf8 alien>string string>os \ os set-global
- OBJ-VM-COMPILER special-object utf8 alien>string \ vm-compiler set-global
+ OBJ-CPU special-object>string string>cpu \ cpu set-global
+ OBJ-OS special-object>string string>os \ os set-global
+ OBJ-VERSION special-object>string \ version set-global
+ OBJ-GIT-LABEL special-object>string \ git-label set-global
+ OBJ-VM-COMPILER special-object>string \ vm-compiler set-global
+ OBJ-VM-COMPILE-TIME special-object>string \ vm-compile-time set-global
] "alien.strings" add-startup-hook
CONSTANT: OBJ-SIGNAL-PIPE 74
+CONSTANT: OBJ-VM-COMPILE-TIME 75
+
+CONSTANT: OBJ-VERSION 76
+CONSTANT: OBJ-GIT-LABEL 77
+
! Context object count and identifiers must be kept in sync with:
! vm/contexts.hpp
! Copyright (C) 2007, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: assocs init kernel.private namespaces ;
+USING: assocs init kernel kernel.private namespaces strings sequences ;
IN: system
SINGLETONS: x86.32 x86.64 arm ppc.32 ppc.64 ;
: os ( -- class ) \ os get-global ; foldable
+: version ( -- string ) \ version get-global ; foldable
+
+: git-label ( -- string ) \ git-label get-global ; foldable
+
: vm-compiler ( -- string ) \ vm-compiler get-global ; foldable
+: vm-compile-time ( -- string ) \ vm-compile-time get-global ; foldable
+
<PRIVATE
+CONSTANT: string>cpu-hash H{
+ { "x86.32" x86.32 }
+ { "x86.64" x86.64 }
+ { "arm" arm }
+ { "ppc.32" ppc.32 }
+ { "ppc.64" ppc.64 }
+}
+
+CONSTANT: string>os-hash H{
+ { "windows" windows }
+ { "macosx" macosx }
+ { "linux" linux }
+}
+
+: key-for-value ( key hash -- val )
+ >alist [ first2 nip = ] with filter first first ;
+
: string>cpu ( str -- class )
- H{
- { "x86.32" x86.32 }
- { "x86.64" x86.64 }
- { "arm" arm }
- { "ppc.32" ppc.32 }
- { "ppc.64" ppc.64 }
- } at ;
+ string>cpu-hash at ;
+
+: cpu>string ( class -- str )
+ string>cpu-hash key-for-value ;
: string>os ( str -- class )
- H{
- { "windows" windows }
- { "macosx" macosx }
- { "linux" linux }
- } at ;
+ string>os-hash at ;
+
+: os>string ( class -- str )
+ string>os-hash key-for-value ;
PRIVATE>
: embedded? ( -- ? ) OBJ-EMBEDDED special-object ;
: exit ( n -- * ) do-shutdown-hooks (exit) ;
+
+: version-info ( -- str )
+ ! formatting vocab not available in this context.
+ "Factor " version append " (" append git-label append ", " append
+ vm-compile-time append ") [" append vm-compiler append
+ " " append cpu cpu>string append "] on " append os os>string append ;
special_objects[OBJ_EMBEDDED] = false_object;
special_objects[OBJ_VM_COMPILER] =
allot_alien(false_object, (cell)FACTOR_COMPILER_VERSION);
+ special_objects[OBJ_VM_COMPILE_TIME] =
+ allot_alien(false_object, (cell)FACTOR_COMPILE_TIME);
+ special_objects[OBJ_VERSION] =
+ allot_alien(false_object, (cell)FACTOR_STRINGIZE(FACTOR_VERSION));
+ special_objects[OBJ_GIT_LABEL] =
+ allot_alien(false_object, (cell)FACTOR_STRINGIZE(FACTOR_GIT_LABEL));
/* We can GC now */
gc_off = false;
#define FACTOR_COMPILER_VERSION "unknown"
#endif
+/* Record compilation time */
+#define FACTOR_COMPILE_TIME __TIMESTAMP__
+
/* Detect target CPU type */
#if defined(__arm__)
#define FACTOR_ARM
// Special object count and identifiers must be kept in sync with:
// core/kernel/kernel.factor
-// core/bootstrap/image/image.factor
+// basis/bootstrap/image/image.factor
static const cell special_object_count = 80;
OBJ_SIGNAL_PIPE = 74, /* file descriptor for pipe used to communicate signals
only used on unix */
+ OBJ_VM_COMPILE_TIME = 75, /* when the binary was built */
+ OBJ_VERSION = 76, /* factor version */
+ OBJ_GIT_LABEL = 77, /* git label (git describe --all --long) */
};
/* save-image-and-exit discards special objects that are filled in on startup