ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtutil.h
(Generate patch)

Comparing rxvt-unicode/src/rxvtutil.h (file contents):
Revision 1.61 by sf-exg, Mon Nov 10 12:14:48 2014 UTC vs.
Revision 1.65 by sf-exg, Thu May 13 19:40:20 2021 UTC

1#ifndef RXVT_UTIL_H 1#ifndef RXVT_UTIL_H
2#define RXVT_UTIL_H 2#define RXVT_UTIL_H
3 3
4#include <new>
5#include <stdlib.h> 4#include <stdlib.h>
6#include <string.h> 5#include <string.h>
6
7#define ECB_NO_THREADS 1
7#include "ecb.h" 8#include "ecb.h"
9
8#include "estl.h" 10#include "estl.h"
9 11
10#include "emman.h" 12#include "emman.h"
11
12// increases code size unless -fno-enforce-eh-specs
13#if __GNUC__
14# define NOTHROW
15# define THROW(x)
16#else
17# define NOTHROW throw()
18# define THROW(x) throw x
19#endif
20 13
21// various utility functions 14// various utility functions
22template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; } 15template<typename T, typename U> static inline void min_it (T &a, U b) { a = a < (T)b ? a : (T)b; }
23template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; } 16template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > (T)b ? a : (T)b; }
24 17
25template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } 18template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
26template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; } 19template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; }
27
28template<typename T> static inline T squared_diff (T a, T b) { return (a - b) * (a - b); }
29 20
30// linear interpolation 21// linear interpolation
31template<typename T, typename U, typename P> 22template<typename T, typename U, typename P>
32static inline T 23static inline T
33lerp (T a, U b, P p) 24lerp (T a, U b, P p)
61{ 52{
62 void *operator new (size_t s); 53 void *operator new (size_t s);
63 void operator delete (void *p, size_t s); 54 void operator delete (void *p, size_t s);
64}; 55};
65 56
66// alas new/delete cannot be specified as inline in C++11 (see 17.6.4.6)
67void *operator new (size_t s) throw (std::bad_alloc);
68void operator delete (void *p) throw ();
69
70struct stringvec : simplevec<char *> 57struct stringvec : simplevec<char *>
71{ 58{
72 ~stringvec () 59 ~stringvec ()
73 { 60 {
74 for (char **c = begin (); c != end (); c++) 61 for (char **c = begin (); c != end (); c++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines