|
|
|
@ -1073,7 +1073,8 @@ typedef y_u32 y_Dirent;
|
|
|
|
|
* @pre @a parent must have an entry associated with @a dirent.
|
|
|
|
|
*/
|
|
|
|
|
y_Path
|
|
|
|
|
y_fs_dirent_name(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dirent_name(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns an index to the entry's extension.
|
|
|
|
@ -1084,7 +1085,8 @@ y_fs_dirent_name(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a parent must have an entry associated with @a dirent.
|
|
|
|
|
*/
|
|
|
|
|
y_u32
|
|
|
|
|
y_fs_dirent_ext(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dirent_ext(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the size of the entry (file size or directory data size in bytes).
|
|
|
|
@ -1095,7 +1097,8 @@ y_fs_dirent_ext(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a parent must have an entry associated with @a dirent.
|
|
|
|
|
*/
|
|
|
|
|
y_usize
|
|
|
|
|
y_fs_dirent_size(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dirent_size(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the entry is a directory.
|
|
|
|
@ -1106,7 +1109,8 @@ y_fs_dirent_size(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a parent must have an entry associated with @a dirent.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
y_fs_dirent_isDir(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dirent_isDir(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the entry is a file.
|
|
|
|
@ -1117,7 +1121,8 @@ y_fs_dirent_isDir(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a parent must have an entry associated with @a dirent.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
y_fs_dirent_isFile(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dirent_isFile(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the owner permissions for the entry.
|
|
|
|
@ -1129,7 +1134,7 @@ y_fs_dirent_isFile(const y_Dir parent, y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
*/
|
|
|
|
|
y_u8
|
|
|
|
|
y_fs_dirent_ownerPerms(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the group permissions for the entry.
|
|
|
|
@ -1141,7 +1146,7 @@ y_fs_dirent_ownerPerms(const y_Dir parent,
|
|
|
|
|
*/
|
|
|
|
|
y_u8
|
|
|
|
|
y_fs_dirent_groupPerms(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the other permissions for the entry.
|
|
|
|
@ -1153,7 +1158,7 @@ y_fs_dirent_groupPerms(const y_Dir parent,
|
|
|
|
|
*/
|
|
|
|
|
y_u8
|
|
|
|
|
y_fs_dirent_otherPerms(const y_Dir parent,
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_inline;
|
|
|
|
|
y_Dirent dirent) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
@ -1172,7 +1177,7 @@ y_fs_dirent_otherPerms(const y_Dir parent,
|
|
|
|
|
* @pre @a path must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_mkdir(y_Path path) y_allnonnull;
|
|
|
|
|
y_fs_dir_mkdir(y_Path path) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the directory at @a path, which is treated as relative to @a parent.
|
|
|
|
@ -1182,7 +1187,7 @@ y_fs_dir_mkdir(y_Path path) y_allnonnull;
|
|
|
|
|
* @pre @a path must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_mkdirat(y_Path path, y_Dir parent);
|
|
|
|
|
y_fs_dir_mkdirat(y_Path path, y_Dir parent) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the directory at @a path, making sure to create any missing parent
|
|
|
|
@ -1192,7 +1197,7 @@ y_fs_dir_mkdirat(y_Path path, y_Dir parent);
|
|
|
|
|
* @pre @a path must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_mkdirp(y_Path path) y_allnonnull;
|
|
|
|
|
y_fs_dir_mkdirp(y_Path path) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens and returns the directory at @a path. The opened directory must be
|
|
|
|
@ -1205,7 +1210,7 @@ y_fs_dir_mkdirp(y_Path path) y_allnonnull;
|
|
|
|
|
* @pre @a path must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_open(y_Dir* d, y_Path path) y_allnonnull;
|
|
|
|
|
y_fs_dir_open(y_Dir* d, y_Path path) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reopens @a dir with @a path.
|
|
|
|
@ -1217,7 +1222,7 @@ y_fs_dir_open(y_Dir* d, y_Path path) y_allnonnull;
|
|
|
|
|
* @pre @a path must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_reopen(y_Dir d, y_Path path) y_allnonnull;
|
|
|
|
|
y_fs_dir_reopen(y_Dir d, y_Path path) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens a directory relative to a parent. This opens all intermediate parents,
|
|
|
|
@ -1233,7 +1238,7 @@ y_fs_dir_reopen(y_Dir d, y_Path path) y_allnonnull;
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_openat(y_Dir* d, y_Dir parent, y_Path path, bool mkdirs)
|
|
|
|
|
y_paramsnonnull(1);
|
|
|
|
|
y_paramsnonnull(1) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if the directory has another entry.
|
|
|
|
@ -1243,7 +1248,7 @@ y_fs_dir_openat(y_Dir* d, y_Dir parent, y_Path path, bool mkdirs)
|
|
|
|
|
* @pre @a d must be open.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
y_fs_dir_hasNext(y_Dir d) y_allnonnull;
|
|
|
|
|
y_fs_dir_hasNext(y_Dir d) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Loads the first entry in @a dir.
|
|
|
|
@ -1251,7 +1256,7 @@ y_fs_dir_hasNext(y_Dir d) y_allnonnull;
|
|
|
|
|
* @return y_STATUS_SUCCESS on success, an error code otherwise.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_first(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dir_first(y_Dir dir) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Loads the next entry in @a dir.
|
|
|
|
@ -1260,7 +1265,7 @@ y_fs_dir_first(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a dir must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_next(y_Dir dir) y_allnonnull;
|
|
|
|
|
y_fs_dir_next(y_Dir dir) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the y_Dirent of the current entry in the directory.
|
|
|
|
@ -1270,7 +1275,7 @@ y_fs_dir_next(y_Dir dir) y_allnonnull;
|
|
|
|
|
* @pre @a d must be open.
|
|
|
|
|
*/
|
|
|
|
|
y_Dirent
|
|
|
|
|
y_fs_dir_entry(y_Dir d) y_allnonnull;
|
|
|
|
|
y_fs_dir_entry(y_Dir d) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sorts the open directory @a d.
|
|
|
|
@ -1291,7 +1296,7 @@ y_fs_dir_sort(y_Dir d, bool dirsFirst) y_allnonnull;
|
|
|
|
|
* @pre @a d must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
y_fs_dir_unsort(y_Dir d);
|
|
|
|
|
y_fs_dir_unsort(y_Dir d) y_allnonnull;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens the subdirectory of @a d at entry @a i. The directory must not be
|
|
|
|
@ -1304,7 +1309,7 @@ y_fs_dir_unsort(y_Dir d);
|
|
|
|
|
* @pre @a d must have an entry associated with @a i.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_subdir(y_Dir d, y_Dirent i) y_allnonnull;
|
|
|
|
|
y_fs_dir_subdir(y_Dir d, y_Dirent i) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens the parent of @a d into @a d. The directory must not be closed first.
|
|
|
|
@ -1314,7 +1319,7 @@ y_fs_dir_subdir(y_Dir d, y_Dirent i) y_allnonnull;
|
|
|
|
|
* @pre @a d must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_parent(y_Dir d) y_allnonnull;
|
|
|
|
|
y_fs_dir_parent(y_Dir d) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens the home directory into @a d. The directory must not be closed first.
|
|
|
|
@ -1324,7 +1329,7 @@ y_fs_dir_parent(y_Dir d) y_allnonnull;
|
|
|
|
|
* @pre @a d must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_dir_home(y_Dir d) y_allnonnull;
|
|
|
|
|
y_fs_dir_home(y_Dir d) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a pointer to the path of @a dir. The pointer will be invalidated if
|
|
|
|
@ -1335,7 +1340,7 @@ y_fs_dir_home(y_Dir d) y_allnonnull;
|
|
|
|
|
* @pre @a dir must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Path
|
|
|
|
|
y_fs_dir_path(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dir_path(y_Dir dir) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the number of entries in @a dir.
|
|
|
|
@ -1345,7 +1350,7 @@ y_fs_dir_path(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a dir must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_u32
|
|
|
|
|
y_fs_dir_numEntries(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dir_numEntries(y_Dir dir) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if @a dir is sorted, false otherwise.
|
|
|
|
@ -1355,7 +1360,7 @@ y_fs_dir_numEntries(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a dir must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
y_fs_dir_sorted(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dir_sorted(y_Dir dir) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns true if @a dir is sorted with directories first, false otherwise.
|
|
|
|
@ -1365,7 +1370,7 @@ y_fs_dir_sorted(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a dir must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
bool
|
|
|
|
|
y_fs_dir_dirsFirst(y_Dir dir) y_allnonnull y_inline;
|
|
|
|
|
y_fs_dir_dirsFirst(y_Dir dir) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes the directory @a dir.
|
|
|
|
@ -1478,7 +1483,7 @@ y_fs_filebytes_destroy(void* filebytes) y_allnonnull y_inline;
|
|
|
|
|
* @return y_STATUS_SUCCESS on success, an error code otherwise.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_create(y_Path path) y_allnonnull y_inline;
|
|
|
|
|
y_fs_file_create(y_Path path) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the file at @a path, making sure to create any missing parent
|
|
|
|
@ -1487,7 +1492,7 @@ y_fs_file_create(y_Path path) y_allnonnull y_inline;
|
|
|
|
|
* @return y_STATUS_SUCCESS on success, an error code otherwise.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_createWithParents(y_Path path) y_allnonnull;
|
|
|
|
|
y_fs_file_createWithParents(y_Path path) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a temp file name, creates the file, and returns the path to the file.
|
|
|
|
@ -1500,7 +1505,8 @@ y_fs_file_createWithParents(y_Path path) y_allnonnull;
|
|
|
|
|
* @pre @a prefix must be valid.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_temp(y_Path* path, y_Path dir, y_Path prefix) y_allnonnull;
|
|
|
|
|
y_fs_file_temp(y_Path* path, y_Path dir,
|
|
|
|
|
y_Path prefix) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A cross-platform fopen.
|
|
|
|
@ -1512,7 +1518,7 @@ y_fs_file_temp(y_Path* path, y_Path dir, y_Path prefix) y_allnonnull;
|
|
|
|
|
* @pre @a path.a must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_open(y_File* f, y_Path path, y_u8 mode) y_allnonnull;
|
|
|
|
|
y_fs_file_open(y_File* f, y_Path path, y_u8 mode) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A cross-platform fopen that safely opens all directories above, starting at
|
|
|
|
@ -1533,7 +1539,7 @@ y_fs_file_open(y_File* f, y_Path path, y_u8 mode) y_allnonnull;
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_openAt(y_File* f, y_Dir parent, y_Path path, y_u8 mode)
|
|
|
|
|
y_paramsnonnull(1);
|
|
|
|
|
y_paramsnonnull(1) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the realpath of @a path and open it, checking that the file at the
|
|
|
|
@ -1552,7 +1558,7 @@ y_fs_file_openAt(y_File* f, y_Dir parent, y_Path path, y_u8 mode)
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_openRealpath(y_File* f, y_Path* realpath, y_Path path,
|
|
|
|
|
y_u8 mode) y_allnonnull;
|
|
|
|
|
y_u8 mode) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the realpath of @a path and open it, checking that the file at the
|
|
|
|
@ -1573,7 +1579,7 @@ y_fs_file_openRealpath(y_File* f, y_Path* realpath, y_Path path,
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_openAtRealpath(y_File* f, y_Path* realpath, y_Dir parent, y_Path path,
|
|
|
|
|
y_u8 mode) y_allnonnull;
|
|
|
|
|
y_u8 mode) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets information about an open file.
|
|
|
|
@ -1585,7 +1591,7 @@ y_fs_file_openAtRealpath(y_File* f, y_Path* realpath, y_Dir parent, y_Path path,
|
|
|
|
|
* @pre @a st must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_stat(y_File f, y_Stat* st) y_allnonnull;
|
|
|
|
|
y_fs_file_stat(y_File f, y_Stat* st) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The type of seeks available on files.
|
|
|
|
@ -1613,7 +1619,8 @@ typedef enum
|
|
|
|
|
* @pre @a f must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_seek(y_File f, y_FileSeek seek, y_offset off) y_allnonnull;
|
|
|
|
|
y_fs_file_seek(y_File f, y_FileSeek seek,
|
|
|
|
|
y_offset off) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the length of a file. If the file size cannot be set, such as if the
|
|
|
|
@ -1626,7 +1633,7 @@ y_fs_file_seek(y_File f, y_FileSeek seek, y_offset off) y_allnonnull;
|
|
|
|
|
* @pre @a f must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_truncate(y_File f, y_offset len) y_allnonnull;
|
|
|
|
|
y_fs_file_truncate(y_File f, y_offset len) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the size of a file.
|
|
|
|
@ -1638,7 +1645,7 @@ y_fs_file_truncate(y_File f, y_offset len) y_allnonnull;
|
|
|
|
|
* @pre @a size must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_size(y_File f, y_ullong* size) y_allnonnull;
|
|
|
|
|
y_fs_file_size(y_File f, y_ullong* size) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Syncs a file to disk. This ensures that the file persists. If the file is not
|
|
|
|
@ -1654,7 +1661,7 @@ y_fs_file_size(y_File f, y_ullong* size) y_allnonnull;
|
|
|
|
|
* @pre @a f must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_sync(y_File f, y_uint ndirs) y_allnonnull y_inline;
|
|
|
|
|
y_fs_file_sync(y_File f, y_uint ndirs) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copies a file to a new path. The new file is a copy, not a link. If the
|
|
|
|
@ -1664,7 +1671,7 @@ y_fs_file_sync(y_File f, y_uint ndirs) y_allnonnull y_inline;
|
|
|
|
|
* @return An error code, if any.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_file_copy(y_Path dest, y_Path src);
|
|
|
|
|
y_fs_file_copy(y_Path dest, y_Path src) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes a file and destroys it. Because this cannot return any error code in
|
|
|
|
@ -1682,7 +1689,7 @@ y_fs_file_close(void* file) y_allnonnull y_inline;
|
|
|
|
|
* @return An error code, if any.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_putc(y_uchar c);
|
|
|
|
|
y_putc(y_uchar c) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints a character to stderr.
|
|
|
|
@ -1690,7 +1697,7 @@ y_putc(y_uchar c);
|
|
|
|
|
* @return An error code, if any.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_eputc(y_uchar c);
|
|
|
|
|
y_eputc(y_uchar c) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints a character to a file.
|
|
|
|
@ -1701,7 +1708,7 @@ y_eputc(y_uchar c);
|
|
|
|
|
* @pre @a f must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fputc(y_File f, y_uchar c) y_allnonnull;
|
|
|
|
|
y_fputc(y_File f, y_uchar c) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a character from stdin.
|
|
|
|
@ -1710,7 +1717,7 @@ y_fputc(y_File f, y_uchar c) y_allnonnull;
|
|
|
|
|
* @pre @a c must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_getc(y_uchar* c) y_allnonnull;
|
|
|
|
|
y_getc(y_uchar* c) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a character from a file.
|
|
|
|
@ -1720,7 +1727,7 @@ y_getc(y_uchar* c) y_allnonnull;
|
|
|
|
|
* @pre @a c must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fgetc(y_File f, y_uchar* c) y_allnonnull;
|
|
|
|
|
y_fgetc(y_File f, y_uchar* c) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints a string to stdout.
|
|
|
|
@ -1729,7 +1736,7 @@ y_fgetc(y_File f, y_uchar* c) y_allnonnull;
|
|
|
|
|
* @pre @a str must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_puts(const char* str) y_allnonnull y_inline;
|
|
|
|
|
y_puts(const char* str) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints a string to stderr.
|
|
|
|
@ -1738,7 +1745,7 @@ y_puts(const char* str) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a str must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_eputs(const char* str) y_allnonnull y_inline;
|
|
|
|
|
y_eputs(const char* str) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints a string to a file.
|
|
|
|
@ -1750,7 +1757,7 @@ y_eputs(const char* str) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a str must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fputs(y_File f, const char* str) y_allnonnull;
|
|
|
|
|
y_fputs(y_File f, const char* str) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a line from stdin. A max of @a n - 1 characters are read. This is
|
|
|
|
@ -1764,7 +1771,7 @@ y_fputs(y_File f, const char* str) y_allnonnull;
|
|
|
|
|
* @pre @a buf must be at least @a n bytes.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_gets(y_uchar* buf, y_usize n, y_usize* nread) y_paramsnonnull(1);
|
|
|
|
|
y_gets(y_uchar* buf, y_usize n, y_usize* nread) y_paramsnonnull(1) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a line from a file. A max of @a n - 1 characters are read. This is
|
|
|
|
@ -1782,7 +1789,7 @@ y_gets(y_uchar* buf, y_usize n, y_usize* nread) y_paramsnonnull(1);
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fgets(y_File f, y_uchar* buf, y_usize n, y_usize* nread)
|
|
|
|
|
y_paramsnonnull(1, 2);
|
|
|
|
|
y_paramsnonnull(1, 2) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
// TODO: Make it so the printf functions can return the number of characters
|
|
|
|
|
// printed, probably with a pointer argument.
|
|
|
|
@ -1795,7 +1802,8 @@ y_fgets(y_File f, y_uchar* buf, y_usize n, y_usize* nread)
|
|
|
|
|
* @pre @a fmt must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_printf(const char* const fmt, ...) y_allnonnull y_inline y_formatprintf(1, 2);
|
|
|
|
|
y_printf(const char* const fmt, ...) y_allnonnull y_nodiscard y_inline
|
|
|
|
|
y_formatprintf(1, 2);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints formatted output to stderr. The formatting is exactly according to the
|
|
|
|
@ -1805,7 +1813,7 @@ y_printf(const char* const fmt, ...) y_allnonnull y_inline y_formatprintf(1, 2);
|
|
|
|
|
* @pre @a fmt must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_eprintf(const char* const fmt, ...) y_allnonnull y_inline
|
|
|
|
|
y_eprintf(const char* const fmt, ...) y_allnonnull y_nodiscard y_inline
|
|
|
|
|
y_formatprintf(1, 2);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1819,7 +1827,7 @@ y_eprintf(const char* const fmt, ...) y_allnonnull y_inline
|
|
|
|
|
* @pre @a fmt must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fprintf(y_File f, const char* const fmt, ...) y_allnonnull
|
|
|
|
|
y_fprintf(y_File f, const char* const fmt, ...) y_allnonnull y_nodiscard
|
|
|
|
|
y_formatprintf(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1833,7 +1841,8 @@ y_fprintf(y_File f, const char* const fmt, ...) y_allnonnull
|
|
|
|
|
* @pre @a args must be valid.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_vprintf(const char* const fmt, va_list args) y_allnonnull y_inline;
|
|
|
|
|
y_vprintf(const char* const fmt,
|
|
|
|
|
va_list args) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints formatted output to stderr using a va_list. The formatting is exactly
|
|
|
|
@ -1846,7 +1855,8 @@ y_vprintf(const char* const fmt, va_list args) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a args must be valid.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_veprintf(const char* const fmt, va_list args) y_allnonnull y_inline;
|
|
|
|
|
y_veprintf(const char* const fmt,
|
|
|
|
|
va_list args) y_allnonnull y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Prints formatted output to a file using a va_list. The formatting is exactly
|
|
|
|
@ -1862,7 +1872,8 @@ y_veprintf(const char* const fmt, va_list args) y_allnonnull y_inline;
|
|
|
|
|
* @pre @a args must be valid.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_vfprintf(y_File f, const char* const fmt, va_list args) y_allnonnull;
|
|
|
|
|
y_vfprintf(y_File f, const char* const fmt,
|
|
|
|
|
va_list args) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reads at most @a n characters from stdin into @a buf. The number of
|
|
|
|
@ -1875,7 +1886,8 @@ y_vfprintf(y_File f, const char* const fmt, va_list args) y_allnonnull;
|
|
|
|
|
* @pre @a buf must have at least @a n bytes of space.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_read(y_uchar* buf, y_usize n, y_usize* nread) y_paramsnonnull(1) y_inline;
|
|
|
|
|
y_read(y_uchar* buf, y_usize n, y_usize* nread)
|
|
|
|
|
y_paramsnonnull(1) y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reads at most @a n characters from a file into @a buf. The number of
|
|
|
|
@ -1891,7 +1903,7 @@ y_read(y_uchar* buf, y_usize n, y_usize* nread) y_paramsnonnull(1) y_inline;
|
|
|
|
|
* @pre @a buf must have at least @a n bytes of space.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fread(y_File f, y_uchar* buf, y_usize n, y_usize* nread) y_inline
|
|
|
|
|
y_fread(y_File f, y_uchar* buf, y_usize n, y_usize* nread) y_nodiscard y_inline
|
|
|
|
|
y_paramsnonnull(1, 2);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -1906,7 +1918,7 @@ y_fread(y_File f, y_uchar* buf, y_usize n, y_usize* nread) y_inline
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_write(const char* buf, y_usize n, y_usize* nwritten)
|
|
|
|
|
y_paramsnonnull(1) y_inline;
|
|
|
|
|
y_paramsnonnull(1) y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Writes at most @a n characters from @a buf to a file. The number of
|
|
|
|
@ -1923,21 +1935,21 @@ y_write(const char* buf, y_usize n, y_usize* nwritten)
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fwrite(y_File f, const char* buf, y_usize n, y_usize* nwritten)
|
|
|
|
|
y_paramsnonnull(1, 2);
|
|
|
|
|
y_paramsnonnull(1, 2) y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Flushes stdout.
|
|
|
|
|
* @return An error code, if any.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_flush(void) y_inline;
|
|
|
|
|
y_flush(void) y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Flushes stderr.
|
|
|
|
|
* @return An error code, if any.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_eflush(void) y_inline;
|
|
|
|
|
y_eflush(void) y_nodiscard y_inline;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Flushes a file.
|
|
|
|
@ -1947,7 +1959,7 @@ y_eflush(void) y_inline;
|
|
|
|
|
* @pre @a f must have been opened.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fflush(y_File f) y_allnonnull;
|
|
|
|
|
y_fflush(y_File f) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reads the entirety of the file at @a path and returns a @a y_FileBytes (byte
|
|
|
|
@ -1962,7 +1974,8 @@ y_fflush(y_File f) y_allnonnull;
|
|
|
|
|
* @pre @a bytes must not be NULL.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_filebytes_read(y_FileBytes* bytes, y_Path path, bool binary) y_allnonnull;
|
|
|
|
|
y_fs_filebytes_read(y_FileBytes* bytes, y_Path path,
|
|
|
|
|
bool binary) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reads the entirety of the file @a file and returns a @a y_FileBytes (byte
|
|
|
|
@ -1982,7 +1995,7 @@ y_fs_filebytes_read(y_FileBytes* bytes, y_Path path, bool binary) y_allnonnull;
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_filebytes_fread(y_FileBytes* bytes, y_File file, y_ullong size,
|
|
|
|
|
bool binary) y_allnonnull;
|
|
|
|
|
bool binary) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reads the entirety of the file at @a path and returns a @a y_FileBytes (byte
|
|
|
|
@ -1999,7 +2012,8 @@ y_fs_filebytes_fread(y_FileBytes* bytes, y_File file, y_ullong size,
|
|
|
|
|
* @pre @a path must be valid.
|
|
|
|
|
*/
|
|
|
|
|
y_Status
|
|
|
|
|
y_fs_filebytes_sread(y_FileBytes* bytes, y_Path path, bool binary) y_allnonnull;
|
|
|
|
|
y_fs_filebytes_sread(y_FileBytes* bytes, y_Path path,
|
|
|
|
|
bool binary) y_allnonnull y_nodiscard;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @}
|
|
|
|
|