1226031Sstas/* 2226031Sstas * Copyright (c) 2004 Kungliga Tekniska H��gskolan 3226031Sstas * (Royal Institute of Technology, Stockholm, Sweden). 4226031Sstas * All rights reserved. 5226031Sstas * 6226031Sstas * Redistribution and use in source and binary forms, with or without 7226031Sstas * modification, are permitted provided that the following conditions 8226031Sstas * are met: 9226031Sstas * 10226031Sstas * 1. Redistributions of source code must retain the above copyright 11226031Sstas * notice, this list of conditions and the following disclaimer. 12226031Sstas * 13226031Sstas * 2. Redistributions in binary form must reproduce the above copyright 14226031Sstas * notice, this list of conditions and the following disclaimer in the 15226031Sstas * documentation and/or other materials provided with the distribution. 16226031Sstas * 17226031Sstas * 3. Neither the name of the Institute nor the names of its contributors 18226031Sstas * may be used to endorse or promote products derived from this software 19226031Sstas * without specific prior written permission. 20226031Sstas * 21226031Sstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22226031Sstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23226031Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24226031Sstas * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25226031Sstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26226031Sstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27226031Sstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28226031Sstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29226031Sstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30226031Sstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31226031Sstas * SUCH DAMAGE. 32226031Sstas */ 33226031Sstas 34226031Sstas#ifdef HAVE_CONFIG_H 35226031Sstas#include <config.h> 36226031Sstas#endif 37226031Sstas#include <stdio.h> 38226031Sstas#include "windlocl.h" 39226031Sstas 40226031Sstasstatic uint32_t positives[] = { 41226031Sstas 0x00A0, 0x3000, 42226031Sstas 0x0080, 0x009F, 0x206A, 0x206F, 0xFEFF, 43226031Sstas 0xFFF9, 0xFFFD, 0xFFFE, 0xFFFF, 44226031Sstas 0x1D173, 0x1D17A, 45226031Sstas 0xE000, 0xF8FF, 0xF0000, 0xFFFFD, 46226031Sstas 0x100000, 0x10FFFD, 47226031Sstas 0xFDD0, 0xFDEF, 48226031Sstas 0xFFFE, 0xFFFF, 49226031Sstas 0x1FFFE, 0x1FFFF, 50226031Sstas 0x2FFFE, 0x2FFFF, 51226031Sstas 0x3FFFE, 0x3FFFF, 52226031Sstas 0x4FFFE, 0x4FFFF, 53226031Sstas 0x5FFFE, 0x5FFFF, 54226031Sstas 0x6FFFE, 0x6FFFF, 55226031Sstas 0x7FFFE, 0x7FFFF, 56226031Sstas 0x8FFFE, 0x8FFFF, 57226031Sstas 0x9FFFE, 0x9FFFF, 58226031Sstas 0xAFFFE, 0xAFFFF, 59226031Sstas 0xBFFFE, 0xBFFFF, 60226031Sstas 0xCFFFE, 0xCFFFF, 61226031Sstas 0xDFFFE, 0xDFFFF, 62226031Sstas 0xEFFFE, 0xEFFFF, 63226031Sstas 0xFFFFE, 0xFFFFF, 64226031Sstas 0x10FFFE, 0x10FFFF, 65226031Sstas 0xD800, 0xDFFF, 66226031Sstas 0xFFF9, 67226031Sstas 0xFFFA, 68226031Sstas 0xFFFB, 69226031Sstas 0xFFFC, 70226031Sstas 0x2FF0, 0x2FFB, 71226031Sstas 0x0340, 72226031Sstas 0x0341, 73226031Sstas 0x200E, 74226031Sstas 0x200F, 75226031Sstas 0x202A, 76226031Sstas 0x202B, 77226031Sstas 0x202C, 78226031Sstas 0x202D, 79226031Sstas 0x202E, 80226031Sstas 0x206A, 81226031Sstas 0x206B, 82226031Sstas 0x206C, 83226031Sstas 0x206D, 84226031Sstas 0x206E, 85226031Sstas 0x206F, 86226031Sstas 0xE0001, 87226031Sstas 0xE0020, 88226031Sstas 0xE007F, 89226031Sstas}; 90226031Sstas 91226031Sstasstatic uint32_t negatives[] = { 92226031Sstas 0x0000, 0x001F, 0x007F, 93226031Sstas 0x0020, 0x2069, 0x2070, 0x0FFF8, 94226031Sstas 0x1D172, 0x1D17B, 95226031Sstas 0xF900, 96226031Sstas 0xFDCF, 0xFDF0, 97226031Sstas 0x10000, 98226031Sstas 0x1FFFD, 0x20000, 99226031Sstas 0x2FFFD, 0x30000, 100226031Sstas 0x3FFFD, 0x40000, 101226031Sstas 0x4FFFD, 0x50000, 102226031Sstas 0x5FFFD, 0x60000, 103226031Sstas 0x6FFFD, 0x70000, 104226031Sstas 0x7FFFD, 0x80000, 105226031Sstas 0x8FFFD, 0x90000, 106226031Sstas 0x9FFFD, 0xA0000, 107226031Sstas 0xAFFFD, 0xB0000, 108226031Sstas 0xBFFFD, 0xC0000, 109226031Sstas 0xCFFFD, 0xD0000, 110226031Sstas 0xDFFFD, 0xE0000, 111226031Sstas 0xEFFFD, 112226031Sstas 0x110000, 113226031Sstas 0xD7FF, 114226031Sstas 0xFFF8, 115226031Sstas 0x2FEF, 0x2FFC, 116226031Sstas}; 117226031Sstas 118226031Sstasint 119226031Sstasmain(void) 120226031Sstas{ 121226031Sstas unsigned i; 122226031Sstas unsigned failures = 0; 123226031Sstas 124226031Sstas for (i = 0; i < sizeof(positives)/sizeof(positives[0]); ++i) 125226031Sstas if (!_wind_stringprep_error(positives[i], WIND_PROFILE_NAME)) { 126226031Sstas printf ("code-point 0x%x not marked as prohibited\n", 127226031Sstas positives[i]); 128226031Sstas ++failures; 129226031Sstas } 130226031Sstas 131226031Sstas for (i = 0; i < sizeof(negatives)/sizeof(negatives[0]); ++i) 132226031Sstas if (_wind_stringprep_error(negatives[i], WIND_PROFILE_NAME)) { 133226031Sstas printf ("code-point 0x%x not marked as non-prohibited\n", 134226031Sstas negatives[i]); 135226031Sstas ++failures; 136226031Sstas } 137226031Sstas return failures != 0; 138226031Sstas} 139