1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. with Objects;                           use Objects; 
  10. with Scripting.Statements;              use Scripting.Statements; 
  11.  
  12. package Scripting.Scripts is 
  13.  
  14.     -- A Script is an executable series of Statements. It does not return a 
  15.     -- a value, so evaluation doesn't return a result. 
  16.     type Script is new Limited_Object with private; 
  17.     type A_Script is access all Script'Class; 
  18.  
  19.     -- Creates a new empty Script. 
  20.     function Create_Script return A_Script; 
  21.     pragma Postcondition( Create_Script'Result /= null ); 
  22.  
  23.     -- Evaluates/executes the script. Evaluation_Exception will be raised if an 
  24.     -- error occurs. 
  25.     procedure Evaluate( this    : access Script; 
  26.                         context : not null A_Eval_Context ); 
  27.  
  28.     -- Sets the statements in the script. Each will be evaluated in order, when 
  29.     -- the script is evaluated. 'statements' will be consumed. 
  30.     procedure Set_Statements( this       : not null access Script'Class; 
  31.                               statements : in out Statement_Lists.List ); 
  32.  
  33.     -- Deletes the Script. 
  34.     procedure Delete( this : in out A_Script ); 
  35.     pragma Postcondition( this = null ); 
  36.  
  37. private 
  38.  
  39.     type Script is new Limited_Object with 
  40.         record 
  41.             statements : Statement_Lists.List; 
  42.         end record; 
  43.  
  44.     procedure Delete( this : in out Script ); 
  45.  
  46. end Scripting.Scripts;