Update procedures
[shapes.git] / source / shapescore.h
blob9f5e12b34b8df537265368fb699e67d549df84b9
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2010, 2015 Henrik Tidefelt
19 #pragma once
21 #include <list>
22 #include <iostream>
23 #include <string>
25 #include "refcount.h"
26 #include "shapestypes.h"
29 namespace Shapes
31 namespace Lang
34 class CoreFunction : public Lang::Function
36 protected:
37 const Ast::PlacedIdentifier id_;
38 public:
39 CoreFunction( const RefCountPtr< const Ast::NamespacePath > & ns, const char * name );
40 CoreFunction( const RefCountPtr< const Ast::NamespacePath > & ns, const char * name, Kernel::EvaluatedFormals * formals );
41 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
42 virtual bool isTransforming( ) const;
43 const Ast::PlacedIdentifier & id( ) const;
44 virtual void show( std::ostream & os ) const;
45 virtual void gcMark( Kernel::GCMarkedSet & marked ){ };
48 class CoreMutator : public Lang::Function
50 protected:
51 const char * name_;
52 public:
53 CoreMutator( const char * name );
54 CoreMutator( const char * name, Kernel::EvaluatedFormals * formals );
55 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
56 virtual bool isTransforming( ) const;
57 const char * name( ) const;
58 virtual void show( std::ostream & os ) const;
59 virtual void gcMark( Kernel::GCMarkedSet & marked ){ };
63 /* This core function is declared here so that its static member function can be used from other files than coreconstruct.cc. */
64 class Core_range : public Lang::CoreFunction
66 public:
67 Core_range( const RefCountPtr< const Ast::NamespacePath > & ns, const char * name );
68 virtual void call( Kernel::EvalState * evalState, Kernel::Arguments & args, const Ast::SourceLocation & callLoc ) const;
69 static void makeRange( const RefCountPtr< const Interaction::CoreLocation > & coreLoc, Kernel::EvalState * evalState, Kernel::Arguments & args, const Ast::SourceLocation & callLoc, bool isSpan = false, RefCountPtr< const Lang::Value > last = RefCountPtr< const Lang::Value >( NullPtr< const Lang::Value >( ) ) );