阅读:4300回复:18
看firefox源代码有疑问。。。
GLOBAL(void)
start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) 这个GLOBAL(void) 怎么解释? |
|
1楼#
发布于:2005-09-10 01:12
还有,,ff网站有提供ff的编译方法么?win下面。。
好像看到说是用VC可以编译。我看到有makefile.win,我想是不是可以在cygwin下用gcc,g++编译? |
|
2楼#
发布于:2005-09-10 01:12
|
|
3楼#
发布于:2005-09-10 01:12
没有那个必要,你可以在vc环境下,把makefile当作一个说明文档,就可以了!
|
|
4楼#
发布于:2005-09-10 01:12
好深奥啊!
|
|
|
5楼#
发布于:2005-09-10 01:12
GLOBAL(void) 应该是 C 语言程序员常说的 "宏" 了。
这个东西应该在源代码的其它位置有个定义,你在那可以看出来 GLOBAL(void) 实际上是什么。 PS:直接用编辑器打开源代码看是很不方便的,有专门的源代码查看工具来辅助的。比如你可以点一下 GLOBAL(void),就跳转到 GLOBAL(void) 的定义。 具体的要问这里的软件开发高手了,我不知道。 |
|
6楼#
发布于:2005-09-10 01:12
宏我当然知道了。。宏参数哪有设置void 的。。
顶多是 #define Add(a,b) ((a)+(b)); 这个void 作为宏参数作何解释〉 |
|
7楼#
发布于:2005-09-10 01:12
如果那是一个宏的话,楼主可以试试下面这段C程序就知道宏参数里的VOID的含义了。
#include <stdio.h> #define prn(void) printf("Hello,World!\n") main(){ prn(); } 不过我怀疑那不是一个宏,楼主能不能把那句代码前后的代码都贴出来,这样看起来就清楚了。 |
|
8楼#
发布于:2005-09-10 01:12
你可以在官方网站上用lxr浏览,很方便,
在本地用 source insight(windows) source navigator(Linux) |
|
|
9楼#
发布于:2005-09-10 01:12
/*
* cdjpeg.c * * Copyright (C) 1991-1997, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains common support routines used by the IJG application * programs (cjpeg, djpeg, jpegtran). */ #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ #include <ctype.h> /* to declare isupper(), tolower() */ #ifdef NEED_SIGNAL_CATCHER #include <signal.h> /* to declare signal() */ #endif #ifdef USE_SETMODE #include <fcntl.h> /* to declare setmode()'s parameter macros */ /* If you have setmode() but not <io.h>, just delete this line: */ #include <io.h> /* to declare setmode() */ #endif /* * Signal catcher to ensure that temporary files are removed before aborting. * NB: for Amiga Manx C this is actually a global routine named _abort(); * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... */ #ifdef NEED_SIGNAL_CATCHER static j_common_ptr sig_cinfo; void /* must be global for Manx C */ signal_catcher (int signum) { if (sig_cinfo != NULL) { if (sig_cinfo->err != NULL) /* turn off trace output */ sig_cinfo->err->trace_level = 0; jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ } exit(EXIT_FAILURE); } GLOBAL(void) enable_signal_catcher (j_common_ptr cinfo) { sig_cinfo = cinfo; #ifdef SIGINT /* not all systems have SIGINT */ signal(SIGINT, signal_catcher); #endif #ifdef SIGTERM /* not all systems have SIGTERM */ signal(SIGTERM, signal_catcher); #endif } #endif /* * Optional progress monitor: display a percent-done figure on stderr. */ #ifdef PROGRESS_REPORT METHODDEF(void) progress_monitor (j_common_ptr cinfo) { cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; int total_passes = prog->pub.total_passes + prog->total_extra_passes; int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); if (percent_done != prog->percent_done) { prog->percent_done = percent_done; if (total_passes > 1) { fprintf(stderr, "\rPass %d/%d: %3d%% ", prog->pub.completed_passes + prog->completed_extra_passes + 1, total_passes, percent_done); } else { fprintf(stderr, "\r %3d%% ", percent_done); } fflush(stderr); } } GLOBAL(void) start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) { /* Enable progress display, unless trace output is on */ if (cinfo->err->trace_level == 0) { progress->pub.progress_monitor = progress_monitor; progress->completed_extra_passes = 0; progress->total_extra_passes = 0; progress->percent_done = -1; cinfo->progress = &progress->pub; } } GLOBAL(void) end_progress_monitor (j_common_ptr cinfo) { /* Clear away progress display */ if (cinfo->err->trace_level == 0) { fprintf(stderr, "\r \r"); fflush(stderr); } } #endif /* * Case-insensitive matching of possibly-abbreviated keyword switches. * keyword is the constant keyword (must be lower case already), * minchars is length of minimum legal abbreviation. */ GLOBAL(boolean) keymatch (char * arg, const char * keyword, int minchars) { register int ca, ck; register int nmatched = 0; while ((ca = *arg++) != '\0') { if ((ck = *keyword++) == '\0') return FALSE; /* arg longer than keyword, no good */ if (isupper(ca)) /* force arg to lcase (assume ck is already) */ ca = tolower(ca); if (ca != ck) return FALSE; /* no good */ nmatched++; /* count matched characters */ } /* reached end of argument; fail if it's too short for unique abbrev */ if (nmatched < minchars) return FALSE; return TRUE; /* A-OK */ } /* * Routines to establish binary I/O mode for stdin and stdout. * Non-Unix systems often require some hacking to get out of text mode. */ GLOBAL(FILE *) read_stdin (void) { FILE * input_file = stdin; #ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdin), O_BINARY); #endif #ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdin\n"); exit(EXIT_FAILURE); } #endif return input_file; } GLOBAL(FILE *) write_stdout (void) { FILE * output_file = stdout; #ifdef USE_SETMODE /* need to hack file mode? */ setmode(fileno(stdout), O_BINARY); #endif #ifdef USE_FDOPEN /* need to re-open in binary mode? */ if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { fprintf(stderr, "Cannot reopen stdout\n"); exit(EXIT_FAILURE); } #endif return output_file; } source insight在单位写单片机程序用的的确很强。但是那玩意可不是免费的。。家里不高兴装了。。 从这个文件的代码页看不出什么名堂。。 |
|
10楼#
发布于:2005-09-10 01:12
GLOBAL(type),METHODDEF(type)等是宏,用于说明函数类型。
#include <stdio.h> #define GLOBAL(type) type GLOBAL(int) a(){ printf("Hello,World!"); return 1; } main(){ printf("%d",a(); } 随便举个例子,不是firefox源码中GLOBAL的意思。 |
|
11楼#
发布于:2005-09-10 01:12
fygenius:宏我当然知道了。。宏参数哪有设置void 的。。 虽然我不懂写程序,但印象中宏参数应该就是简单的字符串替换吧。 GLOBAL() 的定义是 #define GLOBAL(type) PR_IMPLEMENT(type) 位置在 http://lxr.mozilla.org/seamonkey/source ... ecfg.h#212 而 PR_IMPLEMENT() 的定义根据具体的情况有好几个(可能在不同的平台上有所不同),其中一个是 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type 位置在 http://lxr.mozilla.org/seamonkey/source ... types.h#91 从注释大致上可以看出来,是用来指定这个函数是否在 .dll 或者 .so 中可见什么的。 /*********************************************************************** 64 ** MACROS: PR_EXTERN 65 ** PR_IMPLEMENT 66 ** DESCRIPTION: 67 ** These are only for externally visible routines and globals. For 68 ** internal routines, just use "extern" for type checking and that 69 ** will not export internal cross-file or forward-declared symbols. 70 ** Define a macro for declaring procedures return types. We use this to 71 ** deal with windoze specific type hackery for DLL definitions. Use 72 ** PR_EXTERN when the prototype for the method is declared. Use 73 ** PR_IMPLEMENT for the implementation of the method. 74 ** 75 ** Example: 76 ** in dowhim.h 77 ** PR_EXTERN( void ) DoWhatIMean( void ); 78 ** in dowhim.c 79 ** PR_IMPLEMENT( void ) DoWhatIMean( void ) { return; } 80 ** 81 ** 82 ***********************************************************************/ |
|
12楼#
发布于:2005-09-10 01:12
这么一说我想起来了。。很有可能是dll文件的接口字符串替换。。
写VC的时候留dll接口函数的标准写法。。 对对,应该是这个。。 |
|
13楼#
发布于:2005-09-10 01:12
看来这个部分的文件编译出来应该是一个dll文件。。
|
|
14楼#
发布于:2005-09-10 01:12
有这等事?熟悉 VC 的来说说。 |
|
上一页
下一页