mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-28 22:18:29 +00:00
51 lines
1.6 KiB
C
51 lines
1.6 KiB
C
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
|
|
│vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
|
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
|
│ Python 3 │
|
|
│ https://docs.python.org/3/license.html │
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
|
#include "libc/dce.h"
|
|
#include "third_party/python/Include/unicodeobject.h"
|
|
/* clang-format off */
|
|
|
|
/**
|
|
* Returns 1 for Unicode characters having the bidirectional
|
|
* type 'WS', 'B' or 'S' or the category 'Zs', 0 otherwise.
|
|
*/
|
|
int _PyUnicode_IsWhitespace(const Py_UCS4 ch)
|
|
{
|
|
switch (ch) {
|
|
case 0x0009:
|
|
case 0x000A:
|
|
case 0x000B:
|
|
case 0x000C:
|
|
case 0x000D:
|
|
case 0x001C:
|
|
case 0x001D:
|
|
case 0x001E:
|
|
case 0x001F:
|
|
case 0x0020:
|
|
case 0x0085:
|
|
case 0x00A0:
|
|
case 0x1680:
|
|
case 0x2000:
|
|
case 0x2001:
|
|
case 0x2002:
|
|
case 0x2003:
|
|
case 0x2004:
|
|
case 0x2005:
|
|
case 0x2006:
|
|
case 0x2007:
|
|
case 0x2008:
|
|
case 0x2009:
|
|
case 0x200A:
|
|
case 0x2028:
|
|
case 0x2029:
|
|
case 0x202F:
|
|
case 0x205F:
|
|
case 0x3000:
|
|
return 1;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|