openMSX
MSXDevice.cc
Go to the documentation of this file.
1 #include "MSXDevice.hh"
2 #include "XMLElement.hh"
3 #include "MSXMotherBoard.hh"
4 #include "HardwareConfig.hh"
6 #include "MSXCPUInterface.hh"
7 #include "MSXCPU.hh"
8 #include "CacheLine.hh"
9 #include "TclObject.hh"
10 #include "Math.hh"
11 #include "MSXException.hh"
12 #include "one_of.hh"
13 #include "ranges.hh"
14 #include "serialize.hh"
15 #include "stl.hh"
16 #include "unreachable.hh"
17 #include "view.hh"
18 #include "xrange.hh"
19 #include <cassert>
20 #include <cstring>
21 #include <iterator> // for back_inserter
22 
23 using std::string;
24 
25 namespace openmsx {
26 
27 MSXDevice::MSXDevice(const DeviceConfig& config, const string& name)
28  : deviceConfig(config)
29 {
30  initName(name);
31 }
32 
34  : deviceConfig(config)
35 {
36  initName(getDeviceConfig().getAttribute("id"));
37 }
38 
39 void MSXDevice::initName(const string& name)
40 {
41  deviceName = name;
42  if (getMotherBoard().findDevice(deviceName)) {
43  unsigned n = 0;
44  do {
45  deviceName = strCat(name, " (", ++n, ')');
46  } while (getMotherBoard().findDevice(deviceName));
47  }
48 }
49 
51 {
52  staticInit();
53 
54  lockDevices();
55  registerSlots();
56  registerPorts();
57 }
58 
60 {
61  unregisterPorts();
62  unregisterSlots();
63  unlockDevices();
64  assert(referencedBy.empty());
65 }
66 
67 void MSXDevice::staticInit()
68 {
69  static bool alreadyInit = false;
70  if (alreadyInit) return;
71  alreadyInit = true;
72 
73  memset(unmappedRead, 0xFF, sizeof(unmappedRead));
74 }
75 
77 {
79 }
80 
81 void MSXDevice::testRemove(span<const std::unique_ptr<MSXDevice>> removed) const
82 {
83  // Typically 'referencedBy' contains very few elements, so a simple
84  // O(n*m) algorithm is fine.
85  std::string err;
86  for (const auto* dev : referencedBy) {
87  if (ranges::none_of(removed, [&](const auto& d) { return d.get() == dev; })) {
88  strAppend(err, ' ', dev->getName());
89  }
90  }
91  if (!err.empty()) {
92  throw MSXException("Still in use by:", err);
93  }
94 }
95 
96 void MSXDevice::lockDevices()
97 {
98  // This code can only handle backward references: the thing that is
99  // referenced must already be instantiated, we don't try to change the
100  // instantiation order. For the moment this is good enough (only ADVRAM
101  // (an extension) uses it to refer to the VDP (inside a machine)). If
102  // needed we can implement something more sophisticated later without
103  // changing the format of the config files.
104  for (auto& c : getDeviceConfig().getChildren("device")) {
105  const auto& name = c->getAttribute("idref");
106  auto* dev = getMotherBoard().findDevice(name);
107  if (!dev) {
108  throw MSXException(
109  "Unsatisfied dependency: '", getName(),
110  "' depends on unavailable device '",
111  name, "'.");
112  }
113  references.push_back(dev);
114  dev->referencedBy.push_back(this);
115  }
116 }
117 
118 void MSXDevice::unlockDevices()
119 {
120  for (auto& r : references) {
121  move_pop_back(r->referencedBy, rfind_unguarded(r->referencedBy, this));
122  }
123 }
124 
126 {
127  // init() must already be called
128  return references;
129 }
130 
131 EmuTime::param MSXDevice::getCurrentTime() const
132 {
133  return getMotherBoard().getCurrentTime();
134 }
136 {
137  return getMotherBoard().getCPU();
138 }
140 {
141  return getMotherBoard().getCPUInterface();
142 }
144 {
145  return getMotherBoard().getScheduler();
146 }
148 {
149  return getMotherBoard().getMSXCliComm();
150 }
152 {
153  return getMotherBoard().getReactor();
154 }
156 {
158 }
160 {
161  return getMotherBoard().getLedStatus();
162 }
164 {
166 }
167 
168 void MSXDevice::registerSlots()
169 {
170  MemRegions tmpMemRegions;
171  unsigned align = getBaseSizeAlignment();
172  assert(Math::ispow2(align));
173  for (auto& m : getDeviceConfig().getChildren("mem")) {
174  unsigned base = m->getAttributeAsInt("base");
175  unsigned size = m->getAttributeAsInt("size");
176  if ((base >= 0x10000) || (size > 0x10000) || ((base + size) > 0x10000)) {
177  throw MSXException(
178  "Invalid memory specification for device ",
179  getName(), " should be in range "
180  "[0x0000,0x10000).");
181  }
182  if (((base & (align - 1)) || (size & (align - 1))) &&
183  !allowUnaligned()) {
184  throw MSXException(
185  "invalid memory specification for device ",
186  getName(), " should be aligned on at least 0x",
187  hex_string<4>(align), '.');
188  }
189  tmpMemRegions.emplace_back(base, size);
190  }
191  if (tmpMemRegions.empty()) {
192  return;
193  }
194 
195  // find primary and secondary slot specification
196  auto& slotManager = getMotherBoard().getSlotManager();
197  auto* primaryConfig = getDeviceConfig2().getPrimary();
198  auto* secondaryConfig = getDeviceConfig2().getSecondary();
199  if (primaryConfig) {
200  ps = slotManager.getSlotNum(primaryConfig->getAttribute("slot"));
201  } else {
202  throw MSXException("Invalid memory specification");
203  }
204  if (secondaryConfig) {
205  const auto& ss_str = secondaryConfig->getAttribute("slot");
206  ss = slotManager.getSlotNum(ss_str);
207  if ((-16 <= ss) && (ss <= -1) && (ss != ps)) {
208  throw MSXException(
209  "Invalid secondary slot specification: \"",
210  ss_str, "\".");
211  }
212  } else {
213  ss = 0;
214  }
215 
216  // This is only for backwards compatibility: in the past we added extra
217  // attributes "primary_slot" and "secondary_slot" (in each MSXDevice
218  // config) instead of changing the 'any' value of the slot attribute of
219  // the (possibly shared) <primary> and <secondary> tags. When loading
220  // an old savestate these tags can still occur, so keep this code. Also
221  // remove these attributes to convert to the new format.
222  const auto& config = getDeviceConfig();
223  if (config.hasAttribute("primary_slot")) {
224  auto& mutableConfig = const_cast<XMLElement&>(config);
225  const auto& primSlot = config.getAttribute("primary_slot");
226  ps = slotManager.getSlotNum(primSlot);
227  mutableConfig.removeAttribute("primary_slot");
228  if (config.hasAttribute("secondary_slot")) {
229  const auto& secondSlot = config.getAttribute("secondary_slot");
230  ss = slotManager.getSlotNum(secondSlot);
231  mutableConfig.removeAttribute("secondary_slot");
232  }
233  }
234 
235  // decode special values for 'ss'
236  if ((-128 <= ss) && (ss < 0)) {
237  if ((0 <= ps) && (ps < 4) &&
238  getCPUInterface().isExpanded(ps)) {
239  ss += 128;
240  } else {
241  ss = 0;
242  }
243  }
244 
245  // decode special values for 'ps'
246  if (ps == -256) {
247  slotManager.getAnyFreeSlot(ps, ss);
248  } else if (ps < 0) {
249  // specified slot by name (carta, cartb, ...)
250  slotManager.getSpecificSlot(-ps - 1, ps, ss);
251  } else {
252  // numerical specified slot (0, 1, 2, 3)
253  }
254  assert((0 <= ps) && (ps <= 3));
255 
256  if (!getCPUInterface().isExpanded(ps)) {
257  ss = -1;
258  }
259 
260  // Store actual slot in config. This has two purposes:
261  // - Make sure that devices that are grouped under the same
262  // <primary>/<secondary> tags actually use the same slot. (This
263  // matters when the value of some of the slot attributes is "any").
264  // - Fix the slot number so that it remains the same after a
265  // savestate/loadstate.
266  assert(primaryConfig);
267  primaryConfig->setAttribute("slot", strCat(ps));
268  if (secondaryConfig) {
269  string slot = (ss == -1) ? "X" : strCat(ss);
270  secondaryConfig->setAttribute("slot", std::move(slot));
271  } else {
272  if (ss != -1) {
273  throw MSXException(
274  "Missing <secondary> tag for device", getName());
275  }
276  }
277 
278  int logicalSS = (ss == -1) ? 0 : ss;
279  for (auto& r : tmpMemRegions) {
281  *this, ps, logicalSS, r.first, r.second);
282  memRegions.push_back(r);
283  }
284 
285  // Mark the slot as 'in-use' so that future searches for free external
286  // slots don't return this slot anymore. If the slot was not an
287  // external slot, this call has no effect. Multiple MSXDevices from the
288  // same extension (the same HardwareConfig) can all allocate the same
289  // slot (later they should also all free this slot).
290  slotManager.allocateSlot(ps, ss, getHardwareConfig());
291 }
292 
293 void MSXDevice::unregisterSlots()
294 {
295  if (memRegions.empty()) return;
296 
297  int logicalSS = (ss == -1) ? 0 : ss;
298  for (const auto& [base, size] : memRegions) {
300  *this, ps, logicalSS, base, size);
301  }
302 
303  // See comments above about allocateSlot() for more details:
304  // - has no effect for non-external slots
305  // - can be called multiple times for the same slot
307 }
308 
309 void MSXDevice::getVisibleMemRegion(unsigned& base, unsigned& size) const
310 {
311  // init() must already be called
312  if (memRegions.empty()) {
313  base = 0;
314  size = 0;
315  return;
316  }
317 
318  auto lowest = min_value(view::transform(memRegions,
319  [](auto& r) { return r.first; }));
320  auto highest = max_value(view::transform(memRegions,
321  [](auto& r) { return r.first + r.second; }));
322  assert(lowest <= highest);
323  base = lowest;
324  size = highest - lowest;
325 }
326 
327 void MSXDevice::registerPorts()
328 {
329  for (auto& i : getDeviceConfig().getChildren("io")) {
330  unsigned base = i->getAttributeAsInt("base");
331  unsigned num = i->getAttributeAsInt("num");
332  const auto& type = i->getAttribute("type", "IO");
333  if (((base + num) > 256) || (num == 0) ||
334  (type != one_of("I", "O", "IO"))) {
335  throw MSXException("Invalid IO port specification");
336  }
337  for (auto port : xrange(base, base + num)) {
338  if (type == one_of("I", "IO")) {
339  getCPUInterface().register_IO_In(port, this);
340  inPorts.push_back(port);
341  }
342  if (type == one_of("O", "IO")) {
343  getCPUInterface().register_IO_Out(port, this);
344  outPorts.push_back(port);
345  }
346  }
347  }
348 }
349 
350 void MSXDevice::unregisterPorts()
351 {
352  for (auto& p : inPorts) {
354  }
355  for (auto& p : outPorts) {
357  }
358 }
359 
360 
361 void MSXDevice::reset(EmuTime::param /*time*/)
362 {
363  // nothing
364 }
365 
367 {
368  return 0xFF;
369 }
370 
371 void MSXDevice::powerDown(EmuTime::param /*time*/)
372 {
373  // nothing
374 }
375 
376 void MSXDevice::powerUp(EmuTime::param time)
377 {
378  reset(time);
379 }
380 
381 string MSXDevice::getName() const
382 {
383  return deviceName;
384 }
385 
387 {
388  result.addListElement(getName());
389 }
390 
392 {
393  result.addDictKeyValue("type", getDeviceConfig().getName());
394  getExtraDeviceInfo(result);
395 }
396 
398 {
399  // nothing
400 }
401 
403 {
404  return CacheLine::SIZE;
405 }
406 
407 
408 byte MSXDevice::readIO(word /*port*/, EmuTime::param /*time*/)
409 {
410  // read from unmapped IO
411  return 0xFF;
412 }
413 
414 void MSXDevice::writeIO(word /*port*/, byte /*value*/, EmuTime::param /*time*/)
415 {
416  // write to unmapped IO, do nothing
417 }
418 
419 byte MSXDevice::peekIO(word /*port*/, EmuTime::param /*time*/) const
420 {
421  return 0xFF;
422 }
423 
424 
425 byte MSXDevice::readMem(word /*address*/, EmuTime::param /*time*/)
426 {
427  // read from unmapped memory
428  return 0xFF;
429 }
430 
431 const byte* MSXDevice::getReadCacheLine(word /*start*/) const
432 {
433  return nullptr; // uncacheable
434 }
435 
436 void MSXDevice::writeMem(word /*address*/, byte /*value*/,
437  EmuTime::param /*time*/)
438 {
439  // write to unmapped memory, do nothing
440 }
441 
442 byte MSXDevice::peekMem(word address, EmuTime::param /*time*/) const
443 {
444  word base = address & CacheLine::HIGH;
445  if (const byte* cache = getReadCacheLine(base)) {
446  word offset = address & CacheLine::LOW;
447  return cache[offset];
448  } else {
449  // peek not supported for this device
450  return 0xFF;
451  }
452 }
453 
454 void MSXDevice::globalWrite(word /*address*/, byte /*value*/,
455  EmuTime::param /*time*/)
456 {
457  UNREACHABLE;
458 }
459 
460 void MSXDevice::globalRead(word /*address*/, EmuTime::param /*time*/)
461 {
462  UNREACHABLE;
463 }
464 
465 byte* MSXDevice::getWriteCacheLine(word /*start*/) const
466 {
467  return nullptr; // uncacheable
468 }
469 
470 
471 // calls 'action(<start2>, <size2>, args..., ps, ss)'
472 // with 'start', 'size' clipped to each of the ranges in 'memRegions'
473 template<typename Action, typename... Args>
474 void MSXDevice::clip(unsigned start, unsigned size, Action action, Args... args)
475 {
476  int ss2 = (ss != -1) ? ss : 0;
477  unsigned end = start + size;
478  for (auto [base, fullBsize] : memRegions) {
479  // split on 16kB boundaries
480  while (fullBsize > 0) {
481  unsigned bsize = std::min(fullBsize, ((base + 0x4000) & ~0x3fff) - base);
482 
483  unsigned baseEnd = base + bsize;
484  // intersect [start, end) with [base, baseEnd) -> [clipStart, clipEnd)
485  unsigned clipStart = std::max(start, base);
486  unsigned clipEnd = std::min(end, baseEnd);
487  if (clipStart < clipEnd) { // non-empty
488  unsigned clipSize = clipEnd - clipStart;
489  action(clipStart, clipSize, args..., ps, ss2);
490  }
491 
492  base += bsize;
493  fullBsize -= bsize;
494  }
495  }
496 }
497 
498 void MSXDevice::invalidateDeviceRWCache(unsigned start, unsigned size)
499 {
500  clip(start, size, [&](auto... args) { getCPUInterface().invalidateRWCache(args...); });
501 }
502 void MSXDevice::invalidateDeviceRCache(unsigned start, unsigned size)
503 {
504  clip(start, size, [&](auto... args) { getCPUInterface().invalidateRCache(args...); });
505 }
506 void MSXDevice::invalidateDeviceWCache(unsigned start, unsigned size)
507 {
508  clip(start, size, [&](auto... args) { getCPUInterface().invalidateWCache(args...); });
509 }
510 
511 void MSXDevice::fillDeviceRWCache(unsigned start, unsigned size, byte* rwData)
512 {
513  fillDeviceRWCache(start, size, rwData, rwData);
514 }
515 void MSXDevice::fillDeviceRWCache(unsigned start, unsigned size, const byte* rData, byte* wData)
516 {
517  assert(!allowUnaligned());
518  clip(start, size, [&](auto... args) { getCPUInterface().fillRWCache(args...); }, rData, wData);
519 }
520 void MSXDevice::fillDeviceRCache(unsigned start, unsigned size, const byte* rData)
521 {
522  assert(!allowUnaligned());
523  clip(start, size, [&](auto... args) { getCPUInterface().fillRCache(args...); }, rData);
524 }
525 void MSXDevice::fillDeviceWCache(unsigned start, unsigned size, byte* wData)
526 {
527  assert(!allowUnaligned());
528  clip(start, size, [&](auto... args) { getCPUInterface().fillWCache(args...); }, wData);
529 }
530 
531 template<typename Archive>
532 void MSXDevice::serialize(Archive& ar, unsigned /*version*/)
533 {
534  // When this method is called, the method init() has already been
535  // called (thus also registerSlots() and registerPorts()).
536  ar.serialize("name", deviceName);
537 }
539 
540 } // namespace openmsx
Definition: one_of.hh:7
void freeSlot(int ps, int ss, const HardwareConfig &hwConfig)
XMLElement * getSecondary() const
Definition: DeviceConfig.hh:55
XMLElement * getPrimary() const
Definition: DeviceConfig.hh:51
MSXMotherBoard & getMotherBoard() const
void register_IO_Out(byte port, MSXDevice *device)
Devices can register their Out ports.
void invalidateRWCache(word start, unsigned size, int ps, int ss)
void register_IO_In(byte port, MSXDevice *device)
Devices can register their In ports.
void fillWCache(unsigned start, unsigned size, byte *wData, int ps, int ss)
void unregister_IO_In(byte port, MSXDevice *device)
void invalidateRCache(word start, unsigned size, int ps, int ss)
void fillRWCache(unsigned start, unsigned size, const byte *rData, byte *wData, int ps, int ss)
void registerMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
Devices can register themself in the MSX slotstructure.
void invalidateWCache(word start, unsigned size, int ps, int ss)
void unregisterMemDevice(MSXDevice &device, int ps, int ss, int base, int size)
void unregister_IO_Out(byte port, MSXDevice *device)
void fillRCache(unsigned start, unsigned size, const byte *rData, int ps, int ss)
bool isExpanded(int ps) const
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
MSXMotherBoard & getMotherBoard() const
Get the mother board this device belongs to.
Definition: MSXDevice.cc:76
virtual void init()
Definition: MSXDevice.cc:50
void invalidateDeviceRCache()
Definition: MSXDevice.hh:210
void fillDeviceWCache(unsigned start, unsigned size, byte *wData)
Definition: MSXDevice.cc:525
PluggingController & getPluggingController() const
Definition: MSXDevice.cc:163
virtual void powerUp(EmuTime::param time)
This method is called when MSX is powered up.
Definition: MSXDevice.cc:376
const DeviceConfig & getDeviceConfig2() const
Definition: MSXDevice.hh:234
void fillDeviceRWCache(unsigned start, unsigned size, byte *rwData)
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located ...
Definition: MSXDevice.cc:511
virtual ~MSXDevice()=0
Definition: MSXDevice.cc:59
CliComm & getCliComm() const
Definition: MSXDevice.cc:147
virtual const byte * getReadCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading.
Definition: MSXDevice.cc:431
void invalidateDeviceWCache()
Definition: MSXDevice.hh:211
void getDeviceInfo(TclObject &result) const
Get device info.
Definition: MSXDevice.cc:391
virtual void writeIO(word port, byte value, EmuTime::param time)
Write a byte to a given IO port at a certain time to this device.
Definition: MSXDevice.cc:414
virtual byte readIRQVector()
Gets IRQ vector used in IM2.
Definition: MSXDevice.cc:366
virtual void globalWrite(word address, byte value, EmuTime::param time)
Global writes.
Definition: MSXDevice.cc:454
Reactor & getReactor() const
Definition: MSXDevice.cc:151
virtual bool allowUnaligned() const
By default we don't allow unaligned <mem> specifications in the config file.
Definition: MSXDevice.hh:291
virtual unsigned getBaseSizeAlignment() const
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE.
Definition: MSXDevice.cc:402
MSXDevice(const MSXDevice &)=delete
const XMLElement & getDeviceConfig() const
Get the configuration section for this device.
Definition: MSXDevice.hh:231
std::vector< MSXDevice * > Devices
Definition: MSXDevice.hh:38
virtual byte readMem(word address, EmuTime::param time)
Read a byte from a location at a certain time from this device.
Definition: MSXDevice.cc:425
virtual void getExtraDeviceInfo(TclObject &result) const
Definition: MSXDevice.cc:397
void getVisibleMemRegion(unsigned &base, unsigned &size) const
Returns the range where this device is visible in memory.
Definition: MSXDevice.cc:309
virtual void writeMem(word address, byte value, EmuTime::param time)
Write a given byte to a given location at a certain time to this device.
Definition: MSXDevice.cc:436
virtual byte peekIO(word port, EmuTime::param time) const
Read a byte from a given IO port.
Definition: MSXDevice.cc:419
virtual byte peekMem(word address, EmuTime::param time) const
Read a byte from a given memory location.
Definition: MSXDevice.cc:442
MSXCPU & getCPU() const
Definition: MSXDevice.cc:135
const HardwareConfig & getHardwareConfig() const
Returns the hardwareconfig this device belongs to.
Definition: MSXDevice.hh:44
static byte unmappedRead[0x10000]
Definition: MSXDevice.hh:301
LedStatus & getLedStatus() const
Definition: MSXDevice.cc:159
void serialize(Archive &ar, unsigned version)
Definition: MSXDevice.cc:532
void invalidateDeviceRWCache()
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is lo...
Definition: MSXDevice.hh:209
Scheduler & getScheduler() const
Definition: MSXDevice.cc:143
virtual void getNameList(TclObject &result) const
Returns list of name(s) of this device.
Definition: MSXDevice.cc:386
virtual byte * getWriteCacheLine(word start) const
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing.
Definition: MSXDevice.cc:465
void fillDeviceRCache(unsigned start, unsigned size, const byte *rData)
Definition: MSXDevice.cc:520
CommandController & getCommandController() const
Definition: MSXDevice.cc:155
void testRemove(span< const std::unique_ptr< MSXDevice >> removed) const
Checks whether this device can be removed (no other device has a reference to it).
Definition: MSXDevice.cc:81
const Devices & getReferences() const
Get the device references that are specified for this device.
Definition: MSXDevice.cc:125
virtual void powerDown(EmuTime::param time)
This method is called when MSX is powered down.
Definition: MSXDevice.cc:371
virtual void globalRead(word address, EmuTime::param time)
Global reads.
Definition: MSXDevice.cc:460
virtual std::string getName() const
Returns a human-readable name for this device.
Definition: MSXDevice.cc:381
virtual void reset(EmuTime::param time)
This method is called on reset.
Definition: MSXDevice.cc:361
EmuTime::param getCurrentTime() const
Definition: MSXDevice.cc:131
MSXCPUInterface & getCPUInterface() const
Definition: MSXDevice.cc:139
virtual byte readIO(word port, EmuTime::param time)
Read a byte from an IO port at a certain time from this device.
Definition: MSXDevice.cc:408
PluggingController & getPluggingController()
MSXCPUInterface & getCPUInterface()
EmuTime::param getCurrentTime()
Convenience method: This is the same as getScheduler().getCurrentTime().
CartridgeSlotManager & getSlotManager()
MSXDevice * findDevice(std::string_view name)
Find a MSXDevice by name.
CommandController & getCommandController()
Central administration of Connectors and Pluggables.
Contains the main loop of openMSX.
Definition: Reactor.hh:67
void addListElement(const T &t)
Definition: TclObject.hh:130
void addDictKeyValue(const Key &key, const Value &value)
Definition: TclObject.hh:144
Definition: span.hh:126
constexpr bool ispow2(T x) noexcept
Is the given number an integral power of two? That is, does it have exactly one 1-bit in binary repre...
Definition: Math.hh:57
constexpr vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
Definition: gl_vec.hh:269
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
Definition: gl_vec.hh:287
constexpr unsigned LOW
Definition: CacheLine.hh:9
constexpr unsigned HIGH
Definition: CacheLine.hh:10
constexpr unsigned SIZE
Definition: CacheLine.hh:7
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29
bool none_of(InputRange &&range, UnaryPredicate pred)
Definition: ranges.hh:131
size_t size(std::string_view utf8)
constexpr auto transform(Range &&range, UnaryOp op)
Definition: view.hh:306
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:983
constexpr auto rfind_unguarded(RANGE &range, const VAL &val)
Similar to the find(_if)_unguarded functions above, but searches from the back to front.
Definition: stl.hh:157
constexpr auto min_value(InputIterator first, InputIterator last)
Definition: stl.hh:253
constexpr auto max_value(InputIterator first, InputIterator last)
Definition: stl.hh:272
void move_pop_back(VECTOR &v, typename VECTOR::iterator it)
Erase the pointed to element from the given vector.
Definition: stl.hh:182
std::string strCat(Ts &&...ts)
Definition: strCat.hh:591
void strAppend(std::string &result, Ts &&...ts)
Definition: strCat.hh:669
#define UNREACHABLE
Definition: unreachable.hh:38
constexpr auto xrange(T e)
Definition: xrange.hh:155
constexpr auto end(const zstring_view &x)
Definition: zstring_view.hh:83