generated from Over-Run/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Over-Run/struct
Add annotation Struct
- Loading branch information
Showing
36 changed files
with
1,760 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
plugins { `java-library` } | ||
|
||
dependencies { | ||
implementation(rootProject) | ||
annotationProcessor(rootProject) | ||
} | ||
|
||
tasks.withType<Jar> { | ||
archiveBaseName = "marshal-demo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2023-2024 Overrun Organization | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
*/ | ||
|
||
package overrun.marshal.test; | ||
|
||
import overrun.marshal.SizedSeg; | ||
import overrun.marshal.Sized; | ||
import overrun.marshal.Skip; | ||
import overrun.marshal.StrCharset; | ||
import overrun.marshal.struct.Const; | ||
import overrun.marshal.struct.Padding; | ||
import overrun.marshal.struct.Struct; | ||
import overrun.marshal.struct.StructRef; | ||
|
||
import java.lang.foreign.MemorySegment; | ||
|
||
/** | ||
* {@linkplain #_LAYOUT Layout} | ||
* | ||
* @author squid233 | ||
* @since 0.1.0 | ||
*/ | ||
@Struct | ||
final class CStructTest { | ||
@Skip | ||
int _LAYOUT; | ||
int x; | ||
@Const | ||
int y; | ||
int index; | ||
int[] segmentAllocator; | ||
GLFWErrorCallback arena; | ||
/** | ||
* the timestamp | ||
*/ | ||
long stamp; | ||
byte b; | ||
@Padding(7) | ||
int padding; | ||
MemorySegment segment; | ||
@SizedSeg(16L) | ||
MemorySegment sizedSegment; | ||
String name; | ||
@StrCharset("UTF-16") | ||
String utf16Name; | ||
int[] arr; | ||
@Sized(4) | ||
int[] sizedArr; | ||
boolean[] boolArr; | ||
String[] strArr; | ||
GLFWErrorCallback upcall; | ||
@StructRef("overrun.marshal.test.StructTest") | ||
MemorySegment myStruct; | ||
@StructRef("overrun.marshal.test.Vector3") | ||
int anotherStruct; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2023-2024 Overrun Organization | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
*/ | ||
|
||
package overrun.marshal.test; | ||
|
||
import overrun.marshal.struct.Const; | ||
import overrun.marshal.struct.Struct; | ||
|
||
/** | ||
* @author squid233 | ||
* @since 0.1.0 | ||
*/ | ||
@Const | ||
@Struct | ||
public record CVector3(int x, int y, int z) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.