Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 1996, 1997, 1998 Computing Research Labs, |
michael@0 | 3 | * New Mexico State University |
michael@0 | 4 | * |
michael@0 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
michael@0 | 6 | * copy of this software and associated documentation files (the "Software"), |
michael@0 | 7 | * to deal in the Software without restriction, including without limitation |
michael@0 | 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
michael@0 | 9 | * and/or sell copies of the Software, and to permit persons to whom the |
michael@0 | 10 | * Software is furnished to do so, subject to the following conditions: |
michael@0 | 11 | * |
michael@0 | 12 | * The above copyright notice and this permission notice shall be included in |
michael@0 | 13 | * all copies or substantial portions of the Software. |
michael@0 | 14 | * |
michael@0 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
michael@0 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
michael@0 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
michael@0 | 18 | * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY |
michael@0 | 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT |
michael@0 | 20 | * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
michael@0 | 21 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
michael@0 | 22 | */ |
michael@0 | 23 | #ifndef _h_ucdata |
michael@0 | 24 | #define _h_ucdata |
michael@0 | 25 | |
michael@0 | 26 | /* |
michael@0 | 27 | * $Id: ucdata.h,v 1.1 1999/01/08 00:19:12 ftang%netscape.com Exp $ |
michael@0 | 28 | */ |
michael@0 | 29 | |
michael@0 | 30 | #ifdef __cplusplus |
michael@0 | 31 | extern "C" { |
michael@0 | 32 | #endif |
michael@0 | 33 | |
michael@0 | 34 | #undef __ |
michael@0 | 35 | #ifdef __STDC__ |
michael@0 | 36 | #define __(x) x |
michael@0 | 37 | #else |
michael@0 | 38 | #define __(x) () |
michael@0 | 39 | #endif |
michael@0 | 40 | |
michael@0 | 41 | #define UCDATA_VERSION "1.9" |
michael@0 | 42 | |
michael@0 | 43 | /************************************************************************** |
michael@0 | 44 | * |
michael@0 | 45 | * Masks and macros for character properties. |
michael@0 | 46 | * |
michael@0 | 47 | **************************************************************************/ |
michael@0 | 48 | |
michael@0 | 49 | /* |
michael@0 | 50 | * Values that can appear in the `mask1' parameter of the ucisprop() |
michael@0 | 51 | * function. |
michael@0 | 52 | */ |
michael@0 | 53 | #define UC_MN 0x00000001 /* Mark, Non-Spacing */ |
michael@0 | 54 | #define UC_MC 0x00000002 /* Mark, Spacing Combining */ |
michael@0 | 55 | #define UC_ME 0x00000004 /* Mark, Enclosing */ |
michael@0 | 56 | #define UC_ND 0x00000008 /* Number, Decimal Digit */ |
michael@0 | 57 | #define UC_NL 0x00000010 /* Number, Letter */ |
michael@0 | 58 | #define UC_NO 0x00000020 /* Number, Other */ |
michael@0 | 59 | #define UC_ZS 0x00000040 /* Separator, Space */ |
michael@0 | 60 | #define UC_ZL 0x00000080 /* Separator, Line */ |
michael@0 | 61 | #define UC_ZP 0x00000100 /* Separator, Paragraph */ |
michael@0 | 62 | #define UC_CC 0x00000200 /* Other, Control */ |
michael@0 | 63 | #define UC_CF 0x00000400 /* Other, Format */ |
michael@0 | 64 | #define UC_OS 0x00000800 /* Other, Surrogate */ |
michael@0 | 65 | #define UC_CO 0x00001000 /* Other, Private Use */ |
michael@0 | 66 | #define UC_CN 0x00002000 /* Other, Not Assigned */ |
michael@0 | 67 | #define UC_LU 0x00004000 /* Letter, Uppercase */ |
michael@0 | 68 | #define UC_LL 0x00008000 /* Letter, Lowercase */ |
michael@0 | 69 | #define UC_LT 0x00010000 /* Letter, Titlecase */ |
michael@0 | 70 | #define UC_LM 0x00020000 /* Letter, Modifier */ |
michael@0 | 71 | #define UC_LO 0x00040000 /* Letter, Other */ |
michael@0 | 72 | #define UC_PC 0x00080000 /* Punctuation, Connector */ |
michael@0 | 73 | #define UC_PD 0x00100000 /* Punctuation, Dash */ |
michael@0 | 74 | #define UC_PS 0x00200000 /* Punctuation, Open */ |
michael@0 | 75 | #define UC_PE 0x00400000 /* Punctuation, Close */ |
michael@0 | 76 | #define UC_PO 0x00800000 /* Punctuation, Other */ |
michael@0 | 77 | #define UC_SM 0x01000000 /* Symbol, Math */ |
michael@0 | 78 | #define UC_SC 0x02000000 /* Symbol, Currency */ |
michael@0 | 79 | #define UC_SK 0x04000000 /* Symbol, Modifier */ |
michael@0 | 80 | #define UC_SO 0x08000000 /* Symbol, Other */ |
michael@0 | 81 | #define UC_L 0x10000000 /* Left-To-Right */ |
michael@0 | 82 | #define UC_R 0x20000000 /* Right-To-Left */ |
michael@0 | 83 | #define UC_EN 0x40000000 /* European Number */ |
michael@0 | 84 | #define UC_ES 0x80000000 /* European Number Separator */ |
michael@0 | 85 | |
michael@0 | 86 | /* |
michael@0 | 87 | * Values that can appear in the `mask2' parameter of the ucisprop() |
michael@0 | 88 | * function. |
michael@0 | 89 | */ |
michael@0 | 90 | #define UC_ET 0x00000001 /* European Number Terminator */ |
michael@0 | 91 | #define UC_AN 0x00000002 /* Arabic Number */ |
michael@0 | 92 | #define UC_CS 0x00000004 /* Common Number Separator */ |
michael@0 | 93 | #define UC_B 0x00000008 /* Block Separator */ |
michael@0 | 94 | #define UC_S 0x00000010 /* Segment Separator */ |
michael@0 | 95 | #define UC_WS 0x00000020 /* Whitespace */ |
michael@0 | 96 | #define UC_ON 0x00000040 /* Other Neutrals */ |
michael@0 | 97 | /* |
michael@0 | 98 | * Implementation specific character properties. |
michael@0 | 99 | */ |
michael@0 | 100 | #define UC_CM 0x00000080 /* Composite */ |
michael@0 | 101 | #define UC_NB 0x00000100 /* Non-Breaking */ |
michael@0 | 102 | #define UC_SY 0x00000200 /* Symmetric */ |
michael@0 | 103 | #define UC_HD 0x00000400 /* Hex Digit */ |
michael@0 | 104 | #define UC_QM 0x00000800 /* Quote Mark */ |
michael@0 | 105 | #define UC_MR 0x00001000 /* Mirroring */ |
michael@0 | 106 | #define UC_SS 0x00002000 /* Space, other */ |
michael@0 | 107 | |
michael@0 | 108 | #define UC_CP 0x00004000 /* Defined */ |
michael@0 | 109 | |
michael@0 | 110 | /* |
michael@0 | 111 | * Added for UnicodeData-2.1.3. |
michael@0 | 112 | */ |
michael@0 | 113 | #define UC_PI 0x00008000 /* Punctuation, Initial */ |
michael@0 | 114 | #define UC_PF 0x00010000 /* Punctuation, Final */ |
michael@0 | 115 | |
michael@0 | 116 | /* |
michael@0 | 117 | * This is the primary function for testing to see if a character has some set |
michael@0 | 118 | * of properties. The macros that test for various character properties all |
michael@0 | 119 | * call this function with some set of masks. |
michael@0 | 120 | */ |
michael@0 | 121 | extern int ucisprop __((unsigned long code, unsigned long mask1, |
michael@0 | 122 | unsigned long mask2)); |
michael@0 | 123 | |
michael@0 | 124 | #define ucisalpha(cc) ucisprop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT, 0) |
michael@0 | 125 | #define ucisdigit(cc) ucisprop(cc, UC_ND, 0) |
michael@0 | 126 | #define ucisalnum(cc) ucisprop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT|UC_ND, 0) |
michael@0 | 127 | #define uciscntrl(cc) ucisprop(cc, UC_CC|UC_CF, 0) |
michael@0 | 128 | #define ucisspace(cc) ucisprop(cc, UC_ZS|UC_SS, 0) |
michael@0 | 129 | #define ucisblank(cc) ucisprop(cc, UC_ZS, 0) |
michael@0 | 130 | #define ucispunct(cc) ucisprop(cc, UC_PD|UC_PS|UC_PE|UC_PO, UC_PI|UC_PF) |
michael@0 | 131 | #define ucisgraph(cc) ucisprop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\ |
michael@0 | 132 | UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\ |
michael@0 | 133 | UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\ |
michael@0 | 134 | UC_SO, UC_PI|UC_PF) |
michael@0 | 135 | #define ucisprint(cc) ucisprop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\ |
michael@0 | 136 | UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\ |
michael@0 | 137 | UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\ |
michael@0 | 138 | UC_SO|UC_ZS, UC_PI|UC_PF) |
michael@0 | 139 | #define ucisupper(cc) ucisprop(cc, UC_LU, 0) |
michael@0 | 140 | #define ucislower(cc) ucisprop(cc, UC_LL, 0) |
michael@0 | 141 | #define ucistitle(cc) ucisprop(cc, UC_LT, 0) |
michael@0 | 142 | #define ucisxdigit(cc) ucisprop(cc, 0, UC_HD) |
michael@0 | 143 | |
michael@0 | 144 | #define ucisisocntrl(cc) ucisprop(cc, UC_CC, 0) |
michael@0 | 145 | #define ucisfmtcntrl(cc) ucisprop(cc, UC_CF, 0) |
michael@0 | 146 | |
michael@0 | 147 | #define ucissymbol(cc) ucisprop(cc, UC_SM|UC_SC|UC_SO|UC_SK, 0) |
michael@0 | 148 | #define ucisnumber(cc) ucisprop(cc, UC_ND|UC_NO|UC_NL, 0) |
michael@0 | 149 | #define ucisnonspacing(cc) ucisprop(cc, UC_MN, 0) |
michael@0 | 150 | #define ucisopenpunct(cc) ucisprop(cc, UC_PS, 0) |
michael@0 | 151 | #define ucisclosepunct(cc) ucisprop(cc, UC_PE, 0) |
michael@0 | 152 | #define ucisinitialpunct(cc) ucisprop(cc, 0, UC_PI) |
michael@0 | 153 | #define ucisfinalpunct(cc) ucisprop(cc, 0, UC_PF) |
michael@0 | 154 | |
michael@0 | 155 | #define uciscomposite(cc) ucisprop(cc, 0, UC_CM) |
michael@0 | 156 | #define ucishex(cc) ucisprop(cc, 0, UC_HD) |
michael@0 | 157 | #define ucisquote(cc) ucisprop(cc, 0, UC_QM) |
michael@0 | 158 | #define ucissymmetric(cc) ucisprop(cc, 0, UC_SY) |
michael@0 | 159 | #define ucismirroring(cc) ucisprop(cc, 0, UC_MR) |
michael@0 | 160 | #define ucisnonbreaking(cc) ucisprop(cc, 0, UC_NB) |
michael@0 | 161 | |
michael@0 | 162 | /* |
michael@0 | 163 | * Directionality macros. |
michael@0 | 164 | */ |
michael@0 | 165 | #define ucisrtl(cc) ucisprop(cc, UC_R, 0) |
michael@0 | 166 | #define ucisltr(cc) ucisprop(cc, UC_L, 0) |
michael@0 | 167 | #define ucisstrong(cc) ucisprop(cc, UC_L|UC_R, 0) |
michael@0 | 168 | #define ucisweak(cc) ucisprop(cc, UC_EN|UC_ES, UC_ET|UC_AN|UC_CS) |
michael@0 | 169 | #define ucisneutral(cc) ucisprop(cc, 0, UC_B|UC_S|UC_WS|UC_ON) |
michael@0 | 170 | #define ucisseparator(cc) ucisprop(cc, 0, UC_B|UC_S) |
michael@0 | 171 | |
michael@0 | 172 | /* |
michael@0 | 173 | * Other macros inspired by John Cowan. |
michael@0 | 174 | */ |
michael@0 | 175 | #define ucismark(cc) ucisprop(cc, UC_MN|UC_MC|UC_ME, 0) |
michael@0 | 176 | #define ucismodif(cc) ucisprop(cc, UC_LM, 0) |
michael@0 | 177 | #define ucisletnum(cc) ucisprop(cc, UC_NL, 0) |
michael@0 | 178 | #define ucisconnect(cc) ucisprop(cc, UC_PC, 0) |
michael@0 | 179 | #define ucisdash(cc) ucisprop(cc, UC_PD, 0) |
michael@0 | 180 | #define ucismath(cc) ucisprop(cc, UC_SM, 0) |
michael@0 | 181 | #define uciscurrency(cc) ucisprop(cc, UC_SC, 0) |
michael@0 | 182 | #define ucismodifsymbol(cc) ucisprop(cc, UC_SK, 0) |
michael@0 | 183 | #define ucisnsmark(cc) ucisprop(cc, UC_MN, 0) |
michael@0 | 184 | #define ucisspmark(cc) ucisprop(cc, UC_MC, 0) |
michael@0 | 185 | #define ucisenclosing(cc) ucisprop(cc, UC_ME, 0) |
michael@0 | 186 | #define ucisprivate(cc) ucisprop(cc, UC_CO, 0) |
michael@0 | 187 | #define ucissurrogate(cc) ucisprop(cc, UC_OS, 0) |
michael@0 | 188 | #define ucislsep(cc) ucisprop(cc, UC_ZL, 0) |
michael@0 | 189 | #define ucispsep(cc) ucisprop(cc, UC_ZP, 0) |
michael@0 | 190 | |
michael@0 | 191 | #define ucisidentstart(cc) ucisprop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL, 0) |
michael@0 | 192 | #define ucisidentpart(cc) ucisprop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL|\ |
michael@0 | 193 | UC_MN|UC_MC|UC_ND|UC_PC|UC_CF, 0) |
michael@0 | 194 | |
michael@0 | 195 | #define ucisdefined(cc) ucisprop(cc, 0, UC_CP) |
michael@0 | 196 | #define ucisundefined(cc) !ucisprop(cc, 0, UC_CP) |
michael@0 | 197 | |
michael@0 | 198 | /* |
michael@0 | 199 | * Other miscellaneous character property macros. |
michael@0 | 200 | */ |
michael@0 | 201 | #define ucishan(cc) (((cc) >= 0x4e00 && (cc) <= 0x9fff) ||\ |
michael@0 | 202 | ((cc) >= 0xf900 && (cc) <= 0xfaff)) |
michael@0 | 203 | #define ucishangul(cc) ((cc) >= 0xac00 && (cc) <= 0xd7ff) |
michael@0 | 204 | |
michael@0 | 205 | /************************************************************************** |
michael@0 | 206 | * |
michael@0 | 207 | * Functions for case conversion. |
michael@0 | 208 | * |
michael@0 | 209 | **************************************************************************/ |
michael@0 | 210 | |
michael@0 | 211 | extern unsigned long uctoupper __((unsigned long code)); |
michael@0 | 212 | extern unsigned long uctolower __((unsigned long code)); |
michael@0 | 213 | extern unsigned long uctotitle __((unsigned long code)); |
michael@0 | 214 | |
michael@0 | 215 | /************************************************************************** |
michael@0 | 216 | * |
michael@0 | 217 | * Functions for getting decompositions. |
michael@0 | 218 | * |
michael@0 | 219 | **************************************************************************/ |
michael@0 | 220 | |
michael@0 | 221 | /* |
michael@0 | 222 | * This routine determines if the code has a decomposition. If it returns 0, |
michael@0 | 223 | * there is no decomposition. Any other value indicates a decomposition was |
michael@0 | 224 | * returned. |
michael@0 | 225 | */ |
michael@0 | 226 | extern int ucdecomp __((unsigned long code, unsigned long *num, |
michael@0 | 227 | |
michael@0 | 228 | unsigned long **decomp)); |
michael@0 | 229 | |
michael@0 | 230 | /* |
michael@0 | 231 | * If the code is a Hangul syllable, this routine decomposes it into the array |
michael@0 | 232 | * passed. The array size should be at least 3. |
michael@0 | 233 | */ |
michael@0 | 234 | extern int ucdecomp_hangul __((unsigned long code, unsigned long *num, |
michael@0 | 235 | unsigned long decomp[])); |
michael@0 | 236 | |
michael@0 | 237 | /************************************************************************** |
michael@0 | 238 | * |
michael@0 | 239 | * Functions for getting combining classes. |
michael@0 | 240 | * |
michael@0 | 241 | **************************************************************************/ |
michael@0 | 242 | |
michael@0 | 243 | /* |
michael@0 | 244 | * This will return the combining class for a character to be used with the |
michael@0 | 245 | * Canonical Ordering algorithm. |
michael@0 | 246 | */ |
michael@0 | 247 | extern unsigned long uccombining_class __((unsigned long code)); |
michael@0 | 248 | |
michael@0 | 249 | /************************************************************************** |
michael@0 | 250 | * |
michael@0 | 251 | * Functions for getting numbers and digits. |
michael@0 | 252 | * |
michael@0 | 253 | **************************************************************************/ |
michael@0 | 254 | |
michael@0 | 255 | struct ucnumber { |
michael@0 | 256 | int numerator; |
michael@0 | 257 | int denominator; |
michael@0 | 258 | }; |
michael@0 | 259 | |
michael@0 | 260 | extern int ucnumber_lookup __((unsigned long code, struct ucnumber *num)); |
michael@0 | 261 | extern int ucdigit_lookup __((unsigned long code, int *digit)); |
michael@0 | 262 | |
michael@0 | 263 | /* |
michael@0 | 264 | * For compatibility with John Cowan's "uctype" package. |
michael@0 | 265 | */ |
michael@0 | 266 | extern struct ucnumber ucgetnumber __((unsigned long code)); |
michael@0 | 267 | extern int ucgetdigit __((unsigned long code)); |
michael@0 | 268 | |
michael@0 | 269 | /************************************************************************** |
michael@0 | 270 | * |
michael@0 | 271 | * Functions library initialization and cleanup. |
michael@0 | 272 | * |
michael@0 | 273 | **************************************************************************/ |
michael@0 | 274 | |
michael@0 | 275 | /* |
michael@0 | 276 | * Macros for specifying the data tables to be loaded for ucdata_load(). |
michael@0 | 277 | */ |
michael@0 | 278 | #define UCDATA_CASE 0x01 |
michael@0 | 279 | #define UCDATA_CTYPE 0x02 |
michael@0 | 280 | #define UCDATA_DECOMP 0x04 |
michael@0 | 281 | #define UCDATA_CMBCL 0x08 |
michael@0 | 282 | #define UCDATA_NUM 0x10 |
michael@0 | 283 | |
michael@0 | 284 | #define UCDATA_ALL (UCDATA_CASE|UCDATA_CTYPE|UCDATA_DECOMP|\ |
michael@0 | 285 | UCDATA_CMBCL|UCDATA_NUM) |
michael@0 | 286 | |
michael@0 | 287 | /* |
michael@0 | 288 | * Functions to load, unload, and reload specific data files. |
michael@0 | 289 | */ |
michael@0 | 290 | extern void ucdata_load __((char *paths, int mask)); |
michael@0 | 291 | extern void ucdata_unload __((int mask)); |
michael@0 | 292 | extern void ucdata_reload __((char *paths, int mask)); |
michael@0 | 293 | |
michael@0 | 294 | /* |
michael@0 | 295 | * Deprecated functions, now just compatibility macros. |
michael@0 | 296 | */ |
michael@0 | 297 | #define ucdata_setup(p) ucdata_load(p, UCDATA_ALL) |
michael@0 | 298 | #define ucdata_cleanup() ucdata_unload(UCDATA_ALL) |
michael@0 | 299 | |
michael@0 | 300 | #undef __ |
michael@0 | 301 | |
michael@0 | 302 | #ifdef __cplusplus |
michael@0 | 303 | } |
michael@0 | 304 | #endif |
michael@0 | 305 | |
michael@0 | 306 | #endif /* _h_ucdata */ |