beta-0.89.2
[luatex.git] / source / texk / web2c / cwebdir / comm-w32.ch
blobb300f496d2b0bd1b1117e49ab4b87a2682f141d4
1 This is the change file for CWEB's COMMON under Win32
2 (Contributed by Fabrice Popineau, February 2002 <Fabrice.Popineau@supelec.fr>)
4 The Microsoft C compiler included in Visual Studio allows for different
5 parameter passing conventions than the standard one. This is actually
6 specified with the Intel IA32 architecture. There exist three
7 calling conventions under the IA32 architecture as defined by Intel.
9 One of them is the standard C calling convention: Parameters are passed on
10 the stack, calling function is responsible to unstack arguments.  Names are
11 decorated with a prefixed underscore.  It is called the __cdecl convention.
13 Another calling convention is the __fastcall convention. The first two 32bits
14 arguments are passed on the stack.  The called function is responsible for
15 stack maintenance.  Names are decorated with an @ sign as prefix, and another
16 @ sign followed by the size of the arguments as suffix.
18 The third one is the __stdcall convention and is basically the Pascal calling
19 convention.
21 Using the __fastcall convention is usually faster on Intel architecture. Names
22 are decorated because obviously a __cdecl function can't behave the same way
23 as a __fastcall one of the same prototype.  So the new full prototype includes
24 the keyword __cdecl or __fastcall. A compiler option allows to compile all
25 functions using one or the other calling convention. If you compile using
26 __fastcall, then you are bound to explicitly declare a few functions as
27 __cdecl : the ones that are passed to the C library (like function pointers
28 for qsort() or signal()) or functions that replace functions from the C
29 library, because the standard headers have a __cdecl prototype for these
30 functions. Also, you cannot declare a library function without giving it the
31 exact prototype used in the library headers files. So you'd better use the
32 header files to be safe.
34 Admittedly, this is not vital for cweb, except that I build the whole texlive
35 set of programs using the __fastcall convention.
38 @<Include files@>=
39 #include <ctype.h>
41 @<Include files@>=
42 #include <ctype.h>
43 #include <string.h>
47 @ @<Predec...@>=
48 extern int names_match();
50 @ @<Predec...@>=
51 extern int __cdecl names_match();
55 @<Pred...@>=
56 void init_p();
58 @<Pred...@>=
59 void __cdecl init_p();
62 @x section 69
63 An omitted change file argument means that |"/dev/null"| should be used,
65 An omitted change file argument means that |"NUL"| should be used,
68 @x section 70 (this change copied from comm-bs.ch, July 94)
69         else if (*s=='/') dot_pos=NULL,name_pos=++s;
71         else if (*s == ':' || *s == '\\' || *s == '/')
72           dot_pos=NULL,name_pos=++s;
75 @x section 70
76   if (found_change<=0) strcpy(change_file_name,"/dev/null");
78   if (found_change<=0) strcpy(change_file_name,"NUL");
82 @ We predeclare several standard system functions here instead of including
83 their system header files, because the names of the header files are not as
84 standard as the names of the functions. (For example, some \CEE/ environments
85 have \.{<string.h>} where others have \.{<strings.h>}.)
87 @<Predecl...@>=
88 extern int strlen(); /* length of string */
89 extern int strcmp(); /* compare strings lexicographically */
90 extern char* strcpy(); /* copy one string to another */
91 extern int strncmp(); /* compare up to $n$ string characters */
92 extern char* strncpy(); /* copy up to $n$ string characters */