mirror of
https://github.com/opnsense/src.git
synced 2026-06-06 15:22:34 -04:00
* main.lua replicates the functionality of makesyscalls.lua
* Individual files are generated by their associated module
* Modules can be called as standalone scripts to generate a specific
file
* Data and procedures are performed by objects instead of procedual code
* Bitmasks are replaced by declarative types
* Temporary files are no longer produced, writing is stored in memory
* Comments provide explanation to functions and semantics
Google Summer of Code 2024 Final Work Product
Co-authored-by: Warner Losh <imp@freebsd.org>
Co-authored-by: Kyle Evans <kevans@freebsd.org>
Co-authored-by: Brooks Davis <brooks@freebsd.org>
Sponsored by: Google (GSoC 24)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1362
Signed-off-by: agge3 <sterspark@gmail.com>
45 lines
865 B
Lua
45 lines
865 B
Lua
--
|
|
-- SPDX-License-Identifier: BSD-2-Clause
|
|
--
|
|
-- Copyright (c) 2024 Tyler Baxter <agge@FreeBSD.org>
|
|
-- Copyright (c) 2023 Warner Losh <imp@bsdimp.com>
|
|
-- Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org>
|
|
--
|
|
|
|
local util = require("tools.util")
|
|
|
|
local scret = {}
|
|
|
|
scret.__index = scret
|
|
|
|
-- Processes this return type.
|
|
function scret:process()
|
|
local words = util.split(self.scret, "%S+")
|
|
self.scret = words[1]
|
|
-- Pointer incoming.
|
|
if words[2]:sub(1,1) == "*" then
|
|
self.scret = self.scret .. " "
|
|
end
|
|
while words[2]:sub(1,1) == "*" do
|
|
words[2] = words[2]:sub(2)
|
|
self.scret = self.scret .. "*"
|
|
end
|
|
end
|
|
|
|
-- To add this return type to the system call.
|
|
function scret:add()
|
|
self:process()
|
|
return self.scret
|
|
end
|
|
|
|
function scret:new(obj, line)
|
|
obj = obj or { }
|
|
setmetatable(obj, self)
|
|
self.__index = self
|
|
|
|
self.scret = line
|
|
|
|
return obj
|
|
end
|
|
|
|
return scret
|