home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / dev / c / proto2fd.readme < prev    next >
Encoding:
Text File  |  1996-01-05  |  4.9 KB  |  128 lines

  1. Short:    SAS/C++ Proto->FD->Pragmas convert v37.3
  2. Uploader: schneidr@igt.baum.ethz.ch
  3. Type:     dev/c
  4.  
  5. ************************************************************************
  6.  
  7.                       Proto2FD v37.3 (19.11.1995)
  8.                      FD2Pragma v37.1 (20.11.1995)
  9.  
  10.                 c1995 Quarz Development / A.H.Schneider
  11.  
  12.                              - Freeware -
  13.  
  14. ************************************************************************
  15.  
  16.  
  17. This  is  a  little tool I wrote when creating a shared library with C++
  18. code  using  SAS/C++.  It  simly  does  what  its  name  tells:  convert
  19. prototypes to function description entries (.FD) (used to create pragmas
  20. for library calls).
  21.  
  22. Creating C code shared libraries with SAS/C++  6.56  is  a  pretty  easy
  23. task.  This  is  not  the case for C++! Not only you have to provide all
  24. your  class  declarations  AND  definitions  with  '__asm'  and   '__asm
  25. __saveds'  keywords  as  well  as  a  register  info  for every function
  26. arguments. This you could bear. But you also have to create an entry  in
  27. the  function  description  file  (.FD)  for  EACH of the translated and
  28. *name-mangled* C-function of your C++ classes!!!
  29.  
  30. That's where this tiny tool helps out. It just takes  a  prototype  file
  31. generated  with  the  SAS/C  *GenProto*  option  (or any other prototype
  32. extraction program, like f.e. protoman) as input  an  creates  fast  and
  33. easy  for  every function with the keywords '__asm' the desired function
  34. description entry into the output file.
  35.  
  36. The command syntax is:
  37.  
  38.         proto2fd <infile> [outfile]
  39.  
  40.         infile:  filename of the file containing the prototypes.
  41.  
  42.         outfile: filename of the output file (optional). If left out, an
  43.                  appropriate filename with .fd extension will be created
  44.                  from the infile name.
  45.  
  46.  
  47. For example to create the FD file  from  'foo.cpp',  say  'foo.fd',  the
  48. following  steps  are  necessary  (assuming  the  class  declaration and
  49. definitions contain the '__asm' and '__saveds' keywords as described  in
  50. the 'SAS/C Library Reference'):
  51.  
  52.         1. First create C translation of 'foo.cpp',
  53.            > sc CxxOnly foo.cpp         ; this will create foo..c
  54.  
  55.         2. then create the prototypes file
  56.            > sc GenProto foo..c GenProtoParm GenProtoFile=foo.protos 
  57.  
  58.         3. and finally create 'foo.fd'
  59.            > proto2fd foo.protos foo.fd
  60.  
  61. Using smake you can easily automate the 3 steps by adding the  following
  62. rules and depencies to your makefile:
  63.  
  64. foo.fd:         foo.cpp
  65.  
  66. .cpp.fd:
  67.         sc cxxonly $?
  68.         sc genproto $*..c genprotoparm genprotofile=$*.protos
  69.         proto2fd $*.protos $@
  70.  
  71. There seems to be a problem with the SAS/C/C++ GenProto  option  as  the
  72. length  of  the  function  names  may  not be more than 32 chars. Longer
  73. function names will be truncated automatically to 32 chars and will  not
  74. be  found  later  by the linker! Mangled C function names may easily get
  75. longer than 32 chars.
  76.  
  77. If you like to use floating point registers (FPx) as parameters for your
  78. library  function  calls,  there seems to be a problems with the SAS/C++
  79. 6.56 version of the FD2Pragma tool. (In  SAS/C++,  you  get  a  compiler
  80. error,  if you try to use a Ax or Dx register for parameters of floating
  81. point type, f.e. 'double'). A replacement for this tool is  provided  in
  82. this  distribution  archive  (See  fd2pragma.doc, for more details about
  83. this).
  84.  
  85.  
  86. If you have any problems using this tool or suggestions, please  let  me
  87. know.
  88.  
  89. Alex H. Schneider
  90.  
  91. schneidr@igt.baum.ethz.ch
  92.  
  93. ************************************************************************
  94.   If you know a faster way to do the above things, PLEASE let me know.
  95. ************************************************************************
  96.  
  97. Program History:
  98.  
  99.         v37.3 (19.11.1995):     . Added ability to use floating point 
  100.                                   registers (FPx).
  101.                                 . Added a replacement for SAS/C++
  102.                                   fd2proto tools for FPx use with FPx
  103.                                   registers.
  104.  
  105.         v37.2 (12.11.1995):     . Fixed to work with other prototype 
  106.                                   extractors: f.e: ProtoMan
  107.                                 . check for '__saveds' key word removed
  108.  
  109.         v37.1 (30.10.1995):     . First public release
  110.  
  111.  
  112. ************************************************************************
  113. 
  114.  
  115.  
  116. ============================= Archive contents =============================
  117.  
  118. Original  Packed Ratio    Date     Time    Name
  119. -------- ------- ----- --------- --------  -------------
  120.    18016   10815 39.9% 20-Nov-95 22:39:28  fd2pragma
  121.     2712    1116 58.8% 20-Nov-95 22:39:52  fd2pragma.doc
  122.     1410     523 62.9% 19-Nov-95 21:21:52  fd2pragma.doc.info
  123.    17044   10249 39.8% 19-Nov-95 20:25:30  proto2fd
  124.     4366    1750 59.9% 19-Nov-95 21:22:48  proto2fd.doc
  125.     1410     524 62.8% 19-Nov-95 21:21:52  proto2fd.doc.info
  126. -------- ------- ----- --------- --------
  127.    44958   24977 44.4% 21-Nov-95 23:01:22   6 files
  128.