Format
This commit is contained in:
parent
80b2181a61
commit
73cb09624a
116 changed files with 19741 additions and 21522 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1994 Sony Corporation
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
* Except as contained in this notice, the name of Sony Corporation
|
||||
* shall not be used in advertising or otherwise to promote the sale, use
|
||||
* or other dealings in this Software without prior written authorization
|
||||
|
|
@ -28,8 +28,8 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* $SonyRCSfile: string.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyRCSfile: string.c,v $
|
||||
* $SonyRevision: 1.1 $
|
||||
* $SonyDate: 1994/06/03 08:00:45 $
|
||||
*/
|
||||
|
||||
|
|
@ -37,31 +37,29 @@
|
|||
|
||||
#include "sj3mkdic.h"
|
||||
|
||||
|
||||
int
|
||||
bubun_str(u_char *p1, int l1, u_char *p2, int l2)
|
||||
{
|
||||
u_char *p;
|
||||
int bubun_str(u_char* p1, int l1, u_char* p2, int l2) {
|
||||
u_char* p;
|
||||
int l;
|
||||
int i;
|
||||
|
||||
for (p = p1, l = l1 ; l > 0 ; ) {
|
||||
if (l < l2) break;
|
||||
for (i = 0 ; i < l2 ; i++)
|
||||
if (*(p + i) != *(p2 + i)) break;
|
||||
for(p = p1, l = l1; l > 0;) {
|
||||
if(l < l2) break;
|
||||
for(i = 0; i < l2; i++)
|
||||
if(*(p + i) != *(p2 + i)) break;
|
||||
|
||||
if (i >= l2) return 1;
|
||||
if(i >= l2) return 1;
|
||||
|
||||
i = codesize(*p);
|
||||
p += i;
|
||||
l -= i;
|
||||
}
|
||||
|
||||
for (p = p2, l = l2 ; l > 0 ; ) {
|
||||
if (l < l1) break;
|
||||
for (i = 0 ; i < l1 ; i++) if (*(p + i) != *(p1 + i)) break;
|
||||
for(p = p2, l = l2; l > 0;) {
|
||||
if(l < l1) break;
|
||||
for(i = 0; i < l1; i++)
|
||||
if(*(p + i) != *(p1 + i)) break;
|
||||
|
||||
if (i >= l1) return -1;
|
||||
if(i >= l1) return -1;
|
||||
|
||||
i = codesize(*p);
|
||||
p += i;
|
||||
|
|
@ -71,28 +69,24 @@ bubun_str(u_char *p1, int l1, u_char *p2, int l2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
overlap_str(u_char *p1, int l1, u_char *p2, int l2)
|
||||
{
|
||||
u_char *p;
|
||||
int overlap_str(u_char* p1, int l1, u_char* p2, int l2) {
|
||||
u_char* p;
|
||||
int l;
|
||||
int i;
|
||||
int j;
|
||||
u_char tmp[MAXKANJILENGTH * 2 + MAXATRNUMBER * 2];
|
||||
|
||||
for (p = p1, l = l1 ; l > 0 ; ) {
|
||||
if (l < l2) {
|
||||
for (i = 0 ; (i < l) && (*(p + i) == *(p2 + i)) ; i++) ;
|
||||
for(p = p1, l = l1; l > 0;) {
|
||||
if(l < l2) {
|
||||
for(i = 0; (i < l) && (*(p + i) == *(p2 + i)); i++);
|
||||
|
||||
if ((i >= l) && (l2 + l1 - l < sizeof(tmp))) {
|
||||
for (i = 0 ; i < l1 ; i++)
|
||||
if((i >= l) && (l2 + l1 - l < sizeof(tmp))) {
|
||||
for(i = 0; i < l1; i++)
|
||||
tmp[i] = *(p1 + i);
|
||||
for (j = l ; j < l2 ; i++, j++)
|
||||
for(j = l; j < l2; i++, j++)
|
||||
tmp[i] = *(p2 + j);
|
||||
|
||||
if (check_hindo(tmp, i)) {
|
||||
if(check_hindo(tmp, i)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,18 +97,18 @@ overlap_str(u_char *p1, int l1, u_char *p2, int l2)
|
|||
l -= i;
|
||||
}
|
||||
|
||||
for (p = p2, l = l2 ; l > 0 ; ) {
|
||||
if (l < l1) {
|
||||
for (i = 0 ; (i < l) && (*(p + i) == *(p1 + i)) ; i++) ;
|
||||
for(p = p2, l = l2; l > 0;) {
|
||||
if(l < l1) {
|
||||
for(i = 0; (i < l) && (*(p + i) == *(p1 + i)); i++);
|
||||
|
||||
if ((i >= l) && (l1 + l2 - l < sizeof(tmp))) {
|
||||
if((i >= l) && (l1 + l2 - l < sizeof(tmp))) {
|
||||
|
||||
for (i = 0 ; i < l2 ; i++)
|
||||
for(i = 0; i < l2; i++)
|
||||
tmp[i] = *(p2 + i);
|
||||
for (j = l ; j < l1 ; i++, j++)
|
||||
for(j = l; j < l1; i++, j++)
|
||||
tmp[i] = *(p1 + j);
|
||||
|
||||
if (check_hindo(tmp, i)) {
|
||||
if(check_hindo(tmp, i)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,72 +122,54 @@ overlap_str(u_char *p1, int l1, u_char *p2, int l2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int istrlen(int* s) {
|
||||
int* p;
|
||||
|
||||
for(p = s; *p; p++);
|
||||
|
||||
int
|
||||
istrlen(int *s)
|
||||
{
|
||||
int *p;
|
||||
|
||||
for (p = s ; *p ; p++) ;
|
||||
|
||||
return(p - s);
|
||||
return (p - s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
istrcmp(int *s, int *d)
|
||||
{
|
||||
for ( ; *s && (*s == *d) ; s++, d++) ;
|
||||
int istrcmp(int* s, int* d) {
|
||||
for(; *s && (*s == *d); s++, d++);
|
||||
|
||||
return (*s - *d);
|
||||
}
|
||||
|
||||
int top_strcmp(int* src, int* dst) {
|
||||
int i = 0;
|
||||
|
||||
|
||||
int
|
||||
top_strcmp(int *src, int *dst)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0 ; *src && (*src == *dst) ; src++, dst++)
|
||||
for(i = 0; *src && (*src == *dst); src++, dst++)
|
||||
i++;
|
||||
|
||||
return (i > MAXYOMIASKNUMBER) ? MAXYOMIASKNUMBER : i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
last_strcmp(int *src, int *dst)
|
||||
{
|
||||
int slen, dlen;
|
||||
int last_strcmp(int* src, int* dst) {
|
||||
int slen, dlen;
|
||||
|
||||
slen = istrlen(src);
|
||||
dlen = istrlen(dst);
|
||||
|
||||
if (dlen > MAXYOMIASKNUMBER)
|
||||
if(dlen > MAXYOMIASKNUMBER)
|
||||
return 0;
|
||||
|
||||
if (istrcmp(src + (slen - dlen), dst))
|
||||
if(istrcmp(src + (slen - dlen), dst))
|
||||
return 0;
|
||||
|
||||
return dlen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
string_cmp(u_char *p1, int l1, u_char *p2, int l2)
|
||||
{
|
||||
while (l1 > 0 && l2 > 0) {
|
||||
if (*p1 != *p2) return (*p1 - *p2);
|
||||
p1++; l1--;
|
||||
p2++; l2--;
|
||||
int string_cmp(u_char* p1, int l1, u_char* p2, int l2) {
|
||||
while(l1 > 0 && l2 > 0) {
|
||||
if(*p1 != *p2) return (*p1 - *p2);
|
||||
p1++;
|
||||
l1--;
|
||||
p2++;
|
||||
l2--;
|
||||
}
|
||||
|
||||
if (l1 == l2) return 0;
|
||||
if (l1 > l2) return 1;
|
||||
if(l1 == l2) return 0;
|
||||
if(l1 > l2) return 1;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue