source: tests/zombies/gc_no_raii/src/gcpointers.h @ ecaedf35

Last change on this file since ecaedf35 was fd54fef, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Converting the project to use the new syntax for otype, dtype and ttytpe.

Changed prelude (gen), libcfa and test suite to use it. Added a simple deprecation rule of the old syntax to the parser; we might wish to support both syntaxes "officially," like with an extra CLI switch, but this measure should serve as a simple reminder for our team to try the new syntax.

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[15db1ab]1#pragma once
2
[f1e42c1]3#include <stdbool.h>
[6be0cf9]4#include <stdint.h>
5
[fd54fef]6forall(T &)
[46f1d20]7struct gcpointer;
8
[15db1ab]9struct gcpointer_t
10{
[6be0cf9]11        intptr_t ptr;
[15db1ab]12        struct gcpointer_t* next;
13};
14
[bee4283]15void ?{}(gcpointer_t* this);
16void ?{}(gcpointer_t* this, void* address);
17void ?{}(gcpointer_t* this, gcpointer_t other);
18void ^?{}(gcpointer_t* this);
[46f1d20]19gcpointer_t ?=?(gcpointer_t* this, gcpointer_t rhs);
[15db1ab]20
21//Logical operators
[f1e42c1]22bool gcpointer_equal(gcpointer_t* this, gcpointer_t* rhs);
23bool gcpointer_not_equal(gcpointer_t* this, gcpointer_t* rhs);
[4c1403c]24bool gcpointer_null(const gcpointer_t* this);
25
26
27#ifndef NDEBUG
28        bool is_valid(const gcpointer_t* this);
29#endif
[f1e42c1]30
[fd54fef]31forall(T &)
[f1e42c1]32struct gcpointer
33{
34        gcpointer_t internal;
35};
36
[bee4283]37//
[fd54fef]38forall(T) void ?{}(gcpointer(T)* this);
39forall(T) void ?{}(gcpointer(T)* this, void* address);
40forall(T) void ?{}(gcpointer(T)* this, gcpointer(T) other);
41forall(T) void ^?{}(gcpointer(T)* this);
42forall(T) gcpointer(T) ?=?(gcpointer(T)* this, gcpointer(T) rhs);
[f1e42c1]43
44
[46f1d20]45// forall(otype T) T *?(gcpointer(T) this);
[fd54fef]46forall(T) T* get(gcpointer(T)* this);
[f1e42c1]47
48//Logical operators
[fd54fef]49forall(T) int ?!=?(gcpointer(T) this, int zero);
50forall(T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs);
51forall(T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
Note: See TracBrowser for help on using the repository browser.