Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 65 lines (48 sloc) 1.349 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
/*
* See Licensing and Copyright notice in naev.h
*/



#ifndef NSTD_H
# define NSTD_H


#include <ctype.h>

#include "SDL.h"


/**
* @brief Checks to see if k is in ascii area.
*/
#define nstd_checkascii(k) ((k & 0xff) == k)


/**
* @brief Checks to see if a key is alpha.
*/
#define nstd_isalpha(k) (nstd_checkascii(k) ? isalpha(k) : 0)
/**
* @brief Checks to see if a key is alphanumeric.
*/
#define nstd_isalnum(k) (nstd_checkascii(k) ? isalnum(k) : 0)
/**
* @brief Checks to see if a key is a control character.
*/
#define nstd_iscntrl(k) (nstd_checkascii(k) ? iscntrl(k) : 0)
/**
* @brief Checks to see if a key is a space character.
*/
#define nstd_isspace(k) (nstd_checkascii(k) ? isspace(k) : 0)
/**
* @brief Checks to see if a character is printable.
*/
#define nstd_isgraph(k) (nstd_checkascii(k) ? isgraph(k) : 0)


/**
* @brief Converts a key to lowercase if applicable.
*/
#define nstd_tolower(k) (nstd_checkascii(k) ? (SDLKey)tolower(k) : k)
/**
* @brief Converts a key to uppercase if applicable.
*/
#define nstd_toupper(k) (nstd_checkascii(k) ? (SDLKey)toupper(k) : k)


/* Adds STRCASECMP. */
#if HAS_WIN32
#include <shlwapi.h>
#define STRCASECMP lstrcmpiA
#else /* HAS_WIN32 */
#include <strings.h>
#define STRCASECMP strcasecmp
#endif /* HAS_WIN32 */


#endif /* NSTD_H */
Something went wrong with that request. Please try again.