Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GMLCompiler+LibGUI: Various GML compiler fixes #20523

Merged
merged 8 commits into from
Aug 12, 2023

Conversation

kleinesfilmroellchen
Copy link
Collaborator

@kleinesfilmroellchen kleinesfilmroellchen commented Aug 12, 2023

This is a collection of commits that make several applications (CertificateSettings, CalendarSettings, Calendar, Calculator, BrowserSettings, Run, LoginServer) work with the compiler. As far as I can tell, this covers many common cases I missed while preparing the original GML compiler PR with just Help. I will submit the applications separately as another PR to not make this too large, since this PR contains the more complicated changes.

LibGUI: Add direct property for fixed-width font

There's the "font_type" property which currently only handles
fixed-width yes/no, so until we get a proper font type enum and
associated enum property, this is better to use from GML instead of a
special case in the GML compiler.

GMLCompiler: Handle spacer pseudo-objects

GMLCompiler: Escape compiled strings

We don't want a newline to cause havoc.

GMLCompiler: Allow generating enum constants from strings

As with other special cases, this depends on the property name.

The UIDimension code is kept separate since it can handle both integers
and strings, and the string names for special dimensions don't match
with the enum names.

GMLCompiler: Handle bitmap properties

GMLCompiler: Add a variety of special cases

Headers, enum properties, and associated default includes.

GMLCompiler: Force main class name to be resolved from global namespace

Calculator would otherwise trip over this, since there's a class with
the same name within the namespace.

GMLCompiler: Allow using GML in any kind of Userland program

This is accomplished by detecting the Userland subdirectory from the GML
file's own path. Thereby, any Userland program, e.g. applet,
application, or even service, can use GML and the include paths of the
generated files will be correct.

There's the "font_type" property which currently only handles
fixed-width yes/no, so until we get a proper font type enum and
associated enum property, this is better to use from GML instead of a
special case in the GML compiler.
We don't want a newline to cause havoc.
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Aug 12, 2023
As with other special cases, this depends on the property name.

The UIDimension code is kept separate since it can handle both integers
and strings, and the string names for special dimensions don't match
with the enum names.
Headers, enum properties, and associated default includes.
Calculator would otherwise trip over this, since there's a class with
the same name within the namespace.
This is accomplished by detecting the Userland subdirectory from the GML
file's own path. Thereby, any Userland program, e.g. applet,
application, or even service, can use GML and the include paths of the
generated files will be correct.
@@ -90,19 +91,24 @@ static ErrorOr<String> include_path_for(StringView class_name)
return String::formatted("<Lib{}.h>", pathed_name);

// We assume that all other paths are within the current application, for now.
return String::formatted("<Applications/{}.h>", pathed_name);
// To figure out what kind of userland program this is (application, service, ...) we consider the path to the original GML file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future it would be nice to not make such assumptions about the project path, e.g. when using from within serenity or without the serenity source tree on hand. (third party apps etc). The build system should be able to pass this sort of information in.

@ADKaster ADKaster merged commit aa741a1 into SerenityOS:master Aug 12, 2023
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Aug 12, 2023
@kleinesfilmroellchen kleinesfilmroellchen deleted the gml-compiler-fixes branch August 12, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants