From 07e5441b14984a6ee9cbf78719ba7edf62cf98cb Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 6 Jan 2008 12:13:44 -0400 Subject: [PATCH] Definition protocol cleanup --- core/classes/mixin/mixin.factor | 7 +----- core/generic/standard/standard.factor | 4 ++++ core/prettyprint/prettyprint.factor | 27 ++++++++++++++--------- extra/help/definitions/definitions.factor | 4 ++-- extra/locals/locals.factor | 10 +++++---- 5 files changed, 29 insertions(+), 23 deletions(-) mode change 100644 => 100755 core/generic/standard/standard.factor diff --git a/core/classes/mixin/mixin.factor b/core/classes/mixin/mixin.factor index 05d74b64c3..847cce30bf 100755 --- a/core/classes/mixin/mixin.factor +++ b/core/classes/mixin/mixin.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: classes classes.union words kernel sequences -definitions prettyprint.backend combinators arrays ; +definitions combinators arrays ; IN: classes.mixin PREDICATE: union-class mixin-class "mixin" word-prop ; @@ -64,11 +64,6 @@ M: mixin-instance where mixin-instance-loc ; M: mixin-instance set-where set-mixin-instance-loc ; -M: mixin-instance synopsis* - \ INSTANCE: pprint-word - dup mixin-instance-class pprint-word - mixin-instance-mixin pprint-word ; - M: mixin-instance definer drop \ INSTANCE: f ; M: mixin-instance definition drop f ; diff --git a/core/generic/standard/standard.factor b/core/generic/standard/standard.factor old mode 100644 new mode 100755 index 75385b1685..45ecf7a031 --- a/core/generic/standard/standard.factor +++ b/core/generic/standard/standard.factor @@ -182,3 +182,7 @@ M: standard-combination dispatch# standard-combination-# ; M: hook-combination dispatch# drop 0 ; M: simple-generic definer drop \ GENERIC: f ; + +M: standard-generic definer drop \ GENERIC# f ; + +M: hook-generic definer drop \ HOOK: f ; diff --git a/core/prettyprint/prettyprint.factor b/core/prettyprint/prettyprint.factor index c0ce3b45bd..0fcc6edab9 100755 --- a/core/prettyprint/prettyprint.factor +++ b/core/prettyprint/prettyprint.factor @@ -146,39 +146,44 @@ GENERIC: see ( defspec -- ) : seeing-word ( word -- ) word-vocabulary pprinter-in set ; +: definer. ( defspec -- ) + definer drop pprint-word ; + : stack-effect. ( word -- ) dup parsing? over symbol? or not swap stack-effect and [ effect>string comment. ] when* ; -: word-synopsis ( word name -- ) +: word-synopsis ( word -- ) dup seeing-word - over definer drop pprint-word - pprint-word + dup definer. + dup pprint-word stack-effect. ; -M: word synopsis* - dup word-synopsis ; +M: word synopsis* word-synopsis ; -M: simple-generic synopsis* - dup word-synopsis ; +M: simple-generic synopsis* word-synopsis ; M: standard-generic synopsis* + dup definer. dup seeing-word - \ GENERIC# pprint-word dup pprint-word dup dispatch# pprint* stack-effect. ; M: hook-generic synopsis* + dup definer. dup seeing-word - \ HOOK: pprint-word dup pprint-word dup "combination" word-prop hook-combination-var pprint-word stack-effect. ; M: method-spec synopsis* - dup definer drop pprint-word - [ pprint-word ] each ; + dup definer. [ pprint-word ] each ; + +M: mixin-instance synopsis* + dup definer. + dup mixin-instance-class pprint-word + mixin-instance-mixin pprint-word ; M: pathname synopsis* pprint* ; diff --git a/extra/help/definitions/definitions.factor b/extra/help/definitions/definitions.factor index eee2bcd19c..559acf3919 100755 --- a/extra/help/definitions/definitions.factor +++ b/extra/help/definitions/definitions.factor @@ -17,7 +17,7 @@ M: link forget link-name remove-article ; M: link definition article-content ; M: link synopsis* - \ ARTICLE: pprint-word + dup definer. dup link-name pprint* article-title pprint* ; @@ -30,7 +30,7 @@ M: word-link set-where link-name swap "help-loc" set-word-prop ; M: word-link definition link-name "help" word-prop ; M: word-link synopsis* - \ HELP: pprint-word + dup definer. link-name dup pprint-word stack-effect. ; diff --git a/extra/locals/locals.factor b/extra/locals/locals.factor index 688507be78..7ac36745f9 100755 --- a/extra/locals/locals.factor +++ b/extra/locals/locals.factor @@ -314,14 +314,16 @@ M: lambda-word definer drop \ :: \ ; ; M: lambda-word definition "lambda" word-prop lambda-body ; -: lambda-word-synopsis ( word prop definer -- ) - pick seeing-word pprint-word over pprint-word +: lambda-word-synopsis ( word prop -- ) + over definer. + over seeing-word + over pprint-word \ | pprint-word word-prop lambda-vars pprint-vars \ | pprint-word ; M: lambda-word synopsis* - "lambda" \ :: lambda-word-synopsis ; + "lambda" lambda-word-synopsis ; PREDICATE: macro lambda-macro "lambda-macro" word-prop >boolean ; @@ -332,6 +334,6 @@ M: lambda-macro definition "lambda-macro" word-prop lambda-body ; M: lambda-macro synopsis* - "lambda-macro" \ MACRO:: lambda-word-synopsis ; + "lambda-macro" lambda-word-synopsis ; PRIVATE>