aboutsummaryrefslogtreecommitdiff
path: root/builtins/where.h
blob: 75de22a3c2eb3e3fa463866c3649558d41a0776d (plain)
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
#pragma once

// Type info and methods for Where datatype (Anywhere, Start, or End enum)
// Mainly used for text methods.

#include <gc/cord.h>
#include <stdbool.h>
#include <stdint.h>

#include "types.h"

typedef struct Where_s Where_t;
extern const TypeInfo Where;
typedef struct Where$Anywhere_s Where$Anywhere_t;
extern const TypeInfo Where$Anywhere;
typedef struct Where$Start_s Where$Start_t;
extern const TypeInfo Where$Start;
typedef struct Where$End_s Where$End_t;
extern const TypeInfo Where$End;

struct Where$Anywhere_s {};
struct Where$Start_s {};
struct Where$End_s {};
struct Where_s {
    enum { $tag$Where$Anywhere = 0, $tag$Where$Start = 1, $tag$Where$End = 2 } $tag;
    union {
        Where$Anywhere_t Anywhere;
        Where$Start_t Start;
        Where$End_t End;
    };
};

extern const Where_t Where$tagged$Anywhere;
extern const Where_t Where$tagged$Start;
extern const Where_t Where$tagged$End;

// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0