mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
transform into odin-site parsable format
This commit is contained in:
@@ -25,7 +25,7 @@ Initializes the entries map and sets the allocator for the string entries
|
||||
|
||||
*Allocates Using Provided Allocators*
|
||||
|
||||
Inputs:
|
||||
**Inputs**
|
||||
- m: A pointer to the Intern struct to be initialized
|
||||
- allocator: The allocator for the Intern_Entry strings (Default: context.allocator)
|
||||
- map_allocator: The allocator for the map of entries (Default: context.allocator)
|
||||
@@ -37,7 +37,7 @@ intern_init :: proc(m: ^Intern, allocator := context.allocator, map_allocator :=
|
||||
/*
|
||||
Frees the map and all its content allocated using the `.allocator`.
|
||||
|
||||
Inputs:
|
||||
**Inputs**
|
||||
- m: A pointer to the Intern struct to be destroyed
|
||||
*/
|
||||
intern_destroy :: proc(m: ^Intern) {
|
||||
@@ -51,13 +51,13 @@ Returns the interned string for the given text, is set in the map if it didnt ex
|
||||
|
||||
*MAY Allocate using the Intern's Allocator*
|
||||
|
||||
Inputs:
|
||||
**Inputs**
|
||||
- m: A pointer to the Intern struct
|
||||
- text: The string to be interned
|
||||
|
||||
NOTE: The returned string lives as long as the map entry lives.
|
||||
|
||||
Returns: The interned string and an allocator error if any
|
||||
**Returns** The interned string and an allocator error if any
|
||||
*/
|
||||
intern_get :: proc(m: ^Intern, text: string) -> (str: string, err: runtime.Allocator_Error) {
|
||||
entry := _intern_get_entry(m, text) or_return
|
||||
@@ -68,13 +68,13 @@ Returns the interned C-String for the given text, is set in the map if it didnt
|
||||
|
||||
*MAY Allocate using the Intern's Allocator*
|
||||
|
||||
Inputs:
|
||||
**Inputs**
|
||||
- m: A pointer to the Intern struct
|
||||
- text: The string to be interned
|
||||
|
||||
NOTE: The returned C-String lives as long as the map entry lives
|
||||
|
||||
Returns: The interned C-String and an allocator error if any
|
||||
**Returns** The interned C-String and an allocator error if any
|
||||
*/
|
||||
intern_get_cstring :: proc(m: ^Intern, text: string) -> (str: cstring, err: runtime.Allocator_Error) {
|
||||
entry := _intern_get_entry(m, text) or_return
|
||||
@@ -86,11 +86,11 @@ Sets and allocates the entry if it wasn't set yet
|
||||
|
||||
*MAY Allocate using the Intern's Allocator*
|
||||
|
||||
Inputs:
|
||||
**Inputs**
|
||||
- m: A pointer to the Intern struct
|
||||
- text: The string to be looked up or interned
|
||||
|
||||
Returns: The new or existing interned entry and an allocator error if any
|
||||
**Returns** The new or existing interned entry and an allocator error if any
|
||||
*/
|
||||
_intern_get_entry :: proc(m: ^Intern, text: string) -> (new_entry: ^Intern_Entry, err: runtime.Allocator_Error) #no_bounds_check {
|
||||
if prev, ok := m.entries[text]; ok {
|
||||
|
||||
Reference in New Issue
Block a user