Skip to content

Commit

Permalink
Move RWMode to rw.ts and remove types.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
smack0007 committed Jul 25, 2024
1 parent 716e134 commit 6263a79
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 13 deletions.
1 change: 1 addition & 0 deletions mod.SDL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * from "./src/SDL/events.ts";
export * from "./src/SDL/functionMacros.ts";
export * from "./src/SDL/functions.ts";
export * from "./src/SDL/pixels.ts";
export * from "./src/SDL/rw.ts";
export * from "./src/SDL/structs.ts";
2 changes: 1 addition & 1 deletion src/SDL/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {

import { AudioDeviceID } from "./audio.ts";
import { Event } from "./events.ts";
import { RWMode /*, TimerID */ } from "./types.ts";
import { RWMode } from "./rw.ts";

let _library: DynamicLibrary<typeof symbols> = null!;

Expand Down
6 changes: 1 addition & 5 deletions src/SDL/types.ts → src/SDL/rw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { u16 } from "../types.ts";

export type RWMode =
| "a"
| "a+"
Expand All @@ -12,6 +10,4 @@ export type RWMode =
| "rb"
| "rb+"
| "wb"
| "wb+";

// export type TimerID = int;
| "wb+";
48 changes: 41 additions & 7 deletions tools/codegen/SDL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,45 @@ const SDL_SRC_PATH = path.join(SRC_PATH, "SDL");

export async function codegenSDL(): Promise<void> {
await writeEnums(`${SDL_SRC_PATH}/enums.ts`, enums, []);
await writeEvents(`${SDL_SRC_PATH}/events.ts`, events, callbacks, enums, structs, opaqueStructs);
await writeStructs(`${SDL_SRC_PATH}/structs.ts`, callbacks, enums, structs, opaqueStructs);
await writeSymbols(`${SDL_SRC_PATH}/_symbols.ts`, functions, callbacks, enums, structs, opaqueStructs);
await writeCallbacksSymbols(`${SDL_SRC_PATH}/_callbacks.ts`, callbacks, enums, structs, opaqueStructs, []);
await writeCallbacks(`${SDL_SRC_PATH}/callbacks.ts`, callbacks, enums, structs, opaqueStructs, []);
await writeEvents(
`${SDL_SRC_PATH}/events.ts`,
events,
callbacks,
enums,
structs,
opaqueStructs
);
await writeStructs(
`${SDL_SRC_PATH}/structs.ts`,
callbacks,
enums,
structs,
opaqueStructs
);
await writeSymbols(
`${SDL_SRC_PATH}/_symbols.ts`,
functions,
callbacks,
enums,
structs,
opaqueStructs
);
await writeCallbacksSymbols(
`${SDL_SRC_PATH}/_callbacks.ts`,
callbacks,
enums,
structs,
opaqueStructs,
[]
);
await writeCallbacks(
`${SDL_SRC_PATH}/callbacks.ts`,
callbacks,
enums,
structs,
opaqueStructs,
[]
);
await writeFunctions(
`${SDL_SRC_PATH}/functions.ts`,
"SDL2",
Expand All @@ -35,7 +69,7 @@ export async function codegenSDL(): Promise<void> {
[
`import { AudioDeviceID } from "./audio.ts"`,
`import { Event } from "./events.ts";`,
`import { RWMode /*, TimerID */ } from "./types.ts";`,
],
`import { RWMode } from "./rw.ts";`,
]
);
}

0 comments on commit 6263a79

Please sign in to comment.