Re: wftodm segfaults on AMD64

2006-07-29 Thread

今は日!

From: masami <[EMAIL PROTECTED]>

> on 07/29/06 08:11, Danai SAE-HAN (韓達耐) wrote:
> 
> > If any if you could help me why test.c crashes on my computer and not
> > on any other (i386) computer, I would be very grateful, since I'm no
> > programmer.
> > 
> simply, you should include time.h instead of sys/time.h.
> also I recommend use -Wall option when you build programs.
> 
> if you use this option, you can notice what wrong.
> [EMAIL PROTECTED]:~]% gcc -Wall test.c
> test.c:6: warning: return type of ‘main’ is not ‘int’
> test.c: In function ‘main’:
> test.c:8: warning: implicit declaration of function ‘ctime’
> test.c:8: warning: format ‘%s’ expects type ‘char *’, but argument 2 has
> type ‘int’

Thank you!  It works like a charm.  May I also ask you why exacty
sys/time.h and time.h are so different?  They are both part of
libc6-dev, I see.

どうも有難うり御間す。



Danai SAE-HAN
韓達耐

-- 
题目:《襄邑道中》
作者:陈与义(1090-1138)

飞花两岸照船红,百里榆堤半日风。
卧看满天云不动,不知云与我俱东。


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



wftodm segfaults on AMD64

2006-07-28 Thread

Hi!


I'm the package maintainer of the soon-to-be-uploaded CJK packages.
CJK allows to write Chinese, Japanese, Korean, Thai and other
languages in LaTeX, supporting different encodings such as UTF-8.
A package that I would like to upload to my sponsor, Frank Küster, as
soon as I can.  It will deprecate the unmaintained cjk-latex package.
But in order to do so, I need to fix an AMD64 segfault problem.

I need to create Japanese Wadalab DNP Type1 fonts using a utility
called "wftodm".  I could always compile this binary on an i386
computer, but I can't get it to work on my new Athlon64 3200+.
I have installed a pure 64-bit Debian/unstable.

The upstream CJK author, Werner LEMBERG, didn't write this tool but he
patched it to enable partial font downloading and is willing to help
me out.

He provided me a simple test case of nine lines (cfr. test.c in
attachment) and it segfaults too.  I have tried uninstalling and
reinstalling libc6* but to no avail.

If any if you could help me why test.c crashes on my computer and not
on any other (i386) computer, I would be very grateful, since I'm no
programmer.

You can find the discussion on
http://lists.ffii.org/pipermail/cjk/2006-July/001472.html and onwards,
where you will also find the backtrace logs.

If you wish to test wftodm.c as well, the font tarballs can be found
on CTAN:
ftp://ftp.dante.de/pub/tex/support/ghostscript/3rdparty/fonts/kanji/Font/

wftodm.c in the attachment has already been patched by Werner
Lemberg's patch (in DNP.txt), which you can find on
http://cjk.ffii.org/ .


It would be most kind if you could CC me your replies to my email
address, danai.sae-han \ad\ skynet.be, to wl |ad| gnu.org (Werner
LEMBERG) and to cjk /ad/ ffii.org (this is the CJK mailing list).



Best regards




Danai SAE-HAN
韓達耐

-- 
题目:《过零丁洋》
作者:文天祥(1236-1282)

辛苦遭逢起一经,干戈寥落四周星。
山河破碎风飘絮,身世浮沉雨打萍。
惶恐滩头说惶恐,零丁洋里叹零丁。
人生自古谁无死,留取丹心照汗青。
#include 
#include 
#include 
#include 
#include 
char *charstrs[34][256];
int charlens[34][256];
char *version_str="001.001";
int kcode_high;
char *StdHW="32";
char *StdVW="32";
char *UniqueId="9876";
char *FontBase="dm";
char fontname[256];
FILE *ofp;
int ecol=0;

char *jsf_names[] = {
"",
"jsy",
"jroma",
"jhira",
"jkata",
"jgreek",
"jrussian",
"jkeisen",
"jka",
"jkb",
"jkc",
"jkd",
"jke",
"jkf",
"jkg",
"jkh",
"jki",
"jkj",
"jkk",
"jkl",
"jkm",
"jkn",
"jko",
"jkp",
"jkq",
"jkr",
"jks",
"jkt",
"jku",
"jkv",
"jkw",
"jkx",
"jky",
"jkz",
NULL
};
#define kushift(c)  c+0x20
#define tenshift(c) c+0x20
compute_fc(ku, ten, f, c)
register short ku, ten;
unsigned short *f, *c;
{
register int n;

ku -= 0x20;
ten -= 0x20;
*f = 1;
*c = 1;
if (ku <= 0 || (9 <= ku && ku <= 15) || ku > 84) {
fprintf(stderr,"invalid ku in jis (%x, %x)", ku+0x20, ten+0x20);
return;
}
if (ten < 1 || ten > 94) {
fprintf(stderr,"invalid ten in jis (%x, %x)", ku+0x20, ten+0x20);
return;
}
if (ku <= 8) {
if (ku == 1) {
*f = 1;
*c = ten;
} else if (ku == 2) {
*f = 1;
*c = ten+100;
} else if (ku == 3) {
*f = 2;
*c = ten+32;
} else {
*f = ku-1;
*c = ten;
}
} else if (ku <= 47) {  /* Daiich Suijun */
n = (ku-16)*94+ten-1;
*f = (n/256)+8;
*c = n%256;
} else {/* Daini Suijun */
n = (ku-48)*94+ten-1;
*f = (n/256)+20;
*c = n%256;
}
}
readfiles(filename)
char *filename;
{
  FILE *fd;
  char buf[4096],*cptr;
  int kcode_low,i,len,kcode,c1;
  unsigned short f,c;

  if((fd=fopen(filename,"r"))==NULL){
fprintf(stderr,"File %s is not found\n",filename);
exit(1);
  }
  while(fgets(buf,4096,fd)!=NULL){
len=strlen(buf);
if(buf[0]=='<' && !strncmp(buf+len-6 ,"CompD",5)){
  kcode=strtol(buf+len-12,NULL,16);
  compute_fc((kcode>>8)&255, (kcode&255), &f, &c);
  charlens[f][c]=(len-16)/2;
  cptr=charstrs[f][c]=(char *)malloc((len-16)/2);
  for(i=0;i<(len-16)/2;i++){
c1=buf[i*2+1];c=buf[i*2+2];
*cptr++ = ((c1>='a' ? c1-'a'+10 : c1-'0')<<4)
  |(c>='a' ? c-'a'+10 : c-'0');
  }
}
  }
  fclose(fd);
}

main(ac,ag)
char **ag;
{
  int i,j;
  
  for(i=1;i>8));
  r=(cipher+r)*c1+c2;
  return cipher;
}

#include 
#include 

void
main(void)
{
  time_t now = 1154016900;
  printf("%s", ctime(&now));
}