2022-03-04 12:29:33 +01:00
|
|
|
//---
|
|
|
|
// fxos-shell.session: All the data used in an interactive session
|
|
|
|
//---
|
|
|
|
|
|
|
|
#ifndef FXOS_SESSION_H
|
|
|
|
#define FXOS_SESSION_H
|
|
|
|
|
|
|
|
#include <fxos/vspace.h>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
using namespace FxOS;
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
|
|
|
|
struct Session
|
|
|
|
{
|
|
|
|
/* Empty session with a single empty virtual space */
|
|
|
|
Session();
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Environment
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* Search path, folders from FXOS_LIBRARY essentially */
|
|
|
|
std::vector<fs::path> path;
|
|
|
|
|
|
|
|
/* Find file by name by searching through the path */
|
|
|
|
fs::path file(std::string name);
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Virtual spaces
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* Virtual spaces organized by name */
|
2022-03-28 23:42:53 +02:00
|
|
|
std::map<std::string, std::unique_ptr<VirtualSpace>> spaces;
|
2022-03-04 12:29:33 +01:00
|
|
|
/* Find a virtual space by name */
|
|
|
|
VirtualSpace *get_space(std::string name);
|
|
|
|
|
|
|
|
/* Current virtual space */
|
|
|
|
VirtualSpace *current_space;
|
|
|
|
|
|
|
|
/* Find an unused name from this prefix. If force_suffix is set, always
|
|
|
|
adds a suffix even if the name itself is free */
|
2022-03-04 23:54:45 +01:00
|
|
|
std::string generate_space_name(std::string prefix,
|
|
|
|
bool force_suffix=false);
|
2022-03-04 12:29:33 +01:00
|
|
|
|
|
|
|
//---
|
|
|
|
//
|
|
|
|
//---
|
|
|
|
|
|
|
|
/* Current cursor location */
|
|
|
|
uint32_t pc;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* FXOS_SESSION_H */
|