/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-â
âvi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8                                :viâ
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ¡
â Copyright 2020 Justine Alexandra Roberts Tunney                              â
â                                                                              â
â Permission to use, copy, modify, and/or distribute this software for         â
â any purpose with or without fee is hereby granted, provided that the         â
â above copyright notice and this permission notice appear in all copies.      â
â                                                                              â
â THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL                â
â WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED                â
â WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE             â
â AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL         â
â DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR        â
â PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER               â
â TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR             â
â PERFORMANCE OF THIS SOFTWARE.                                                â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ*/
#include "libc/str/str.h"

/**
 * Returns nonzero if c is uppercase letter.
 */
int iswupper(wint_t c) {
  int r;
  if (c < 0200) {
    return 'A' <= c && c <= 'Z';
  } else {
    if (towlower(c) != c) return 1;
    switch (c) {
      case 0x03d2:  /* Ï Greek */
      case 0x03d3:  /* Ï Greek */
      case 0x03d4:  /* Ï Greek */
      case 0x2102:  /* â Letterlike */
      case 0x2107:  /* â Letterlike */
      case 0x210b:  /* â Letterlike */
      case 0x210c:  /* â Letterlike */
      case 0x210d:  /* â Letterlike */
      case 0x2110:  /* â Letterlike */
      case 0x2111:  /* â Letterlike */
      case 0x2112:  /* â Letterlike */
      case 0x2115:  /* â Letterlike */
      case 0x2119:  /* â Letterlike */
      case 0x211a:  /* â Letterlike */
      case 0x211b:  /* â Letterlike */
      case 0x211c:  /* â Letterlike */
      case 0x211d:  /* â Letterlike */
      case 0x2124:  /* â¤ Letterlike */
      case 0x2128:  /* â¨ Letterlike */
      case 0x212c:  /* â¬ Letterlike */
      case 0x212d:  /* â­ Letterlike */
      case 0x2130:  /* â° Letterlike */
      case 0x2131:  /* â± Letterlike */
      case 0x2133:  /* â³ Letterlike */
      case 0x213e:  /* â¾ Letterlike */
      case 0x213f:  /* â¿ Letterlike */
      case 0x2145:  /* â Letterlike */
      case 0x1d434: /* ð´ Math */
      case 0x1d435: /* ðµ Math */
      case 0x1d436: /* ð¶ Math */
      case 0x1d437: /* ð· Math */
      case 0x1d438: /* ð¸ Math */
      case 0x1d439: /* ð¹ Math */
      case 0x1d43a: /* ðº Math */
      case 0x1d43b: /* ð» Math */
      case 0x1d49c: /* ð Math */
      case 0x1d49e: /* ð Math */
      case 0x1d49f: /* ð Math */
      case 0x1d4a2: /* ð¢ Math */
      case 0x1d4a5: /* ð¥ Math */
      case 0x1d4a6: /* ð¦ Math */
      case 0x1d4a9: /* ð© Math */
      case 0x1d4aa: /* ðª Math */
      case 0x1d4ab: /* ð« Math */
      case 0x1d4ac: /* ð¬ Math */
      case 0x1d504: /* ð Math */
      case 0x1d505: /* ð Math */
      case 0x1d507: /* ð Math */
      case 0x1d508: /* ð Math */
      case 0x1d509: /* ð Math */
      case 0x1d50a: /* ð Math */
      case 0x1d516: /* ð Math */
      case 0x1d517: /* ð Math */
      case 0x1d518: /* ð Math */
      case 0x1d519: /* ð Math */
      case 0x1d51a: /* ð Math */
      case 0x1d51b: /* ð Math */
      case 0x1d51c: /* ð Math */
      case 0x1d538: /* ð¸ Math */
      case 0x1d539: /* ð¹ Math */
      case 0x1d53b: /* ð» Math */
      case 0x1d53c: /* ð¼ Math */
      case 0x1d53d: /* ð½ Math */
      case 0x1d53e: /* ð¾ Math */
      case 0x1d540: /* ð Math */
      case 0x1d541: /* ð Math */
      case 0x1d542: /* ð Math */
      case 0x1d543: /* ð Math */
      case 0x1d544: /* ð Math */
      case 0x1d546: /* ð Math */
      case 0x1d54a: /* ð Math */
      case 0x1d54b: /* ð Math */
      case 0x1d54c: /* ð Math */
      case 0x1d54d: /* ð Math */
      case 0x1d54e: /* ð Math */
      case 0x1d54f: /* ð Math */
      case 0x1d550: /* ð Math */
      case 0x1d6e3: /* ð£ Math */
      case 0x1d6e4: /* ð¤ Math */
      case 0x1d6e5: /* ð¥ Math */
      case 0x1d6e6: /* ð¦ Math */
      case 0x1d6e7: /* ð§ Math */
      case 0x1d6e8: /* ð¨ Math */
      case 0x1d6e9: /* ð© Math */
      case 0x1d6ea: /* ðª Math */
      case 0x1d6eb: /* ð« Math */
      case 0x1d6ec: /* ð¬ Math */
      case 0x1d6ed: /* ð­ Math */
      case 0x1d6ee: /* ð® Math */
      case 0x1d6ef: /* ð¯ Math */
      case 0x1d6f0: /* ð° Math */
      case 0x1d6f1: /* ð± Math */
      case 0x1d6f2: /* ð² Math */
      case 0x1d6f3: /* ð³ Math */
      case 0x1d6f4: /* ð´ Math */
      case 0x1d6f5: /* ðµ Math */
      case 0x1d6f6: /* ð¶ Math */
      case 0x1d6f7: /* ð· Math */
      case 0x1d6f8: /* ð¸ Math */
      case 0x1d6f9: /* ð¹ Math */
      case 0x1d6fa: /* ðº Math */
      case 0x1d72d: /* ð­ Math */
      case 0x1d72e: /* ð® Math */
      case 0x1d72f: /* ð¯ Math */
      case 0x1d730: /* ð° Math */
      case 0x1d731: /* ð± Math */
      case 0x1d732: /* ð² Math */
      case 0x1d733: /* ð³ Math */
      case 0x1d734: /* ð´ Math */
      case 0x1d767: /* ð§ Math */
      case 0x1d768: /* ð¨ Math */
      case 0x1d769: /* ð© Math */
      case 0x1d76a: /* ðª Math */
      case 0x1d76b: /* ð« Math */
      case 0x1d76c: /* ð¬ Math */
      case 0x1d76d: /* ð­ Math */
      case 0x1d76e: /* ð® Math */
      case 0x1d7a1: /* ð¡ Math */
      case 0x1d7a2: /* ð¢ Math */
      case 0x1d7a3: /* ð£ Math */
      case 0x1d7a4: /* ð¤ Math */
      case 0x1d7a5: /* ð¥ Math */
      case 0x1d7a6: /* ð¦ Math */
      case 0x1d7a7: /* ð§ Math */
      case 0x1d7a8: /* ð¨ Math */
      case 0x1d7ca: /* ð Math */
        return 1;
      default:
        return 0;
    }
  }
}
