File: Content.h

package info (click to toggle)
storm-lang 0.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 52,004 kB
  • sloc: ansic: 261,462; cpp: 140,405; sh: 14,891; perl: 9,846; python: 2,525; lisp: 2,504; asm: 860; makefile: 678; pascal: 70; java: 52; xml: 37; awk: 12
file content (102 lines) | stat: -rw-r--r-- 2,133 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#pragma once
#include "Compiler/NamedThread.h"
#include "Compiler/Template.h"
#include "Compiler/Visibility.h"
#include "Decl.h"

namespace storm {
	namespace bs {
		STORM_PKG(lang.bs);

		class UseThreadDecl;


		/**
		 * Content of a single source file.
		 */
		class Content : public ObjectOn<Compiler> {
			STORM_CLASS;
		public:
			STORM_CTOR Content();

			// Add a type.
			void STORM_FN add(Type *type);

			// Add a declaration of a named entity.
			void STORM_FN add(NamedDecl *fn);

			// Add a named thread.
			void STORM_FN add(NamedThread *thread);

			// Add a template of some kind.
			void STORM_FN add(Template *templ);

			// Set the default access modifier.
			void STORM_FN add(Visibility *v);

			// Set the default thread for subsequent entries.
			void STORM_FN add(UseThreadDecl *t);

			// Add either of the above types.
			void STORM_FN add(TObject *obj);

			// All types.
			Array<Type *> *types;

			// All declarations of named objects.
			Array<NamedDecl *> *decls;

			// All named threads.
			Array<NamedThread *> *threads;

			// All templates.
			Array<Template *> *templates;

			// Default access modifier.
			Visibility *defaultVisibility;

			// Default thread to use.
			MAYBE(SrcName *) defaultThread;

		private:
			// Apply visibility to named objects.
			void update(Named *named);
			void update(NamedDecl *fn);
		};


		/**
		 * Declaration that expands to multiple declarations.
		 *
		 * Used since it is not possible to pass Array<TObject *> directly to Content as it is an
		 * Object, not a TObject.
		 */
		class MultiDecl : public ObjectOn<Compiler> {
			STORM_CLASS;
		public:
			STORM_CTOR MultiDecl();
			STORM_CTOR MultiDecl(Array<TObject *> *data);

			Array<TObject *> *data;

			void STORM_FN push(TObject *v);
		};


		/**
		 * Declare that a specific thread should be applied to all functions/classes in this file.
		 */
		class UseThreadDecl : public ObjectOn<Compiler> {
			STORM_CLASS;
		public:
			STORM_CTOR UseThreadDecl(SrcName *name);

			// The name of the thread to use.
			SrcName *thread;

			// To string.
			void STORM_FN toS(StrBuf *to) const;
		};

	}
}