next up previous contents index
Next: How can I identificate Up: FAQ Previous: How can I apply

Why does the Undo button not works with my script ?

The undo functionnality is not automatic. You have to save explicitly an AST that contains the piece of code you will change. Look in the section 8.14 or in the following example that inserts a guard around the selected statement.

  
SCRIPT Guards_Inst ()
    // Get the selected statement
    stat := $cstat
    // Save a copy of the including AST (i.e. the parent)  
    Undo:Save(stat.PARENT,TRUE,TRUE)
    // Create the condition of the guard
    cond := CREATEEXP("MSGSIZE .ne. 0")
    // Create a conditonnal statement. 
    // Its body contains the selected statement.
    new_if := CREATE("struct_if", EMPTY, cond, CREATE("l_stat",stat), CREATE("l_stat"))
    stat <- new_if 
ENDSCRIPT



Yann Mevel
1999-04-30