+++ /dev/null
-/* File: japanese.c */
-
-
-#include "angband.h"
-
-#ifdef JP
-
-/*ÆüËܸìÆ°»ì³èÍÑ (ÂǤġäÂǤäÆ,ÂǤÁ etc) */
-
-#define CMPTAIL(y) strncmp(&in[l-strlen(y)],y,strlen(y))
-
-/* ²¥¤ë,½³¤ë¡ä²¥¤ê,½³¤ë */
-void jverb1( const char *in , char *out){
-int l=strlen(in);
-strcpy(out,in);
-
-if( CMPTAIL("¤¹¤ë")==0) sprintf(&out[l-4],"¤·");else
-if( CMPTAIL("¤¤¤ë")==0) sprintf(&out[l-4],"¤¤¤Æ");else
-
-if( CMPTAIL("¤¨¤ë")==0) sprintf(&out[l-4],"¤¨");else
-if( CMPTAIL("¤±¤ë")==0) sprintf(&out[l-4],"¤±");else
-if( CMPTAIL("¤²¤ë")==0) sprintf(&out[l-4],"¤²");else
-if( CMPTAIL("¤»¤ë")==0) sprintf(&out[l-4],"¤»");else
-if( CMPTAIL("¤¼¤ë")==0) sprintf(&out[l-4],"¤¼");else
-if( CMPTAIL("¤Æ¤ë")==0) sprintf(&out[l-4],"¤Æ");else
-if( CMPTAIL("¤Ç¤ë")==0) sprintf(&out[l-4],"¤Ç");else
-if( CMPTAIL("¤Í¤ë")==0) sprintf(&out[l-4],"¤Í");else
-if( CMPTAIL("¤Ø¤ë")==0) sprintf(&out[l-4],"¤Ø");else
-if( CMPTAIL("¤Ù¤ë")==0) sprintf(&out[l-4],"¤Ù");else
-if( CMPTAIL("¤á¤ë")==0) sprintf(&out[l-4],"¤á");else
-if( CMPTAIL("¤ì¤ë")==0) sprintf(&out[l-4],"¤ì");else
-
-if( CMPTAIL("¤¦")==0) sprintf(&out[l-2],"¤¤");else
-if( CMPTAIL("¤¯")==0) sprintf(&out[l-2],"¤");else
-if( CMPTAIL("¤°")==0) sprintf(&out[l-2],"¤®");else
-if( CMPTAIL("¤¹")==0) sprintf(&out[l-2],"¤·");else
-if( CMPTAIL("¤º")==0) sprintf(&out[l-2],"¤¸");else
-if( CMPTAIL("¤Ä")==0) sprintf(&out[l-2],"¤Á");else
-if( CMPTAIL("¤Å")==0) sprintf(&out[l-2],"¤Â");else
-if( CMPTAIL("¤Ì")==0) sprintf(&out[l-2],"¤Ë");else
-if( CMPTAIL("¤Õ")==0) sprintf(&out[l-2],"¤Ò");else
-if( CMPTAIL("¤Ö")==0) sprintf(&out[l-2],"¤Ó");else
-if( CMPTAIL("¤à")==0) sprintf(&out[l-2],"¤ß");else
-if( CMPTAIL("¤ë")==0) sprintf(&out[l-2],"¤ê");else
-
- sprintf(&out[l],"¤½¤·¤Æ");}
-
-/* ²¥¤ë,½³¤ë> ²¥¤Ã¤Æ½³¤ë */
-void jverb2( const char *in , char *out){
-int l=strlen(in);
-strcpy(out,in);
-
-if( CMPTAIL("¤¹¤ë")==0) sprintf(&out[l-4],"¤·¤Æ");else
-if( CMPTAIL("¤¤¤ë")==0) sprintf(&out[l-4],"¤¤¤Æ");else
-
-if( CMPTAIL("¤¨¤ë")==0) sprintf(&out[l-4],"¤¨¤Æ");else
-if( CMPTAIL("¤±¤ë")==0) sprintf(&out[l-4],"¤±¤Æ");else
-if( CMPTAIL("¤²¤ë")==0) sprintf(&out[l-4],"¤²¤Æ");else
-if( CMPTAIL("¤»¤ë")==0) sprintf(&out[l-4],"¤»¤Æ");else
-if( CMPTAIL("¤¼¤ë")==0) sprintf(&out[l-4],"¤¼¤Æ");else
-if( CMPTAIL("¤Æ¤ë")==0) sprintf(&out[l-4],"¤Æ¤Ã¤Æ");else
-if( CMPTAIL("¤Ç¤ë")==0) sprintf(&out[l-4],"¤Ç¤Æ");else
-if( CMPTAIL("¤Í¤ë")==0) sprintf(&out[l-4],"¤Í¤Æ");else
-if( CMPTAIL("¤Ø¤ë")==0) sprintf(&out[l-4],"¤Ø¤Æ");else
-if( CMPTAIL("¤Ù¤ë")==0) sprintf(&out[l-4],"¤Ù¤Æ");else
-if( CMPTAIL("¤á¤ë")==0) sprintf(&out[l-4],"¤á¤Æ");else
-if( CMPTAIL("¤ì¤ë")==0) sprintf(&out[l-4],"¤ì¤Æ");else
-
-if( CMPTAIL("¤¦")==0) sprintf(&out[l-2],"¤Ã¤Æ");else
-if( CMPTAIL("¤¯")==0) sprintf(&out[l-2],"¤¤¤Æ");else
-if( CMPTAIL("¤°")==0) sprintf(&out[l-2],"¤¤¤Ç");else
-if( CMPTAIL("¤¹")==0) sprintf(&out[l-2],"¤·¤Æ");else
-if( CMPTAIL("¤º")==0) sprintf(&out[l-2],"¤¸¤Æ");else
-if( CMPTAIL("¤Ä")==0) sprintf(&out[l-2],"¤Ã¤Æ");else
-if( CMPTAIL("¤Å")==0) sprintf(&out[l-2],"¤Ã¤Æ");else
-if( CMPTAIL("¤Ì")==0) sprintf(&out[l-2],"¤Í¤Æ");else
-if( CMPTAIL("¤Õ")==0) sprintf(&out[l-2],"¤Ø¤Æ");else
-if( CMPTAIL("¤Ö")==0) sprintf(&out[l-2],"¤ó¤Ç");else
-if( CMPTAIL("¤à")==0) sprintf(&out[l-2],"¤ó¤Ç");else
-if( CMPTAIL("¤ë")==0) sprintf(&out[l-2],"¤Ã¤Æ");else
- sprintf(&out[l],"¤³¤È¤Ë¤è¤ê");}
-
-/* ²¥¤ë,½³¤ë > ²¥¤Ã¤¿¤ê½³¤Ã¤¿¤ê */
-void jverb3( const char *in , char *out){
-int l=strlen(in);
-strcpy(out,in);
-
-if( CMPTAIL("¤¹¤ë")==0) sprintf(&out[l-4],"¤·¤¿");else
-if( CMPTAIL("¤¤¤ë")==0) sprintf(&out[l-4],"¤¤¤¿");else
-
-if( CMPTAIL("¤¨¤ë")==0) sprintf(&out[l-4],"¤¨¤¿");else
-if( CMPTAIL("¤±¤ë")==0) sprintf(&out[l-4],"¤±¤¿");else
-if( CMPTAIL("¤²¤ë")==0) sprintf(&out[l-4],"¤²¤¿");else
-if( CMPTAIL("¤»¤ë")==0) sprintf(&out[l-4],"¤»¤¿");else
-if( CMPTAIL("¤¼¤ë")==0) sprintf(&out[l-4],"¤¼¤¿");else
-if( CMPTAIL("¤Æ¤ë")==0) sprintf(&out[l-4],"¤Æ¤Ã¤¿");else
-if( CMPTAIL("¤Ç¤ë")==0) sprintf(&out[l-4],"¤Ç¤¿");else
-if( CMPTAIL("¤Í¤ë")==0) sprintf(&out[l-4],"¤Í¤¿");else
-if( CMPTAIL("¤Ø¤ë")==0) sprintf(&out[l-4],"¤Ø¤¿");else
-if( CMPTAIL("¤Ù¤ë")==0) sprintf(&out[l-4],"¤Ù¤¿");else
-if( CMPTAIL("¤á¤ë")==0) sprintf(&out[l-4],"¤á¤¿");else
-if( CMPTAIL("¤ì¤ë")==0) sprintf(&out[l-4],"¤ì¤¿");else
-
-if( CMPTAIL("¤¦")==0) sprintf(&out[l-2],"¤Ã¤¿");else
-if( CMPTAIL("¤¯")==0) sprintf(&out[l-2],"¤¤¤¿");else
-if( CMPTAIL("¤°")==0) sprintf(&out[l-2],"¤¤¤À");else
-if( CMPTAIL("¤¹")==0) sprintf(&out[l-2],"¤·¤¿");else
-if( CMPTAIL("¤º")==0) sprintf(&out[l-2],"¤¸¤¿");else
-if( CMPTAIL("¤Ä")==0) sprintf(&out[l-2],"¤Ã¤¿");else
-if( CMPTAIL("¤Å")==0) sprintf(&out[l-2],"¤Ã¤¿");else
-if( CMPTAIL("¤Ì")==0) sprintf(&out[l-2],"¤Í¤¿");else
-if( CMPTAIL("¤Õ")==0) sprintf(&out[l-2],"¤Ø¤¿");else
-if( CMPTAIL("¤Ö")==0) sprintf(&out[l-2],"¤ó¤À");else
-if( CMPTAIL("¤à")==0) sprintf(&out[l-2],"¤ó¤À");else
-if( CMPTAIL("¤ë")==0) sprintf(&out[l-2],"¤Ã¤¿");else
- sprintf(&out[l],"¤³¤È¤ä");}
-
-
-void jverb( const char *in , char *out , int flag){
- switch (flag){
- case JVERB_AND:jverb1(in , out);break;
- case JVERB_TO :jverb2(in , out);break;
- case JVERB_OR :jverb3(in , out);break;
- }
-}
-
-char* strstr_j(const char* s, const char* t)
-{
- int i, l1, l2;
-
- l1 = strlen(s);
- l2 = strlen(t);
- if (l1 >= l2) {
- for(i = 0; i <= l1 - l2; i++) {
- if(!strncmp(s + i, t, l2))
- return (char *)s + i;
- if (iskanji(*(s + i)))
- i++;
- }
- }
- return NULL;
-}
-
-
-/*
- * str¤ò´Ä¶¤Ë¹ç¤Ã¤¿Ê¸»ú¥³¡¼¥É¤ËÊÑ´¹¤¹¤ë¡£
- * str¤ÎŤµ¤ËÀ©¸Â¤Ï¤Ê¤¤¡£
- */
-void codeconv(char *str, bool unknown)
-{
- /* EUC¤ò²¾Äê¡£ */
- static bool iseuc = 1;
-
- int i;
- int kanji = 0;
- int len;
- unsigned char c1, c2;
- unsigned char *tmp;
-
- /* ʸ»ú¥³¡¼¥É¤¬ÊѤï¤ë²ÄǽÀ¤¬¤¢¤ë»þ¤Ï¡¢º£¤Þ¤Ç¤Î¾ðÊó¤ò˺¤ì¤ë¡£ */
- if (unknown) iseuc = 1;
-
- /* ´Á»ú¤¬Â¸ºß¤·¡¢¤½¤Î´Á»ú¥³¡¼¥É¤¬EUC¤«¤É¤¦¤«Ä´¤Ù¤ë¡£*/
- for (i = 0; str[i]; i++)
- {
- c1 = str[i];
- if (c1 & 0x80) kanji = 1;
- if ( c1>=0x80 && (c1 < 0xa1 || c1 > 0xfe)) iseuc = 0;
- }
-
- /* str¤ÎŤµ+1(tmp³ÎÊÝÍÑ) */
- len = i + 1;
-
-#ifdef EUC
- if (kanji && !iseuc) /* SJIS -> EUC */
- {
- C_MAKE(tmp, len, byte);
-
- for (i = 0; str[i]; i++)
- {
- c1 = str[i];
- if (c1 & 0x80)
- {
- i++;
- c2 = str[i];
- if (c2 >= 0x9f)
- {
- c1 = c1 * 2 - (c1 >= 0xe0 ? 0xe0 : 0x60);
- c2 += 2;
- }
- else
- {
- c1 = c1 * 2 - (c1 >= 0xe0 ? 0xe1 : 0x61);
- c2 += 0x60 + (c2 < 0x7f);
- }
- tmp[i - 1] = c1;
- tmp[i] = c2;
- }
- else
- tmp[i] = c1;
- }
- tmp[i] = '\0';
- strcpy(str, (char *)tmp);
-
- C_KILL(tmp, len, byte);
- }
-#endif
-
-#ifdef SJIS
- if (kanji && iseuc) /* EUC -> SJIS */
- {
- C_MAKE(tmp, len, byte);
-
- for (i = 0; str[i]; i++)
- {
- c1 = str[i];
- if (c1 & 0x80)
- {
- i++;
- c2 = str[i];
- if (c1 % 2)
- {
- c1 = (c1 >> 1) + (c1 < 0xdf ? 0x31 : 0x71);
- c2 -= 0x60 + (c2 < 0xe0);
- }
- else
- {
- c1 = (c1 >> 1) + (c1 < 0xdf ? 0x30 : 0x70);
- c2 -= 2;
- }
- tmp[i - 1] = c1;
- tmp[i] = c2;
- }
- else
- tmp[i] = c1;
- }
- tmp[i] = '\0';
- strcpy(str, tmp);
-
- C_KILL(tmp, len, byte);
- }
-#endif
-}
-
-/* ʸ»úÎós¤Îx¥Ð¥¤¥ÈÌܤ¬´Á»ú¤Î1¥Ð¥¤¥ÈÌܤ«¤É¤¦¤«È½Äꤹ¤ë */
-bool iskanji2(cptr s, int x)
-{
- int i;
-
- for (i = 0; i < x; i++)
- {
- if (iskanji(s[i])) i++;
- }
- if ((x == i) && iskanji(s[x])) return TRUE;
-
- return FALSE;
-}
-
-#endif /* JP */
-