Merge branch 'master' into es17.05

This commit is contained in:
Jocelyn Fiat
2017-06-20 18:15:03 +02:00
7 changed files with 51 additions and 71 deletions

View File

@@ -28,17 +28,17 @@ feature -- Access
end end
message: detachable READABLE_STRING_32 message: detachable READABLE_STRING_32
-- Potential error message -- Potential error message.
deferred deferred
end end
parent: detachable ERROR parent: detachable ERROR
-- Eventual error prior to Current -- Eventual error prior to Current.
feature -- String representation feature -- String representation
string_representation: STRING_32 string_representation: STRING_32
-- String representation for Current -- String representation for Current.
do do
create Result.make_from_string (name.as_string_32) create Result.make_from_string (name.as_string_32)
Result.append_character (' ') Result.append_character (' ')
@@ -62,7 +62,7 @@ feature -- Status report
feature -- Change feature -- Change
set_parent (a_parent: like parent) set_parent (a_parent: like parent)
-- Set `parent' to `a_parent' -- Set `parent' to `a_parent'.
do do
parent := a_parent parent := a_parent
end end
@@ -80,7 +80,7 @@ invariant
name_attached: name /= Void name_attached: name /= Void
note note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -30,28 +30,24 @@ feature -- Access
name: STRING name: STRING
message: detachable STRING_32 message: STRING_32
do do
create Result.make_from_string (name) create Result.make_from_string (name)
from across
sub_errors.start sub_errors as s
until
sub_errors.after
loop loop
if if
attached sub_errors.item as e and then attached s.item as e and then
attached e.message as m attached e.message as m
then then
Result.append_character ('%N') Result.append_character ('%N')
Result.append_string (m) Result.append_string (m)
end end
sub_errors.forth
end end
end end
sub_errors: LIST [ERROR] sub_errors: LIST [ERROR]
-- Error contained by Current -- Error contained by Current.
feature -- Visitor feature -- Visitor
@@ -61,9 +57,8 @@ feature -- Visitor
a_visitor.process_group (Current) a_visitor.process_group (Current)
end end
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -1,19 +1,14 @@
note note
description : "[ description : "Error handler or receiver."
Error handler or receiver.
]"
legal: "See notice at end of class." legal: "See notice at end of class."
status: "See notice at end of class." status: "See notice at end of class."
date: "$Date: 2015-10-10 00:55:41 +0200 (sam., 10 oct. 2015) $" date: "$Date$"
revision: "$Revision: 97980 $" revision: "$Revision$"
class class
ERROR_HANDLER ERROR_HANDLER
inherit inherit
ANY
DEBUG_OUTPUT DEBUG_OUTPUT
create create
@@ -46,7 +41,7 @@ feature -- Access
-- Optional identifier for Current handler. -- Optional identifier for Current handler.
primary_error_code: INTEGER primary_error_code: INTEGER
-- Code of first error in `errors' -- Code of first error in `errors'.
require require
at_least_one_error: has_error at_least_one_error: has_error
do do
@@ -62,7 +57,7 @@ feature -- Status
end end
count: INTEGER count: INTEGER
-- Number of error -- Number of error.
do do
Result := errors.count Result := errors.count
end end
@@ -83,7 +78,7 @@ feature -- Status
feature {ERROR_HANDLER, ERROR_VISITOR} -- Restricted access feature {ERROR_HANDLER, ERROR_VISITOR} -- Restricted access
errors: LIST [ERROR] errors: LIST [ERROR]
-- Errors container -- Errors container.
feature -- Status report feature -- Status report
@@ -119,12 +114,12 @@ feature -- Status report
feature -- Events feature -- Events
error_added_actions: ACTION_SEQUENCE [TUPLE [ERROR]] error_added_actions: ACTION_SEQUENCE [TUPLE [ERROR]]
-- Actions triggered when a new error is added -- Actions triggered when a new error is added.
feature -- Synchronization feature -- Synchronization
add_synchronization (h: ERROR_HANDLER) add_synchronization (h: ERROR_HANDLER)
-- Add synchronization between `h' and `Current' -- Add synchronization between `h' and `Current`.
--| the same handler can be added more than once --| the same handler can be added more than once
--| it will be synchronized only once --| it will be synchronized only once
do do
@@ -133,7 +128,7 @@ feature -- Synchronization
end end
remove_synchronization (h: ERROR_HANDLER) remove_synchronization (h: ERROR_HANDLER)
-- Remove synchronization between `h' and `Current' -- Remove synchronization between `h' and `Current'.
do do
remove_propagation (h) remove_propagation (h)
h.remove_propagation (Current) h.remove_propagation (Current)
@@ -347,7 +342,7 @@ feature {NONE} -- Event: implementation
end end
on_reset on_reset
-- `reset' was just called -- `reset' was just called.
local local
sync_list: detachable ARRAYED_LIST [ERROR_HANDLER] sync_list: detachable ARRAYED_LIST [ERROR_HANDLER]
lst: detachable LIST [ERROR_HANDLER] lst: detachable LIST [ERROR_HANDLER]
@@ -389,7 +384,7 @@ feature {NONE} -- Event: implementation
feature -- Basic operation feature -- Basic operation
add_error (a_error: ERROR) add_error (a_error: ERROR)
-- Add `a_error' to the stack of error -- Add `a_error' to the stack of error.
do do
errors.force (a_error) errors.force (a_error)
on_error_added (a_error) on_error_added (a_error)
@@ -406,28 +401,22 @@ feature -- Basic operation
end end
add_error_details, add_custom_error (a_code: INTEGER; a_name: STRING; a_message: detachable READABLE_STRING_GENERAL) add_error_details, add_custom_error (a_code: INTEGER; a_name: STRING; a_message: detachable READABLE_STRING_GENERAL)
-- Add custom error to the stack of error -- Add custom error to the stack of error.
local
e: ERROR_CUSTOM
do do
create e.make (a_code, a_name, a_message) add_error (create {ERROR_CUSTOM}.make (a_code, a_name, a_message))
add_error (e)
end end
append (other: ERROR_HANDLER) append (other: ERROR_HANDLER)
-- Append errors from `a_err_handler' -- Append errors from `a_err_handler'.
local local
other_errs: LIST [ERROR] other_errs: LIST [ERROR]
do do
other_errs := other.errors other_errs := other.errors
if other_errs.count > 0 then if other_errs /= errors and then other_errs.count > 0 then
from across
other_errs.start other_errs as e
until
other_errs.after
loop loop
add_error (other_errs.item) add_error (e.item)
other_errs.forth
end end
end end
ensure ensure
@@ -435,7 +424,7 @@ feature -- Basic operation
new_count: count = old count + other.count new_count: count = old count + other.count
end end
feature -- Access feature -- Conversion
as_single_error: detachable ERROR as_single_error: detachable ERROR
-- All error(s) concatenated into one single error. -- All error(s) concatenated into one single error.
@@ -465,7 +454,7 @@ feature -- Access
feature -- Element changes feature -- Element changes
concatenate concatenate
-- Concatenate into a single error if any -- Concatenate into a single error if any.
do do
if count > 1 and then attached as_single_error as e then if count > 1 and then attached as_single_error as e then
reset reset
@@ -516,7 +505,7 @@ invariant
propagators_not_empty: attached propagators as lst implies not lst.is_empty propagators_not_empty: attached propagators as lst implies not lst.is_empty
note note
copyright: "2011-2016, Jocelyn Fiat, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -25,19 +25,16 @@ feature -- Access
process_group (g: ERROR_GROUP) process_group (g: ERROR_GROUP)
do do
if attached g.sub_errors as err then if attached g.sub_errors as err then
from across
err.start err as e
until
err.after
loop loop
process_error (err.item) process_error (e.item)
err.forth
end end
end end
end end
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -16,7 +16,7 @@ inherit
create create
make make
feature -- Initialization feature {NONE} -- Creation
make (f: like file) make (f: like file)
require require
@@ -32,7 +32,7 @@ feature -- Access
feature -- Output feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL) output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string -- Output Unicode string.
do do
if a_str /= Void then if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output") to_implement ("Convert into UTF-8 or console encoding before output")
@@ -51,7 +51,7 @@ feature -- Output
end end
note note
copyright: "2011-2012, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -14,12 +14,12 @@ inherit
feature -- Output feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL) output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string -- Output Unicode string.
deferred deferred
end end
output_any (obj: detachable ANY) output_any (obj: detachable ANY)
-- Output Unicode string -- Output Unicode string.
do do
if attached {READABLE_STRING_GENERAL} obj as l_str then if attached {READABLE_STRING_GENERAL} obj as l_str then
to_implement ("Convert into UTF-8 or console encoding before output") to_implement ("Convert into UTF-8 or console encoding before output")
@@ -42,6 +42,7 @@ feature -- Output
feature -- Process feature -- Process
process_error (e: ERROR) process_error (e: ERROR)
-- <Precursor>
do do
output_string ({STRING_32}"Error Name: ") output_string ({STRING_32}"Error Name: ")
output_string (e.name) output_string (e.name)
@@ -54,6 +55,7 @@ feature -- Process
end end
process_custom (e: ERROR_CUSTOM) process_custom (e: ERROR_CUSTOM)
-- <Precursor>
do do
output_string ({STRING_32}"Error Name: ") output_string ({STRING_32}"Error Name: ")
output_string (e.name) output_string (e.name)
@@ -66,22 +68,19 @@ feature -- Process
end end
process_group (g: ERROR_GROUP) process_group (g: ERROR_GROUP)
-- <Precursor>
local local
l_errors: LIST [ERROR] l_errors: LIST [ERROR]
do do
from across
l_errors := g.sub_errors g.sub_errors as s
l_errors.start
until
l_errors.after
loop loop
l_errors.item.process (Current) s.item.process (Current)
l_errors.forth
end end
end end
note note
copyright: "Copyright (c) 1984-2011, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -16,7 +16,7 @@ inherit
create create
make make
feature -- Initialization feature {NONE} -- Creation
make (buf: like buffer) make (buf: like buffer)
require require
@@ -32,7 +32,7 @@ feature -- Access
feature -- Output feature -- Output
output_string (a_str: detachable READABLE_STRING_GENERAL) output_string (a_str: detachable READABLE_STRING_GENERAL)
-- Output Unicode string -- Output Unicode string.
do do
if a_str /= Void then if a_str /= Void then
to_implement ("Convert into UTF-8 or console encoding before output") to_implement ("Convert into UTF-8 or console encoding before output")
@@ -51,7 +51,7 @@ feature -- Output
end end
note note
copyright: "2011-2012, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software