Character.c.template revision 2362
2426N/A/*
2426N/A * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
2426N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2426N/A *
2426N/A * This code is free software; you can redistribute it and/or modify it
2426N/A * under the terms of the GNU General Public License version 2 only, as
2426N/A * published by the Free Software Foundation. Oracle designates this
2426N/A * particular file as subject to the "Classpath" exception as provided
2426N/A * by Oracle in the LICENSE file that accompanied this code.
2426N/A *
2426N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2426N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2426N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2426N/A * version 2 for more details (a copy is included in the LICENSE file that
2426N/A * accompanied this code).
2426N/A *
2426N/A * You should have received a copy of the GNU General Public License version
2426N/A * 2 along with this work; if not, write to the Free Software Foundation,
2426N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2426N/A *
3704N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2426N/A * or visit www.oracle.com if you need additional information or have any
2426N/A * questions.
2426N/A */
3704N/A
2426N/A#include <ctype.h>
3704N/A
2426N/A#include "bool.h"
2426N/A#include "utf.h"
2426N/A
2426N/A $$Tables
3661N/A
2426N/A/* Take pointer to a string. Skip over the longest part of the string that
2426N/A * could be taken as a fieldname. Allow '/' if slash_okay is TRUE.
2426N/A *
2426N/A * Return a pointer to just past the fieldname. Return NULL if no fieldname
2426N/A * at all was found, or in the case of slash_okay being true, we saw
2426N/A * consecutive slashes (meaning we were looking for a qualified path but
2426N/A * found something that was badly-formed).
2426N/A */
2426N/A
2426N/A#define bool_t int
2426N/A
2426N/Achar *
2426N/Askip_over_fieldname(char *name, bool_t slash_okay)
2426N/A{
2426N/A char *p = name;
2426N/A char *last_p;
2426N/A unicode ch;
2426N/A unicode last_ch = 0;
2426N/A
2426N/A ch = *p;
2426N/A if (ch == (ch & 0x7F))
2426N/A ++p;
2426N/A else
2426N/A ch = next_utf2unicode(&p);
2426N/A if (($$Lookup(ch) & $$bitJavaStart) == 0)
2426N/A return 0;
2426N/A for (;;) {
2426N/A last_p = p;
2426N/A last_ch = ch;
2426N/A ch = *p;
2426N/A if (ch == (ch & 0x7F))
2426N/A ++p;
2426N/A else
2426N/A ch = next_utf2unicode(&p);
2426N/A if (($$Lookup(ch) & $$bitJavaPart) == 0) {
2426N/A if (ch == '/' && slash_okay) {
2426N/A if (last_ch == '/')
2426N/A return 0;
2426N/A }
3704N/A else {
3704N/A return last_p;
3704N/A }
3704N/A }
2426N/A }
3704N/A}
2426N/A
2426N/Avoid main() {
2426N/A int j;
3704N/A for (j = 0; j < (1 << 16); j++) {
2426N/A int q = $$Lookup(j);
2426N/A printf("%04x%s%s\n", j,
3704N/A (q & $$bitJavaStart ? " Start" : ""),
(q & $$bitJavaPart ? " Part" : ""));
}
}