Commit Graph

32 Commits

Author SHA1 Message Date
Andrew Kelley
a31748b29e std.os.uefi: reorganize namespaces
This is a breaking change.

This commit applies the following rules to std.os.uefi:
* avoid redundant names in the namespace such as "protocol.FooProtocol"
* don't initialize struct field to undefined. do that at the
  initialization site if you want that, or create a named constant that
  sets all the fields to undefined.
* avoid the word "data", "info", "context", "state", "details", or
  "config" in the type name, especially if a word from that category is
  already in the type name.
* embrace tree structure

After following these rules, `usingnamespace` disappeared naturally.
This commit eliminates 26/53 (49%) instances of `usingnamespace` in the
standard library. All these uses were due to not understanding how
to properly use namespaces.

I did not test this commit. The standard library UEFI code is
experimental and pull requests have been accepted with minimal vetting.
Users of std.os.uefi will need to submit follow-up pull requests to fix
up whatever regressions this commit introduces, this time without
abusing namespaces (pun intended).
2023-08-24 22:38:47 -07:00
r00ster91
9be1a3f7ef std.os.uefi: use std.os.uefi.cc instead of .C as calling convention
I tested this and this definitely compiles and these
changes were done programmatically but if there's still anything wrong
it shouldn't be hard to fix.
With this change it's going to be very easy to make further adjustments
to the calling conventions of all these external UEFI functions.

Closes #16309
2023-07-08 17:32:36 -04:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Nick Cernis
8a5818535b
Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526)
* Export invalidFmtErr

To allow consistent use of "invalid format string" compile error
response for badly formatted format strings.

See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340.

* Replace format compile errors with invalidFmtErr

- Provides more consistent compile errors.
- Gives user info about the type of the badly formated value.

* Rename invalidFmtErr as invalidFmtError

For consistency. Zig seems to use “Error” more often than “Err”.

* std: add invalid format string checks to remaining custom formatters

* pass reference-trace to comp when building build file; fix checkobjectstep
2022-11-12 21:03:24 +02:00
Nameless
40e84a27d6
change uefi packed structs to new integer backed syntax (#13173)
* std.os.uefi: integer backed structs, add tests to catch regressions

device_path_protocol now uses extern structs with align(1) fields because
the transition to integer backed packed struct broke alignment

added comptime asserts that device_path_protocol structs do not violate
alignment and size specifications
2022-10-30 15:08:32 -04:00
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00
Yusuf Bham
2aeaa1cfc4
std.os.uefi: fix GUID formatting (#11452) 2022-04-17 06:15:15 -04:00
fifty-six
4771ac298b std/os/uefi: Simplify packed struct padding and default zero-initialize
Beyond adding default zero-initialization, this commit changes undefined
initialization to zero, as some cases reserved the padding and on other
cases, I've found some systems act strange when giving uninit instead of
zero even when it shouldn't be an issue, one example being
FileProtocol.Open's attributes, which *should* be ignored when not
creating a file, but ended up giving an unrelated error.
2022-01-16 02:04:39 -05:00
fifty-six
a2a2601da5 std/os/uefi: Complete DevicePathProtocol types 2022-01-14 07:02:55 -05:00
Andrew Kelley
3d89ff5130 std.fs.path: revert recent public API change
41fd343508 made a breaking change to the
public API; this commit reverts the API changes but keeps the
improved logic.
2022-01-11 11:00:19 -07:00
fifty-six
b65a884169 std/os/uefi: Add pool_allocator and raw_pool_allocator 2022-01-11 10:49:40 -07:00
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.

Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Jacob G-W
9fffffb07b fix code broken from previous commit 2021-06-21 17:03:03 -07:00
Asherah Connor
4272f07f66
std.os.uefi.Guid fixes (#8032)
* uefi: Guid.format compiles again

Also use "writer" nomenclature in argument name.

* uefi: add Guid.eql
2021-02-21 12:17:59 +02:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax 2020-10-06 22:08:25 -06:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Tadeo Kondrak
17e41f6cd3
@OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
Andrew Kelley
2dd920ee39
Merge branch 'format-stream' of https://github.com/fengb/zig into fengb-format-stream 2020-03-13 11:31:11 -04:00
Nick Erdmann
92beb13914 std/os/uefi: status reform 2020-03-12 23:23:12 +01:00
Nick Erdmann
9f475dae14 std/os/uefi: Add shell parameters protocol 2020-03-12 23:22:49 +01:00
Nick Erdmann
e617e8a798 std/os/uefi: require guid output function be comptime 2020-03-12 23:22:08 +01:00
Benjamin Feng
4aae55b4cc Replace fmt with new fmtstream 2020-03-12 10:41:09 -05:00
Benjamin Feng
c11d1055b8 Integrated outstreams with new formatter 2020-03-12 10:26:28 -05:00
LemonBoy
3640c682a2 Run zig fmt 2020-02-01 11:32:53 +01:00
Ryan Liptak
834218d789 Fix remaining variadic formatted prints
Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.
2020-01-09 13:36:44 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley
60cd11bd4b
get rid of std.os.foo.is_the_target
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.

For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
Nick Erdmann
e6eae25053
std/os/uefi: add documentation 2019-10-16 21:46:41 +02:00
Nick Erdmann
77104da43e
std/os/uefi: add Guid format() 2019-10-16 19:49:51 +02:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00