Utilities for LEAP.
Currently implemented: - A utility that helps with file/directory operations - A utility to process filenames (removing extensions, paths,...) - Singly-linked lists - Hash table with chaining
A hash table. E.g. of a hash table with vec_len=4
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(sllist_obj), | public, | allocatable | :: | vec(:) | |||
| integer, | public | :: | vec_len | = | 0 |
| procedure, public :: Finalize => hashtbl_obj_Final | |
| generic, public :: Get => hashtbl_obj_Get_int4, hashtbl_obj_Get_int8, hashtbl_obj_Get_real_sp, hashtbl_obj_Get_real_dp | |
| procedure, public, nopass :: HashString => hashtbl_obj_HashString | |
| procedure, public :: Initialize => hashtbl_obj_Init | |
| procedure, public :: Print => hashtbl_obj_Print | |
| procedure, public :: Put => hashtbl_obj_Put | |
| procedure, public :: Remove => hashtbl_obj_Remove | |
| procedure, private :: hashtbl_obj_Get_int4 | |
| procedure, private :: hashtbl_obj_Get_int8 | |
| procedure, private :: hashtbl_obj_Get_real_dp | |
| procedure, private :: hashtbl_obj_Get_real_sp |
Singly-linked list. Defines a sequence of key-value pairs E.g.: with 4 nodes key1 --> key2 --> key3 --> key4 --> nul() | | | | val1 val2 val3 val4
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(sllist_obj), | public, | pointer | :: | child | => | null() | |
| integer, | public | :: | key | = | -1 | ||
| class(*), | public, | allocatable | :: | val |
| procedure, public :: Free => sllist_obj_Free | |
| generic, public :: Get => sllist_obj_Get_int4, sllist_obj_Get_int8, sllist_obj_Get_real_sp, sllist_obj_Get_real_dp | |
| procedure, public :: Put => sllist_obj_Put | |
| procedure, public :: Remove => sllist_obj_Remove | |
| procedure, private :: sllist_obj_Get_int4 | |
| procedure, private :: sllist_obj_Get_int8 | |
| procedure, private :: sllist_obj_Get_real_dp | |
| procedure, private :: sllist_obj_Get_real_sp |
A utility to help with parsing and reformating strings.
| procedure, public, nopass :: RemoveExtension => stringtool_obj_RemoveExtension | |
| procedure, public, nopass :: RemovePath => stringtool_obj_RemovePath |
A utility to help with file and directory operations.
| procedure, public, nopass :: CreateDirectory => sysutils_obj_CreateDirectory | |
| procedure, public, nopass :: DeleteDirectory => sysutils_obj_DeleteDirectory | |
| procedure, public, nopass :: DeleteFile => sysutils_obj_DeleteFile | |
| procedure, public, nopass :: DirectoryExists => sysutils_obj_DirectoryExists | |
| procedure, public, nopass :: FileExists => sysutils_obj_FileExists |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | str |
String to hash |
Returned hash
Removes file extension from filename while preserving scientific notation and dots in paths.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
File name |
Returned string with extension removed
Removes path from filename.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
File name |
Returned string with path removed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Directory name |
Checks whether a file exists.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
File name |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(inout) | :: | this |
Hashtable object |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(in) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to retrieve from hashtable |
||
| integer(kind=leapI4), | intent(out) | :: | val |
Val from key-val pair to retrieve from hashtable |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(in) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to retrieve from hashtable |
||
| integer(kind=leapI8), | intent(out) | :: | val |
Val from key-val pair to retrieve from hashtable |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(in) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to retrieve from hashtable |
||
| real(kind=leapDP), | intent(out) | :: | val |
Val from key-val pair to retrieve from hashtable |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(in) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to retrieve from hashtable |
||
| real(kind=leapSP), | intent(out) | :: | val |
Val from key-val pair to retrieve from hashtable |
Initializes the hashtable.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(inout) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | tbl_len |
Hashtable vector length |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(inout), | target | :: | this |
Hashtable object |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(inout) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to add in hashtable |
||
| class(*), | intent(in) | :: | val |
Val from key-val pair to add in hashtable |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(hashtbl_obj), | intent(inout) | :: | this |
Hashtable object |
||
| integer, | intent(in) | :: | key |
Key from key-val pair to remove from hashtable |
Free all data associated with this list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(inout) | :: | this |
List object |
Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(in) | :: | this |
list object |
||
| integer, | intent(in) | :: | key |
Key in list |
||
| integer(kind=leapI4), | intent(out) | :: | val |
Value associated with key to return |
Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(in) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in list |
||
| integer(kind=leapI8), | intent(out) | :: | val |
Value associated with key to return |
Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(in) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in list |
||
| real(kind=leapDP), | intent(out) | :: | val |
Value associated with key to return |
Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(in) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in list |
||
| real(kind=leapSP), | intent(out) | :: | val |
Value associated with key to return |
Adds a pair key-value to the list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(inout) | :: | this |
List object |
||
| integer, | intent(in) | :: | key |
Key in key-val pair to add to list |
||
| class(*), | intent(in) | :: | val |
Val in key-val pair to add to list |
Remove key-value pair from list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sllist_obj), | intent(inout), | target | :: | this |
List object |
|
| integer, | intent(in) | :: | key |
Key of key-val pair to remove |
Creates a directory using system commands.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Directory name |
Deletes a directory using system commands.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Directory name |
Deletes a file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
File name |