From 7c24a782815e2278194e111f63415258c4b314c6 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 28 Feb 2008 01:20:27 -0600 Subject: [PATCH] Fix init-hook regression --- core/debugger/debugger.factor | 31 +++++++++++++++++++------------ core/io/files/files.factor | 1 - core/libc/libc.factor | 8 +------- 3 files changed, 20 insertions(+), 20 deletions(-) mode change 100644 => 100755 core/libc/libc.factor diff --git a/core/debugger/debugger.factor b/core/debugger/debugger.factor index 378491e141..40bcbe78b1 100755 --- a/core/debugger/debugger.factor +++ b/core/debugger/debugger.factor @@ -6,7 +6,7 @@ strings io.styles vectors words system splitting math.parser tuples continuations continuations.private combinators generic.math io.streams.duplex classes compiler.units generic.standard vocabs threads threads.private init -kernel.private ; +kernel.private libc ; IN: debugger GENERIC: error. ( error -- ) @@ -63,20 +63,9 @@ M: string error. print ; [ global [ "Error in print-error!" print drop ] bind ] recover ; -: error-in-thread. ( -- ) - error-thread get-global - "Error in thread " write - [ - dup thread-id # - " (" % dup thread-name % - ", " % dup thread-quot unparse-short % ")" % - ] "" make - swap write-object ":" print nl ; - SYMBOL: error-hook [ - error-in-thread. print-error restarts. nl @@ -265,6 +254,24 @@ M: no-compilation-unit error. M: no-vocab summary drop "Vocabulary does not exist" ; +M: check-ptr summary + drop "Memory allocation failed" ; + +M: double-free summary + drop "Free failed since memory is not allocated" ; + +M: realloc-error summary + drop "Memory reallocation failed" ; + +: error-in-thread. ( -- ) + error-thread get-global + "Error in thread " write + [ + dup thread-id # + " (" % dup thread-name % + ", " % dup thread-quot unparse-short % ")" % + ] "" make swap write-object ":" print nl ; + ! Hooks M: thread error-in-thread ( error thread -- ) initial-thread get-global eq? [ diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 64e4f0f49a..85f0621443 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -142,7 +142,6 @@ DEFER: copy-tree-to : copy-tree ( from to -- ) over directory? [ - dup make-directories >r dup directory swap r> [ >r swap first path+ r> copy-tree-to ] 2curry each diff --git a/core/libc/libc.factor b/core/libc/libc.factor old mode 100644 new mode 100755 index a28c5c0a98..e82b244d6d --- a/core/libc/libc.factor +++ b/core/libc/libc.factor @@ -2,7 +2,7 @@ ! Copyright (C) 2007 Slava Pestov ! Copyright (C) 2007 Doug Coleman ! See http://factorcode.org/license.txt for BSD license. -USING: alien assocs continuations init inspector kernel namespaces ; +USING: alien assocs continuations init kernel namespaces ; IN: libc TUPLE: check-ptr ; -M: check-ptr summary drop "Memory allocation failed" ; - : check-ptr ( c-ptr -- c-ptr ) [ \ check-ptr construct-boa throw ] unless* ; TUPLE: double-free ; -M: double-free summary drop "Free failed since memory is not allocated" ; - : double-free ( -- * ) \ double-free construct-empty throw ; TUPLE: realloc-error ptr size ; -M: realloc-error summary drop "Memory reallocation failed" ; - : realloc-error ( alien size -- * ) \ realloc-error construct-boa throw ;