66 lines · 2.7 KB · Text
RawDownload
This is the change file for CWEB's COMMON under Win32(Contributed by Fabrice Popineau, February 2002 <Fabrice.Popineau@supelec.fr>) The Microsoft C compiler included in Visual Studio allows for differentparameter passing conventions than the standard one. This is actuallyspecified with the Intel IA32 architecture. There exist threecalling conventions under the IA32 architecture as defined by Intel. One of them is the standard C calling convention: Parameters are passed onthe stack, calling function is responsible to unstack arguments.  Names aredecorated with a prefixed underscore.  It is called the __cdecl convention. Another calling convention is the __fastcall convention. The first two 32bitsarguments are passed on the stack.  The called function is responsible forstack maintenance.  Names are decorated with an @ sign as prefix, and another@ sign followed by the size of the arguments as suffix. The third one is the __stdcall convention and is basically the Pascal callingconvention. Using the __fastcall convention is usually faster on Intel architecture. Namesare decorated because obviously a __cdecl function can't behave the same wayas a __fastcall one of the same prototype.  So the new full prototype includesthe keyword __cdecl or __fastcall. A compiler option allows to compile allfunctions using one or the other calling convention. If you compile using__fastcall, then you are bound to explicitly declare a few functions as__cdecl : the ones that are passed to the C library (like function pointersfor qsort() or signal()) or functions that replace functions from the Clibrary, because the standard headers have a __cdecl prototype for thesefunctions. Also, you cannot declare a library function without giving it theexact prototype used in the library headers files. So you'd better use theheader files to be safe. Admittedly, this is not vital for cweb, except that I build the whole texliveset of programs using the __fastcall convention. @xextern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/@yextern boolean __cdecl names_match(name_pointer,const char *,size_t,eight_bits);@/@z @xextern void init_p(name_pointer,eight_bits);@/@yextern void __cdecl init_p(name_pointer,eight_bits);@/@z @x section 75An omitted change file argument means that |"/dev/null"| should be used,@yAn omitted change file argument means that |"NUL"| should be used,@z @x section 75  strcpy(change_file_name,"/dev/null");@y  strcpy(change_file_name,"NUL");@z @x section 75 (this change copied from comm-bs.ch, July 94)        else if (*s=='/') dot_pos=NULL,name_pos=++s;@y        else if (*s == ':' || *s == '\\' || *s == '/')	  dot_pos=NULL,name_pos=++s;@z

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t