mirror of https://gitlab.com/nakst/essence
ini files: remove sectionClass
This commit is contained in:
parent
f0483e4bfe
commit
aa4b656bbd
|
@ -12,109 +12,109 @@ background_service=1
|
|||
[build]
|
||||
source=apps/file_manager/main.cpp
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=esx
|
||||
name=Executable
|
||||
icon=icon_application_default_icon
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=ini
|
||||
name=Configuration file
|
||||
icon=icon_application_x_desktop
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=esx_symbols
|
||||
name=Debugging data
|
||||
icon=icon_extension
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=exe
|
||||
name=PC executable
|
||||
icon=icon_application_x_ms_dos_executable
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=png
|
||||
name=PNG image
|
||||
icon=icon_image_x_generic
|
||||
has_thumbnail_generator=1
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=jpg
|
||||
name=JPG image
|
||||
icon=icon_image_x_generic
|
||||
has_thumbnail_generator=1
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=ttf
|
||||
name=TrueType font
|
||||
icon=icon_font_x_generic
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=otf
|
||||
name=OpenType font
|
||||
icon=icon_font_x_generic
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=a
|
||||
name=Static library
|
||||
icon=icon_extension
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=dat
|
||||
name=Database
|
||||
icon=icon_office_database
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=icon_pack
|
||||
name=Icon pack
|
||||
icon=icon_package_x_generic
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=ekm
|
||||
name=Kernel module
|
||||
icon=icon_extension
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=o
|
||||
name=Binary object
|
||||
icon=icon_extension
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=c
|
||||
name=C source
|
||||
icon=icon_text_x_csrc
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=cpp
|
||||
name=C++ source
|
||||
icon=icon_text_x_csrc
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=h
|
||||
name=C header
|
||||
icon=icon_text_x_csrc
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=txt
|
||||
name=Text file
|
||||
icon=icon_text
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=md
|
||||
name=Markdown file
|
||||
icon=icon_text_markdown
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=ogg
|
||||
name=OGG audio
|
||||
icon=icon_audio_x_generic
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=mp4
|
||||
name=MP4 video
|
||||
icon=icon_view_list_video_symbolic
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=wav
|
||||
name=Wave audio
|
||||
icon=icon_audio_x_generic
|
||||
|
|
|
@ -393,7 +393,7 @@ void ConfigurationSave() {
|
|||
|
||||
for (uintptr_t i = 0; i < folderViewSettings.Length(); i++) {
|
||||
FolderViewSettingsEntry *entry = &folderViewSettings[i];
|
||||
EsBufferFormat(&buffer, "\n[@folder]\npath=%z\nsort_column=%d\nview_type=%d\n",
|
||||
EsBufferFormat(&buffer, "\n[folder]\npath=%z\nsort_column=%d\nview_type=%d\n",
|
||||
entry->path, entry->settings.sortColumn, entry->settings.viewType);
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ void LoadSettings() {
|
|||
String string = {};
|
||||
string.text = state.value, string.bytes = state.valueBytes;
|
||||
BookmarkAdd(string, false);
|
||||
} else if (0 == EsStringCompareRaw(state.sectionClass, state.sectionClassBytes, EsLiteral("folder"))) {
|
||||
} else if (0 == EsStringCompareRaw(state.section, state.sectionBytes, EsLiteral("folder"))) {
|
||||
if (0 == EsStringCompareRaw(state.key, state.keyBytes, EsLiteral("path"))) {
|
||||
if (state.keyBytes < sizeof(folderViewSettings[0].path)) {
|
||||
FolderViewSettingsEntry *entry = folderViewSettings.Add();
|
||||
|
|
|
@ -5,10 +5,10 @@ icon=icon_applications_fonts
|
|||
[build]
|
||||
source=apps/font_book.cpp
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=ttf
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=otf
|
||||
action=open
|
||||
|
|
|
@ -6,10 +6,10 @@ use_single_process=1
|
|||
[build]
|
||||
source=apps/image_editor.cpp
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=jpg
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=png
|
||||
action=open
|
||||
|
|
|
@ -7,6 +7,6 @@ hidden=1
|
|||
[build]
|
||||
source=apps/markdown_viewer.cpp
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=md
|
||||
action=open
|
||||
|
|
|
@ -6,22 +6,22 @@ use_single_process=1
|
|||
[build]
|
||||
source=apps/text_editor.cpp
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=txt
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=cpp
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=h
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=c
|
||||
action=open
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=ini
|
||||
action=open
|
||||
|
|
|
@ -110,8 +110,8 @@ struct SystemConfigurationItem {
|
|||
};
|
||||
|
||||
struct SystemConfigurationGroup {
|
||||
char *section, *sectionClass;
|
||||
size_t sectionBytes, sectionClassBytes;
|
||||
char *section;
|
||||
size_t sectionBytes;
|
||||
SystemConfigurationItem *items;
|
||||
size_t itemCount;
|
||||
};
|
||||
|
@ -331,8 +331,7 @@ SystemConfigurationGroup *SystemConfigurationGetGroup(const char *section, ptrdi
|
|||
if (sectionBytes == -1) sectionBytes = EsCStringLength(section);
|
||||
|
||||
for (uintptr_t i = 0; i < api.systemConfigurationGroups.Length(); i++) {
|
||||
if (0 == EsStringCompareRaw(section, sectionBytes, api.systemConfigurationGroups[i].section, api.systemConfigurationGroups[i].sectionBytes)
|
||||
&& !api.systemConfigurationGroups[i].sectionClassBytes) {
|
||||
if (0 == EsStringCompareRaw(section, sectionBytes, api.systemConfigurationGroups[i].section, api.systemConfigurationGroups[i].sectionBytes)) {
|
||||
return &api.systemConfigurationGroups[i];
|
||||
}
|
||||
}
|
||||
|
@ -396,7 +395,6 @@ void SystemConfigurationUnload() {
|
|||
}
|
||||
|
||||
EsHeapFree(api.systemConfigurationGroups[i].section);
|
||||
EsHeapFree(api.systemConfigurationGroups[i].sectionClass);
|
||||
|
||||
Array<SystemConfigurationItem> items = { api.systemConfigurationGroups[i].items };
|
||||
items.Free();
|
||||
|
@ -421,8 +419,6 @@ void SystemConfigurationLoad(const char *file, size_t fileBytes) {
|
|||
group = &api.systemConfigurationGroups.Last();
|
||||
group->section = (char *) EsHeapAllocate(s.sectionBytes, false);
|
||||
EsMemoryCopy(group->section, s.section, (group->sectionBytes = s.sectionBytes));
|
||||
group->sectionClass = (char *) EsHeapAllocate(s.sectionClassBytes, false);
|
||||
EsMemoryCopy(group->sectionClass, s.sectionClass, (group->sectionClassBytes = s.sectionClassBytes));
|
||||
} else if (group) {
|
||||
SystemConfigurationItem item = {};
|
||||
item.key = (char *) EsHeapAllocate(s.keyBytes, false);
|
||||
|
|
|
@ -2476,7 +2476,7 @@ void ConfigurationLoadApplications() {
|
|||
|
||||
SystemConfigurationGroup *group = &api.systemConfigurationGroups[i];
|
||||
|
||||
if (0 != EsStringCompareRaw(group->sectionClass, group->sectionClassBytes, EsLiteral("application"))) {
|
||||
if (0 != EsStringCompareRaw(group->section, group->sectionBytes, EsLiteral("application"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2491,7 +2491,7 @@ void ConfigurationLoadApplications() {
|
|||
application->useSingleProcess = SystemConfigurationGroupReadInteger(group, EsLiteral("use_single_process"), false);
|
||||
application->useSingleInstance = SystemConfigurationGroupReadInteger(group, EsLiteral("use_single_instance"), false);
|
||||
application->hidden = SystemConfigurationGroupReadInteger(group, EsLiteral("hidden"), false);
|
||||
application->id = EsIntegerParse(group->section, group->sectionBytes);
|
||||
application->id = SystemConfigurationGroupReadInteger(group, EsLiteral("id"), false);
|
||||
|
||||
#define READ_PERMISSION(x, y) if (SystemConfigurationGroupReadInteger(group, EsLiteral(x), 0)) application->permissions |= y
|
||||
READ_PERMISSION("permission_all_files", APPLICATION_PERMISSION_ALL_FILES);
|
||||
|
@ -2529,20 +2529,22 @@ void ConfigurationLoadApplications() {
|
|||
}, 0);
|
||||
}
|
||||
|
||||
void ConfigurationWriteSectionsToBuffer(const char *sectionClass, const char *section, bool includeComments, EsBuffer *pipe) {
|
||||
void ConfigurationWriteSectionsToBuffer(const char *section, bool includeComments, EsBuffer *pipe) {
|
||||
char buffer[4096];
|
||||
EsMutexAcquire(&api.systemConfigurationMutex);
|
||||
|
||||
for (uintptr_t i = 0; i < api.systemConfigurationGroups.Length(); i++) {
|
||||
SystemConfigurationGroup *group = &api.systemConfigurationGroups[i];
|
||||
|
||||
if ((sectionClass && EsStringCompareRaw(group->sectionClass, group->sectionClassBytes, sectionClass, -1))
|
||||
|| (section && EsStringCompareRaw(group->section, group->sectionBytes, section, -1))) {
|
||||
continue;
|
||||
if (section) {
|
||||
if (section[EsCStringLength(section) - 1] == ':') {
|
||||
if (group->sectionBytes <= EsCStringLength(section) || EsMemoryCompare(group->section, section, EsCStringLength(section))) continue;
|
||||
} else {
|
||||
if (EsStringCompareRaw(group->section, group->sectionBytes, section, -1)) continue;
|
||||
}
|
||||
}
|
||||
|
||||
EsINIState s = {};
|
||||
s.sectionClass = group->sectionClass, s.sectionClassBytes = group->sectionClassBytes;
|
||||
s.section = group->section, s.sectionBytes = group->sectionBytes;
|
||||
size_t bytes = EsINIFormat(&s, buffer, sizeof(buffer));
|
||||
EsBufferWrite(pipe, buffer, bytes);
|
||||
|
@ -2570,7 +2572,7 @@ void ConfigurationWriteToFile() {
|
|||
}
|
||||
|
||||
EsBuffer buffer = { .canGrow = true };
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, nullptr, true /* include comments */, &buffer);
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, true /* include comments */, &buffer);
|
||||
|
||||
if (!buffer.error) {
|
||||
if (ES_SUCCESS == EsFileWriteAll(EsLiteral(K_SYSTEM_CONFIGURATION "_"), buffer.out, buffer.position)) {
|
||||
|
@ -2900,18 +2902,18 @@ bool /* returns false on fatal error */ DesktopSyscall(EsObjectID windowID, Appl
|
|||
EsBufferWrite(pipe, &desktop.clipboardInformation, sizeof(desktop.clipboardInformation));
|
||||
EsBufferWrite(pipe, &fileHandle, sizeof(fileHandle));
|
||||
} else if (buffer[0] == DESKTOP_MSG_SYSTEM_CONFIGURATION_GET && pipe) {
|
||||
ConfigurationWriteSectionsToBuffer("font", nullptr, false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, "ui_fonts", false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer("font:", false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer("ui_fonts", false, pipe);
|
||||
|
||||
if (application->permissions & APPLICATION_PERMISSION_ALL_FILES) {
|
||||
ConfigurationWriteSectionsToBuffer(nullptr, "paths", false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer("paths", false, pipe);
|
||||
}
|
||||
} else if (buffer[0] == DESKTOP_MSG_REQUEST_SHUTDOWN) {
|
||||
if (~application->permissions & APPLICATION_PERMISSION_SHUTDOWN) return false;
|
||||
ShutdownModalCreate();
|
||||
} else if (buffer[0] == DESKTOP_MSG_FILE_TYPES_GET && pipe) {
|
||||
if (~application->permissions & APPLICATION_PERMISSION_VIEW_FILE_TYPES) return false;
|
||||
ConfigurationWriteSectionsToBuffer("file_type", nullptr, false, pipe);
|
||||
ConfigurationWriteSectionsToBuffer("file_type", false, pipe);
|
||||
} else if (buffer[0] == DESKTOP_MSG_ANNOUNCE_PATH_MOVED && bytes > 1 + sizeof(uintptr_t) * 2) {
|
||||
if (~application->permissions & APPLICATION_PERMISSION_ALL_FILES) return false;
|
||||
|
||||
|
|
|
@ -1561,8 +1561,8 @@ private struct _EsApplicationStartupInformation {
|
|||
};
|
||||
|
||||
struct EsINIState {
|
||||
char *buffer, *sectionClass, *section, *key, *value;
|
||||
size_t bytes, sectionClassBytes, sectionBytes, keyBytes, valueBytes;
|
||||
char *buffer, *section, *key, *value;
|
||||
size_t bytes, sectionBytes, keyBytes, valueBytes;
|
||||
} @opaque();
|
||||
|
||||
struct EsAnalogInput {
|
||||
|
|
|
@ -587,27 +587,30 @@ void FontInitialise() {
|
|||
for (uintptr_t i = 0; i < api.systemConfigurationGroups.Length(); i++) {
|
||||
SystemConfigurationGroup *g = &api.systemConfigurationGroups[i];
|
||||
|
||||
if (0 == EsStringCompareRaw(g->sectionClass, g->sectionClassBytes, EsLiteral("font"))) {
|
||||
if (0 == EsStringCompareRaw(g->section, g->sectionBytes, EsLiteral(fontManagement.sansName))) {
|
||||
if (g->sectionBytes > 5 && 0 == EsMemoryCompare(g->section, "font:", 5)) {
|
||||
const char *name = g->section + 5;
|
||||
size_t nameBytes = g->sectionBytes - 5;
|
||||
|
||||
if (0 == EsStringCompareRaw(name, nameBytes, EsLiteral(fontManagement.sansName))) {
|
||||
fontManagement.sans = fontManagement.database.Length();
|
||||
}
|
||||
|
||||
if (0 == EsStringCompareRaw(g->section, g->sectionBytes, EsLiteral(fontManagement.serifName))) {
|
||||
if (0 == EsStringCompareRaw(name, nameBytes, EsLiteral(fontManagement.serifName))) {
|
||||
fontManagement.serif = fontManagement.database.Length();
|
||||
}
|
||||
|
||||
if (0 == EsStringCompareRaw(g->section, g->sectionBytes, EsLiteral(fontManagement.monospacedName))) {
|
||||
if (0 == EsStringCompareRaw(name, nameBytes, EsLiteral(fontManagement.monospacedName))) {
|
||||
fontManagement.monospaced = fontManagement.database.Length();
|
||||
}
|
||||
|
||||
if (0 == EsStringCompareRaw(g->section, g->sectionBytes, EsLiteral(fontManagement.fallbackName))) {
|
||||
if (0 == EsStringCompareRaw(name, nameBytes, EsLiteral(fontManagement.fallbackName))) {
|
||||
fontManagement.fallback = fontManagement.database.Length();
|
||||
}
|
||||
|
||||
FontDatabaseEntry entry = {};
|
||||
|
||||
entry.nameBytes = MinimumInteger(g->sectionBytes, sizeof(entry.name));
|
||||
EsMemoryCopy(entry.name, g->section, entry.nameBytes);
|
||||
entry.nameBytes = MinimumInteger(nameBytes, sizeof(entry.name));
|
||||
EsMemoryCopy(entry.name, name, entry.nameBytes);
|
||||
entry.id = fontManagement.database.Length();
|
||||
|
||||
for (uintptr_t i = 0; i < g->itemCount; i++) {
|
||||
|
|
|
@ -233,8 +233,8 @@ When a thread is waiting for a spinlock to be released so that it may acquire it
|
|||
|
||||
```c
|
||||
struct EsINIState {
|
||||
char *buffer, *sectionClass, *section, *key, *value;
|
||||
size_t bytes, sectionClassBytes, sectionBytes, keyBytes, valueBytes;
|
||||
char *buffer, *section, *key, *value;
|
||||
size_t bytes, sectionBytes, keyBytes, valueBytes;
|
||||
};
|
||||
|
||||
bool EsINIParse(EsINIState *s);
|
||||
|
@ -247,11 +247,11 @@ void EsINIZeroTerminate(EsINIState *s);
|
|||
|
||||
To parse an INI file, first initialise a blank EsINIState structure. Set `buffer` to point to the INI data, and set `bytes` to the byte count of the data. Then, call `EsINIParse` repeatedly, until it returns false, indicating it has reached the end of the data. After each call to `EsINIParse`, the fields of `EsINIState` are updated to give the information about the last parsed line in the INI file. `EsINIPeek` is the same as `EsINIParse` except it does not advance to the next line in the INI data. Fields in `EsINIState` that are not applicable to the parsed line are set to empty strings. Comment lines set `key` to `;` and `value` contains the comment itself. Aside for empty strings, the fields in `EsINIState` will always point into the provided buffer.
|
||||
|
||||
For example, the line `[@hello world]` will set `sectionClass` to `"hello"`, `section` to `"world"`, and `key` and `value` to empty strings. When followed by the line `k=v`, `sectionClass` and `section` will retain their previous values, and `key` will be set to `"k"` and `value` will be set to `"v"`.
|
||||
For example, the line `[world]` will set `section` to `"world"`, and `key` and `value` to empty strings. When followed by the line `k=v`, `section` will retain its previous value, and `key` will be set to `"k"` and `value` will be set to `"v"`.
|
||||
|
||||
`EsINIFormat` formats the contents of `EsINIState` into a buffer. `bytes` gives the size of `buffer`. The return value gives the number of bytes written to `buffer`; this is clipped to the end of the buffer.
|
||||
|
||||
`EsINIZeroTerminate` zero-terminates `sectionClass`, `section`, `key` and `value` in the `EsINIState`. It cannot be used after calling `EsINIPeek`.
|
||||
`EsINIZeroTerminate` zero-terminates `section`, `key` and `value` in the `EsINIState`. It cannot be used after calling `EsINIPeek`.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
@ -95,14 +95,14 @@ In the `[general]` section:
|
|||
|
||||
In the `[embed]` section there is a list of files that should be embedded into the application bundle. These embedded file can be accessed at runtime using the `EsBundleFind` API. The entries in this section are of the form `<embedded name>=<path>`. Embedded name prefixed with `$` are reserved for definition by the system. The ELF executable files are automatically embedded into the application's bundle, with names of the form `$Executables/<target>`. The application's icon should be embedded as PNG images with names of the form `$Icons/<size>`. You must, as a minimum, provide sizes `16` (16x16 pixels) and `32` (32x32 pixels).
|
||||
|
||||
Each `[@file_type]` section provides information about a file type.
|
||||
Each `[file_type]` section provides information about a file type.
|
||||
|
||||
- `extension` Gives the file name extension for the file type.
|
||||
- `name` Gives the readable name of the file type, which will be shown to the user. TODO Translations.
|
||||
- `icon` Gives the name of the icon from `desktop/icons.header` to show for files of this type. TODO Bundled icons.
|
||||
- `has_thumbnail_generator` Set to 1 if the file type has a thumbnail generator. Only images are supported at the moment. TODO Custom thumbnail generators.
|
||||
|
||||
Each `[@handler]` section describes this application's support to manage files of a given file type.
|
||||
Each `[handler]` section describes this application's support to manage files of a given file type.
|
||||
|
||||
- `extension` The file name extension of the file type.
|
||||
- `action` The action that this application support for the file type. Currently only "open" is supported.
|
||||
|
@ -140,15 +140,15 @@ In the `[install]` section:
|
|||
|
||||
In the `[options]` section there is a copy of the options in "Configuration options", from `bin/config.ini`. Note that many of these options are not handled by build core, but rather by `util/build.c`. See the "Configuration options" section for more details.
|
||||
|
||||
Each `[@application]` section should contain a single key, `manifest`, giving the path to the application configuration options (see the above section).
|
||||
Each `[application]` section should contain a single key, `manifest`, giving the path to the application configuration options (see the above section).
|
||||
|
||||
Each `[@driver]` section should contain:
|
||||
Each `[driver]` section should contain:
|
||||
|
||||
- `name` The name of the driver. This must be found in `kernel/config.ini`.
|
||||
- `source` The source file of the driver. This must be C/C++.
|
||||
- `builtin` Set to 1 if the driver should be linked directly into the kernel. Set to 0 if the driver should be built as a loadable module.
|
||||
|
||||
`[@font <name>]` sections specify the fonts that are to be bundled in the desktop executable. Each section should contain:
|
||||
`[font:<name>]` sections specify the fonts that are to be bundled in the desktop executable. Each section should contain:
|
||||
|
||||
- `category` One of `Sans`, `Serif` or `Mono`. More categories will likely be added in the future.
|
||||
- `scripts` The scripts supported by the font. See `hb_script_t` in `bin/harfbuzz/src/hb-common.h` for a list of scripts. Separate each script with a `,`.
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
[@driver Root]
|
||||
[driver:Root]
|
||||
builtin=1
|
||||
|
||||
; Subsystems.
|
||||
|
||||
[@driver Networking]
|
||||
[driver:Networking]
|
||||
parent=Root
|
||||
builtin=1
|
||||
|
||||
[@driver USB]
|
||||
[driver:USB]
|
||||
source=drivers/usb.cpp
|
||||
parent=Root
|
||||
builtin=1
|
||||
|
||||
; Architectures.
|
||||
|
||||
[@driver ACPI]
|
||||
[driver:ACPI]
|
||||
arch=x86_common
|
||||
parent=Root
|
||||
builtin=1
|
||||
|
||||
; Base devices.
|
||||
|
||||
[@driver PCI]
|
||||
[driver:PCI]
|
||||
source=drivers/pci.cpp
|
||||
arch=x86_common
|
||||
builtin=1
|
||||
|
||||
[@driver SVGA]
|
||||
[driver:SVGA]
|
||||
source=drivers/svga.cpp
|
||||
arch=x86_common
|
||||
builtin=1
|
||||
|
||||
[@driver PS2]
|
||||
[driver:PS2]
|
||||
source=drivers/ps2.cpp
|
||||
arch=x86_common
|
||||
builtin=1
|
||||
|
||||
[@driver RTC]
|
||||
[driver:RTC]
|
||||
source=drivers/rtc.cpp
|
||||
arch=x86_common
|
||||
builtin=1
|
||||
|
||||
; PCI devices.
|
||||
|
||||
[@driver IDE]
|
||||
[driver:IDE]
|
||||
source=drivers/ide.cpp
|
||||
builtin=1
|
||||
arch=x86_common
|
||||
|
@ -51,14 +51,14 @@ parent=PCI
|
|||
classCode=0x01
|
||||
subclassCode=0x01
|
||||
|
||||
[@driver AHCI]
|
||||
[driver:AHCI]
|
||||
source=drivers/ahci.cpp
|
||||
builtin=1
|
||||
parent=PCI
|
||||
classCode=0x01
|
||||
subclassCode=0x06
|
||||
|
||||
[@driver NVMe]
|
||||
[driver:NVMe]
|
||||
source=drivers/nvme.cpp
|
||||
builtin=1
|
||||
parent=PCI
|
||||
|
@ -66,7 +66,7 @@ classCode=0x01
|
|||
subclassCode=0x08
|
||||
progIF=0x02
|
||||
|
||||
[@driver HDAudio]
|
||||
[driver:HDAudio]
|
||||
name=HDAudio
|
||||
source=drivers/hda.cpp
|
||||
builtin=1
|
||||
|
@ -74,7 +74,7 @@ parent=PCI
|
|||
classCode=0x04
|
||||
subclassCode=0x03
|
||||
|
||||
[@driver xHCI]
|
||||
[driver:xHCI]
|
||||
source=drivers/xhci.cpp
|
||||
builtin=1
|
||||
parent=PCI
|
||||
|
@ -82,14 +82,14 @@ classCode=0x0C
|
|||
subclassCode=0x03
|
||||
progIF=0x30
|
||||
|
||||
[@driver BGA]
|
||||
[driver:BGA]
|
||||
source=drivers/bga.cpp
|
||||
builtin=1
|
||||
parent=PCI
|
||||
deviceID=0xBEEF80EE
|
||||
deviceID=0x11111234
|
||||
|
||||
[@driver I8254x]
|
||||
[driver:I8254x]
|
||||
source=drivers/i8254x.cpp
|
||||
builtin=1
|
||||
parent=PCI
|
||||
|
@ -97,13 +97,13 @@ deviceID=0x100E8086
|
|||
|
||||
; USB devices.
|
||||
|
||||
[@driver USBHID]
|
||||
[driver:USBHID]
|
||||
source=drivers/usb_hid.cpp
|
||||
builtin=1
|
||||
parent=USB
|
||||
classCode=0x03
|
||||
|
||||
[@driver USBBulk]
|
||||
[driver:USBBulk]
|
||||
source=drivers/usb_bulk.cpp
|
||||
builtin=1
|
||||
parent=USB
|
||||
|
@ -113,14 +113,14 @@ protocol=0x50
|
|||
|
||||
; File systems.
|
||||
|
||||
[@driver EssenceFS]
|
||||
[driver:EssenceFS]
|
||||
source=drivers/esfs2.cpp
|
||||
builtin=1
|
||||
parent=Files
|
||||
signature_offset=0x2000
|
||||
signature=!EssenceFS2-----
|
||||
|
||||
[@driver FAT]
|
||||
[driver:FAT]
|
||||
source=drivers/fat.cpp
|
||||
builtin=1
|
||||
parent=Files
|
||||
|
@ -129,21 +129,21 @@ signature=)
|
|||
signature_offset=0x42
|
||||
signature=)
|
||||
|
||||
[@driver ISO9660]
|
||||
[driver:ISO9660]
|
||||
source=drivers/iso9660.cpp
|
||||
builtin=1
|
||||
parent=Files
|
||||
signature_offset=0x8001
|
||||
signature=CD001
|
||||
|
||||
[@driver NTFS]
|
||||
[driver:NTFS]
|
||||
source=drivers/ntfs.cpp
|
||||
builtin=1
|
||||
parent=Files
|
||||
signature_offset=3
|
||||
signature=NTFS
|
||||
|
||||
[@driver Ext2]
|
||||
[driver:Ext2]
|
||||
source=drivers/ext2.cpp
|
||||
builtin=1
|
||||
parent=Files
|
||||
|
@ -152,6 +152,6 @@ signature=S
|
|||
|
||||
; ACPI devices.
|
||||
|
||||
[@driver ACPIThermal]
|
||||
[driver:ACPIThermal]
|
||||
source=drivers/acpi_thermal.cpp
|
||||
builtin=1
|
||||
|
|
|
@ -8,11 +8,11 @@ hidden=1
|
|||
custom_compile_command=cp root/Applications/POSIX/bin/bochs bin/Bochs
|
||||
require=root/Applications/POSIX/bin/bochs
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=bochsrc
|
||||
name=Bochs configuration
|
||||
icon=icon_applications_development
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=bochsrc
|
||||
action=open
|
||||
|
|
|
@ -9,11 +9,11 @@ link_flags=-lOSMesa -lstdc++ -lz
|
|||
with_cstdlib=1
|
||||
source=ports/mesa/obj_viewer.c
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=obj
|
||||
action=open
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=obj
|
||||
name=3D model
|
||||
icon=icon_model
|
||||
|
|
|
@ -6,11 +6,11 @@ hidden=1
|
|||
source=ports/uxn/emulator.c
|
||||
compile_flags=-Wno-unknown-pragmas -Wno-unused-parameter
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=uxn
|
||||
action=open
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=uxn
|
||||
name=Uxn ROM
|
||||
icon=icon_unknown
|
||||
|
|
12
shared/ini.h
12
shared/ini.h
|
@ -14,14 +14,8 @@ bool EsINIParse(EsINIState *s) {
|
|||
s->valueBytes = 0;
|
||||
INI_READ(key, keyBytes, '\n', 0);
|
||||
} else if (c == '[') {
|
||||
s->sectionClassBytes = s->keyBytes = s->valueBytes = 0;
|
||||
s->keyBytes = s->valueBytes = 0;
|
||||
s->buffer++, s->bytes--;
|
||||
|
||||
if (s->bytes && *s->buffer == '@') {
|
||||
s->buffer++, s->bytes--;
|
||||
INI_READ(sectionClass, sectionClassBytes, ' ', ']');
|
||||
}
|
||||
|
||||
INI_READ(section, sectionBytes, ']', 0);
|
||||
} else {
|
||||
INI_READ(key, keyBytes, '=', '\n');
|
||||
|
@ -56,9 +50,6 @@ size_t EsINIFormat(EsINIState *s, char *buffer, size_t bytes) {
|
|||
INI_WRITE("\n", 1);
|
||||
} else {
|
||||
INI_WRITE("\n[", 2);
|
||||
if (s->sectionClassBytes) INI_WRITE("@", 1);
|
||||
INI_WRITE(s->sectionClass, s->sectionClassBytes);
|
||||
if (s->sectionClassBytes && s->sectionBytes) INI_WRITE(" ", 1);
|
||||
INI_WRITE(s->section, s->sectionBytes);
|
||||
INI_WRITE("]\n", 2);
|
||||
}
|
||||
|
@ -68,7 +59,6 @@ size_t EsINIFormat(EsINIState *s, char *buffer, size_t bytes) {
|
|||
|
||||
void EsINIZeroTerminate(EsINIState *s) {
|
||||
static char emptyString = 0;
|
||||
if (s->sectionClassBytes) s->sectionClass[s->sectionClassBytes] = 0; else s->sectionClass = &emptyString;
|
||||
if (s->sectionBytes) s->section[s->sectionBytes] = 0; else s->section = &emptyString;
|
||||
if (s->keyBytes) s->key[s->keyBytes] = 0; else s->key = &emptyString;
|
||||
if (s->valueBytes) s->value[s->valueBytes] = 0; else s->value = &emptyString;
|
||||
|
|
14
util/build.c
14
util/build.c
|
@ -287,18 +287,18 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
|||
while (EsINIParse(&s)) {
|
||||
EsINIZeroTerminate(&s);
|
||||
|
||||
if (strcmp(s.sectionClass, "driver")) {
|
||||
if (memcmp(s.section, "driver:", 7)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = s.section;
|
||||
name = s.section + 7;
|
||||
|
||||
if (0 == strcmp(s.key, "source")) source = s.value;
|
||||
if (0 == strcmp(s.key, "builtin")) builtin = !!atoi(s.value);
|
||||
|
||||
if (!EsINIPeek(&s) || !s.keyBytes) {
|
||||
if (IsDriverEnabled(name)) {
|
||||
fprintf(f, "[@driver]\nname=%s\nsource=%s\nbuiltin=%d\n\n", name, source ?: "", builtin);
|
||||
fprintf(f, "[driver]\nname=%s\nsource=%s\nbuiltin=%d\n\n", name, source ?: "", builtin);
|
||||
}
|
||||
|
||||
source = name = NULL;
|
||||
|
@ -336,7 +336,7 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
|||
continue;
|
||||
}
|
||||
|
||||
fprintf(f, "[@font %s]\ncategory=%s\nscripts=%s\nlicense=%s\n", font->name, font->category, font->scripts, font->license);
|
||||
fprintf(f, "[font:%s]\ncategory=%s\nscripts=%s\nlicense=%s\n", font->name, font->category, font->scripts, font->license);
|
||||
fileIndex = 0;
|
||||
|
||||
while (font->files[fileIndex].path) {
|
||||
|
@ -360,7 +360,7 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
|||
continue;
|
||||
}
|
||||
|
||||
fprintf(f, "[@application]\nmanifest=apps/%s\n\n", entry->d_name);
|
||||
fprintf(f, "[application]\nmanifest=apps/%s\n\n", entry->d_name);
|
||||
}
|
||||
|
||||
closedir(root);
|
||||
|
@ -369,7 +369,7 @@ void Compile(uint32_t flags, int partitionSize, const char *volumeLabel) {
|
|||
|
||||
while (s.buffer && EsINIParse(&s)) {
|
||||
if (!s.keyBytes || s.valueBytes || (s.keyBytes >= 1 && s.key[0] == ';')) continue;
|
||||
fprintf(f, "[@application]\nmanifest=%.*s\n\n", (int) s.keyBytes, s.key);
|
||||
fprintf(f, "[application]\nmanifest=%.*s\n\n", (int) s.keyBytes, s.key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1576,7 +1576,7 @@ int main(int _argc, char **_argv) {
|
|||
path[0] = 0;
|
||||
|
||||
while (EsINIParse(&s)) {
|
||||
if (s.sectionClassBytes || s.sectionBytes) continue;
|
||||
if (s.sectionBytes) continue;
|
||||
EsINIZeroTerminate(&s);
|
||||
|
||||
INI_READ_BOOL(accepted_license, acceptedLicense);
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
typedef struct EsINIState {
|
||||
char *buffer, *sectionClass, *section, *key, *value;
|
||||
size_t bytes, sectionClassBytes, sectionBytes, keyBytes, valueBytes;
|
||||
char *buffer, *section, *key, *value;
|
||||
size_t bytes, sectionBytes, keyBytes, valueBytes;
|
||||
} EsINIState;
|
||||
|
||||
#include "../shared/ini.h"
|
||||
|
|
|
@ -815,7 +815,7 @@ void ParseApplicationManifest(const char *manifestPath) {
|
|||
else INI_READ_BOOL(disabled, disabled);
|
||||
else INI_READ_BOOL(needs_native_toolchain, needsNativeToolchain);
|
||||
else if (s.keyBytes && s.valueBytes) arrput(application.properties, s);
|
||||
} else if (0 == strcmp(s.sectionClass, "handler")) {
|
||||
} else if (0 == strcmp(s.section, "handler")) {
|
||||
if (!s.keyBytes) {
|
||||
Handler _handler = {};
|
||||
arrput(application.handlers, _handler);
|
||||
|
@ -824,7 +824,7 @@ void ParseApplicationManifest(const char *manifestPath) {
|
|||
|
||||
INI_READ_STRING_PTR(extension, handler->extension);
|
||||
INI_READ_STRING_PTR(action, handler->action);
|
||||
} else if (0 == strcmp(s.sectionClass, "file_type")) {
|
||||
} else if (0 == strcmp(s.section, "file_type")) {
|
||||
if (!s.keyBytes) {
|
||||
FileType _fileType = {};
|
||||
_fileType.id = nextID++;
|
||||
|
@ -921,7 +921,8 @@ void OutputSystemConfiguration() {
|
|||
continue;
|
||||
}
|
||||
|
||||
FilePrintFormat(file, "\n[@application %d]\n", applications[i].id);
|
||||
FilePrintFormat(file, "\n[application]\n");
|
||||
FilePrintFormat(file, "id=%d\n", applications[i].id);
|
||||
FilePrintFormat(file, "name=%s\n", applications[i].name);
|
||||
FilePrintFormat(file, "executable=0:/Applications/%s.esx\n", applications[i].name);
|
||||
FilePrintFormat(file, "settings_path=0:/" SYSTEM_FOLDER_NAME "/Settings/%s\n", applications[i].name);
|
||||
|
@ -931,7 +932,8 @@ void OutputSystemConfiguration() {
|
|||
}
|
||||
|
||||
for (uintptr_t j = 0; j < arrlenu(applications[i].fileTypes); j++) {
|
||||
FilePrintFormat(file, "\n[@file_type %d]\n", applications[i].fileTypes[j].id);
|
||||
FilePrintFormat(file, "\n[file_type]\n");
|
||||
FilePrintFormat(file, "id=%d\n", applications[i].fileTypes[j].id);
|
||||
FilePrintFormat(file, "extension=%s\n", applications[i].fileTypes[j].extension);
|
||||
FilePrintFormat(file, "name=%s\n", applications[i].fileTypes[j].name);
|
||||
FilePrintFormat(file, "icon=%s\n", applications[i].fileTypes[j].icon);
|
||||
|
@ -940,7 +942,7 @@ void OutputSystemConfiguration() {
|
|||
}
|
||||
|
||||
for (uintptr_t j = 0; j < arrlenu(applications[i].handlers); j++) {
|
||||
FilePrintFormat(file, "\n[@handler]\n");
|
||||
FilePrintFormat(file, "\n[handler]\n");
|
||||
FilePrintFormat(file, "action=%s\n", applications[i].handlers[j].action);
|
||||
FilePrintFormat(file, "application=%d\n", applications[i].id);
|
||||
FilePrintFormat(file, "file_type=%d\n", applications[i].handlers[j].fileTypeID);
|
||||
|
@ -1008,13 +1010,13 @@ void ParseKernelConfiguration() {
|
|||
EsINIState previous = s;
|
||||
|
||||
while (EsINIParse(&s)) {
|
||||
if (!IsStringEqual(s.sectionClass, s.sectionClassBytes, "driver")
|
||||
if (!(s.sectionBytes > 7 && 0 == memcmp(s.section, "driver:", 7))
|
||||
|| (previous.sectionBytes == s.sectionBytes && 0 == memcmp(previous.section, s.section, s.sectionBytes))
|
||||
|| !IsModuleEnabled(s.section, s.sectionBytes)) {
|
||||
|| !IsModuleEnabled(s.section + 7, s.sectionBytes - 7)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FilePrintFormat(f, "extern \"C\" KDriver driver%.*s;\n", (int) s.sectionBytes, s.section);
|
||||
FilePrintFormat(f, "extern \"C\" KDriver driver%.*s;\n", (int) s.sectionBytes - 7, s.section + 7);
|
||||
previous = s;
|
||||
}
|
||||
|
||||
|
@ -1030,12 +1032,12 @@ void ParseKernelConfiguration() {
|
|||
bool foundMatchingArchitecture = false, anyArchitecturesListed = false;
|
||||
|
||||
while (EsINIParse(&s)) {
|
||||
if (!IsStringEqual(s.sectionClass, s.sectionClassBytes, "driver")) {
|
||||
if (!(s.sectionBytes > 7 && 0 == memcmp(s.section, "driver:", 7))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
moduleName = s.section;
|
||||
moduleNameBytes = s.sectionBytes;
|
||||
moduleName = s.section + 7;
|
||||
moduleNameBytes = s.sectionBytes - 7;
|
||||
|
||||
if (IsStringEqual(s.key, s.keyBytes, "parent")) {
|
||||
parentName = s.value, parentNameBytes = s.valueBytes;
|
||||
|
@ -1364,7 +1366,7 @@ int main(int argc, char **argv) {
|
|||
} else if (0 == strcmp(s.key, "compiler_objects")) {
|
||||
toolchainCompilerObjects = s.value;
|
||||
}
|
||||
} else if (0 == strcmp(s.sectionClass, "application")) {
|
||||
} else if (0 == strcmp(s.section, "application")) {
|
||||
if (0 == strcmp(s.key, "manifest")) {
|
||||
arrput(applicationManifests, s.value);
|
||||
}
|
||||
|
@ -1467,9 +1469,9 @@ int main(int argc, char **argv) {
|
|||
} else if (0 == strcmp(s.key, "partition_size")) {
|
||||
partitionSize = atoi(s.value) * 1048576UL;
|
||||
}
|
||||
} else if (0 == strcmp(s.sectionClass, "font")) {
|
||||
} else if (0 == memcmp(s.section, "font:", 5)) {
|
||||
arrput(fontLines, s);
|
||||
} else if (0 == strcmp(s.sectionClass, "driver")) {
|
||||
} else if (0 == strcmp(s.section, "driver")) {
|
||||
if (0 == strcmp(s.key, "name")) driverName = s.value;
|
||||
if (0 == strcmp(s.key, "source")) driverSource = s.value;
|
||||
if (0 == strcmp(s.key, "builtin")) driverBuiltin = !!atoi(s.value);
|
||||
|
@ -1505,7 +1507,6 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (0 != strcmp(s.section, "install")) {
|
||||
configurationHash = CalculateCRC64(s.sectionClass, s.sectionClassBytes, configurationHash);
|
||||
configurationHash = CalculateCRC64(s.section, s.sectionBytes, configurationHash);
|
||||
configurationHash = CalculateCRC64(s.key, s.keyBytes, configurationHash);
|
||||
configurationHash = CalculateCRC64(s.value, s.valueBytes, configurationHash);
|
||||
|
@ -1861,8 +1862,7 @@ void CommandLaunch(EsInstance *instance, EsElement *element, EsCommand *command)
|
|||
size_t executablePathBytes = 0;
|
||||
|
||||
while (EsINIParse(&s)) {
|
||||
if (s.sectionClassBytes == 0
|
||||
&& 0 == EsStringCompareRaw(s.section, s.sectionBytes, EsLiteral("general"))
|
||||
if (0 == EsStringCompareRaw(s.section, s.sectionBytes, EsLiteral("general"))
|
||||
&& 0 == EsStringCompareRaw(s.key, s.keyBytes, EsLiteral("name"))) {
|
||||
executablePath = EsStringAllocateAndFormat(&executablePathBytes, "%s/bin/%s.esx", workingDirectoryBytes, workingDirectory, s.valueBytes, s.value);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ permission_run_temporary_application=1
|
|||
[build]
|
||||
source=util/build_core.c
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=build_core
|
||||
name=Build config
|
||||
icon=icon_text_x_makefile
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=build_core
|
||||
action=open
|
||||
|
|
|
@ -3753,6 +3753,25 @@ int WindowMessage(UIElement *element, UIMessage message, int di, void *dp) {
|
|||
void DocumentFileMenu(void *) {
|
||||
EsFileMenuCreate(ui.instance, ui.instance->window, ES_MENU_AT_CURSOR);
|
||||
}
|
||||
|
||||
int _UIInstanceCallback(EsInstance *instance, EsMessage *message) {
|
||||
if (message->type == ES_MSG_INSTANCE_SAVE) {
|
||||
fileStore = message->instanceSave.file;
|
||||
DocumentSave(nullptr);
|
||||
EsInstanceSaveComplete(instance, fileStore, true);
|
||||
fileStore = nullptr;
|
||||
} else if (message->type == ES_MSG_INSTANCE_OPEN) {
|
||||
DocumentFree();
|
||||
fileStore = message->instanceOpen.file;
|
||||
DocumentLoad();
|
||||
EsInstanceOpenComplete(instance, fileStore, true);
|
||||
fileStore = nullptr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ES_HANDLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DocumentMenu(void *) {
|
||||
|
@ -3781,6 +3800,11 @@ int main(int argc, char **argv) {
|
|||
#endif
|
||||
|
||||
UIInitialise();
|
||||
|
||||
#ifdef OS_ESSENCE
|
||||
ui.instance->callback = _UIInstanceCallback;
|
||||
#endif
|
||||
|
||||
ui.theme = _uiThemeClassic;
|
||||
window = UIWindowCreate(0, UI_ELEMENT_PARENT_PUSH | UI_WINDOW_MAXIMIZE, "Designer", 0, 0);
|
||||
window->e.messageUser = WindowMessage;
|
||||
|
@ -3850,25 +3874,6 @@ int main(int argc, char **argv) {
|
|||
#ifdef OS_ESSENCE
|
||||
void _UIMessageProcess(EsMessage *message) {}
|
||||
|
||||
int _UIInstanceCallback(EsInstance *instance, EsMessage *message) {
|
||||
if (message->type == ES_MSG_INSTANCE_SAVE) {
|
||||
fileStore = message->instanceSave.file;
|
||||
DocumentSave(nullptr);
|
||||
EsInstanceSaveComplete(instance, fileStore, true);
|
||||
fileStore = nullptr;
|
||||
} else if (message->type == ES_MSG_INSTANCE_OPEN) {
|
||||
DocumentFree();
|
||||
fileStore = message->instanceOpen.file;
|
||||
DocumentLoad();
|
||||
EsInstanceOpenComplete(instance, fileStore, true);
|
||||
fileStore = nullptr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
void _start() {
|
||||
_init();
|
||||
main(0, nullptr);
|
||||
|
|
|
@ -6,11 +6,11 @@ icon=icon_applications_interfacedesign
|
|||
source=util/designer2.cpp
|
||||
compile_flags=-D UI_ESSENCE -Wno-unused-parameter
|
||||
|
||||
[@file_type]
|
||||
[file_type]
|
||||
extension=designer
|
||||
name=Designer file
|
||||
icon=icon_text_css
|
||||
|
||||
[@handler]
|
||||
[handler]
|
||||
extension=designer
|
||||
action=open
|
||||
|
|
Loading…
Reference in New Issue