Debian Codegraph @

texk/web2c/cwebdir/comm-w32.ch

raw
1 This is the change file for CWEB's COMMON under Win32
2 (Contributed by Fabrice Popineau, February 2002 <[email protected]>)
3
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.
8
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.
12
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.
17
18 The third one is the __stdcall convention and is basically the Pascal calling
19 convention.
20
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.
33
34 Admittedly, this is not vital for cweb, except that I build the whole texlive
35 set of programs using the __fastcall convention.
36
37 @x section 11
38 extern bool names_match(name_pointer,const char *,size_t,eight_bits);
39 @y
40 extern bool __cdecl names_match(name_pointer,const char *,size_t,eight_bits);
41 @z
42
43 @x section 75
44 An omitted change file argument means that |"/dev/null"| should be used,
45 @y
46 An omitted change file argument means that |"NUL"| should be used,
47 @z
48
49 @x section 75
50 strcpy(change_file_name,"/dev/null");
51 @y
52 strcpy(change_file_name,"NUL");
53 @z
54
55 @x section 75 (this change copied from comm-bs.ch, July 94)
56 else if (*s=='/') dot_pos=NULL,name_pos=++s;
57 @y
58 else if (*s == ':' || *s == '\\' || *s == '/')
59 dot_pos=NULL,name_pos=++s;
60 @z