2016-10-17 08:57:44 -07:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright © 2016 Project Golan
|
|
|
|
//
|
|
|
|
// See "LICENSE" for more information.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Miscallaneous library functions.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef lithos3__Lth_stdlib_h
|
|
|
|
#define lithos3__Lth_stdlib_h
|
|
|
|
|
2016-10-21 11:49:11 -07:00
|
|
|
#include <stdio.h>
|
2016-10-21 11:47:55 -07:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2016-10-20 16:55:35 -07:00
|
|
|
#define Lth_isidenti(ch) \
|
2016-10-21 14:13:29 -07:00
|
|
|
(isalpha(ch) || isdigit(ch) || ch == '_' || ch == '$' || ch == '\'' || \
|
|
|
|
ch >= 0x80)
|
2016-10-20 16:55:35 -07:00
|
|
|
|
2016-10-21 11:47:55 -07:00
|
|
|
// Post-for. Sort of.
|
|
|
|
#define Lth_pfor(cond, expr) while((cond) && ((expr), true))
|
|
|
|
|
2016-10-17 08:57:44 -07:00
|
|
|
|
2016-10-18 14:20:32 -07:00
|
|
|
// Extern Functions ----------------------------------------------------------|
|
2016-10-17 08:57:44 -07:00
|
|
|
|
2016-10-21 11:49:11 -07:00
|
|
|
// file
|
|
|
|
int Lth_fpeekc(FILE *fp);
|
|
|
|
|
2016-10-19 07:00:10 -07:00
|
|
|
// str
|
2016-10-17 08:57:44 -07:00
|
|
|
char *Lth_strdup(char const *s);
|
2016-10-19 07:00:10 -07:00
|
|
|
char *Lth_strdup_str(__str s);
|
|
|
|
__str Lth_strentdup(char const *s);
|
|
|
|
__str Lth_strlocal(__str s);
|
2016-10-21 11:49:11 -07:00
|
|
|
char *Lth_strealoc(char *p, char const *s);
|
|
|
|
char *Lth_strealoc_str(char *p, __str s);
|
|
|
|
bool Lth_strcontains(char const *s, char ch);
|
2016-10-19 07:00:10 -07:00
|
|
|
|
|
|
|
// Print
|
2016-10-17 08:57:44 -07:00
|
|
|
void Lth_PrintString(char const *s);
|
|
|
|
|
2016-10-19 07:03:32 -07:00
|
|
|
// Hash
|
|
|
|
size_t Lth_Hash_char(char const *s);
|
2016-10-21 14:55:00 -07:00
|
|
|
size_t Lth_Hash_str(char __str_ars const *s);
|
2016-10-19 07:03:32 -07:00
|
|
|
|
2016-10-17 08:57:44 -07:00
|
|
|
#endif//lithos3__Lth_stdlib_h
|