[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ctedit Selections




In article <44442@sophia.inria.fr>, kuehne@isa.informatik.th-darmstadt.de (Thomas Kuehne) writes:

|> I have a rule looking like:
|> 
|>   CALC(Arg -> Result) &
|>   redisplay(subject, "high")
|>   ------
|>   opa(Arg) -> opb(Result, subject);
|> 
|> The code for 'high' is:
|> 
|> (de high (path)
|>   (let ((ctedit {SLOTOS}:lotos_ctedit)
|>        )
|>     ({ctedit}:update-tree ctedit '{prefsel} path)
|>     ({ctedit}:scroll-to-selection  ctedit '{prefsel})
|>     ({ctedit}:incremental-redisplay ctedit)
|>   )
|> )
|> 
|> This runs fine.
|> 
|> My problem is that I do not want to show the selections during execution,
|> but later when execution has terminated 
|> (redisplay ist just used for experiments).
|> 
|> That is why the 'subject' is part of the result of the above TYPOL rule.
|> The result of the TYPOL program is stored in another ctedit x and by clicking at
|> an item in the ctedit x I want to highlight the path,
|> stored in the selected item, in the other ctedit y.
|> 
|> I know that 'redisplay' performs a
|>   $psp_to_lisp and
|>   $psp_eval
|> in order to convert the TYPOL psp path to the type (Tree) used by the lisp 
|> function 'high'.
|> 
|> 
|> Now:
|> 
|> When the result of the TYPOL program is returned to the LISP world
|> it is converted, including the path.
|> 
|> The path now has a type X different to the PSP type in TYPOL
|> 
|>   o which i do not know
|>   o which i do not know how to convert to the type resulting from
|>     the transformation: type_of(subject) -> psp_to_lisp -> psp_eval -> Tree
|> 
|> 
|> ? What conversions function do I need to apply to the part of the result
|> ? of the TYPOL program, that contains the path (subject)?
|> 

When you return a path from Typol it is coerced into a VTP object. This tree
may be "interpreted". The following function will help you. It takes a VTP tree
(a path coming from Typol that must be normalized), a root (the root of the tree
in a ctedit for example) and apply the path to the root, returning the designated
tree. And you can put a selection on this tree.

Notice that you must normalize the path before putting it in your result:
CALC(Arg -> Result) &
   redisplay(subject, "high")
   ------
   opa(Arg) -> opb(Result, subject'); 
                           provided normalize(subject, subject');

and you must supply a root because the root used during the Typol execution
(the infamous typol-object) is not still valid.

(defun #:PSP:interp_with_root (path root)
;----------------------
;given a VTP PSP normalized path,and a root,
; returns the designated tree
 
    (let* ((opname ({operator}:name ({tree}:operator path))))
          (selectq opname
              (int
                  (#:PSP:number_integer
                      ({number}:name ({tree}:atom_value path))))
              ((s e)
                  ({tree}:down
                      (#:PSP:interp_with_root ({tree}:down path 1) root)
                      (#:PSP:interp_with_root ({tree}:down path 2) root)))
              (n (#:PSP:interp_with_root ({tree}:down path 1) root))
              (nil ())
              ((lisp cons obj) root)
              (t (print "#:PSP:interp_with_root: undefined case")))))



(defun #:PSP:number_integer (digits)
; ----------------------------
 
    (let ((l (slen digits)))
         (stratom l digits ())))


Thierry.

-- 
Send contributions and compliments to centaur@sophia.inria.fr. Registration
and administrative matters should be sent to centaur-request@sophia.inria.fr.
+---------------------------------------------------------------------------+
|     Thierry Despeyroux      | email: Thierry.Despeyroux@sophia.inria.fr   |
| I.N.R.I.A. Sophia-Antipolis | phone: +33 93 65 77 07 fax: +33 93 65 77 66 |
+---------------------------------------------------------------------------+