source: libcfa/src/prelude-inline.cfa @ 10b5970

Last change on this file since 10b5970 was 4f4ae60, checked in by Andrew Beach <ajbeach@…>, 4 weeks ago

Added prelude-inline.cfa to the standard library. This should now have the single copy of many functions defined in the prelude.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// prelude-inline.cfa -- Create the external prelude definitions.
8//
9// Author           : Andrew Beach
10// Created On       : Thu Dec 19  9:40:00 2024
11// Last Modified By : Andrew Beach
12// Created On       : Thu Dec 23 14:01:00 2024
13// Update Count     : 0
14//
15
16// There are:
17// 1.  No includes, because everything should be in the prelude somewhere.
18// 2.  No bodies, because those are also in the prelude for inlining.
19//
20// In C99 inline is used to mark functions that are avalible for inlining but
21// do not belong to the current translation unit, so no definition will be
22// inluded. The declarations in this file say that they do belong to this
23// translation unit. Uses of these features that were not inlined will refer
24// to these declarations are standard library functions.
25
26#pragma GCC visibility push(default)
27
28forall( T & )
29extern inline void ^?{}( __Destructor(T) & x );
30
31forall( T & )
32extern inline T & identity( T & i );
33
34extern inline void  ?{}( generator$ & this );
35extern inline void ^?{}( generator$ & );
36
37forall( T & | is_generator( T ) )
38extern inline T & resume( T & gen );
39
40extern inline {
41        forall( T& | is_value(T) | { T ?+=?( T &, one_t ); } )
42        T ++?( T & x );
43
44        forall( T& | is_value(T) | { T ?+=?( T &, one_t ); } )
45        T ?++( T & x );
46
47        forall( T& | is_value(T) | { T ?-=?( T &, one_t ); } )
48        T --?( T & x );
49
50        forall( T& | is_value(T) | { T ?-=?( T &, one_t ); } )
51        T ?--( T & x );
52
53        forall( T& | is_value(T) | { int ?!=?( T, zero_t ); } )
54        int !?( T & x );
55} // distribution
56
57
58#if defined(__SIZEOF_INT128__)
59extern inline void ?{}( unsigned int128 & this, unsigned long int h, unsigned long int l );
60#endif // __SIZEOF_INT128__
61
62extern inline {
63        float ?\?( float x, float y );
64        double ?\?( double x, double y );
65        long double ?\?( long double x, long double y );
66        float _Complex ?\?( float _Complex x, _Complex float y );
67        double _Complex ?\?( double _Complex x, _Complex double y );
68        long double _Complex ?\?( long double _Complex x, _Complex long double y );
69} // distribution
70
71extern inline {
72        int ?\=?( int & x, unsigned int y );
73        long int ?\=?( long int & x, unsigned long int y );
74        long long int ?\=?( long long int & x, unsigned long long int y );
75        unsigned int ?\=?( unsigned int & x, unsigned int y );
76        unsigned long int ?\=?( unsigned long int & x, unsigned long int y );
77        unsigned long long int ?\=?( unsigned long long int & x, unsigned long long int y );
78} // distribution
79
80extern inline
81forall( E | Serial( E ) ) {
82        E fromInt( int i );
83        E succ( E e );
84        E pred( E e );
85        int Countof( E );
86}
87
88extern inline
89forall( E | CfaEnum( E ) ) {
90        int ?==?( E l, E r );
91        int ?!=?( E l, E r );
92        int ?<?( E l, E r );
93        int ?<=?( E l, E r );
94        int ?>?( E l, E r );
95        int ?>=?( E l, E r );
96}
97
98extern inline
99forall( E | Serial( E ) ) {
100        E ?+=?( E & l, one_t );
101        E ?-=?( E & l, one_t );
102        E ?+=?( E & l, int i );
103        E ?-=?( E & l, int i );
104}
Note: See TracBrowser for help on using the repository browser.