⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p2c.cat

📁 把pascal程序转成C语言程序 把pascal程序转成C语言程序
💻 CAT
📖 第 1 页 / 共 5 页
字号:
     line-breaker debugging, -C_n enables comment placement debug-     ging, and -F_n enables flow-analysis debugging.CHOICE OF SOURCE LANGUAGE     The Language  configuration  parameter  or  -L  command-line     option tells _p_2_c which Pascal dialect to expect in the input     file.  Any language features which do  not  overlap  between     dialects are supported all of the time.  The Language param-     eter is consulted when a syntax or usage  is  detected  that     has  different  meanings in two different dialects, and also     to determine default values for  various  other  translation     parameters as described below.     The following language words are supported by _p_2_c. Names are     case-insensitive.     HP      HP Pascal.   This  is  the  default  language.   All             features  of HP Standard Pascal, the Pascal Worksta-             tion version, are supported except as noted in  BUGS             below.   Some features of MODCAL, HP's extended Pas-             cal, are also supported.  This is a superset of  ISO             standard  Pascal,  including  conformant  arrays and             procedural parameters.     HP-UX   HP Pascal, HP-UX version.  Almost identical  to  the             "HP" dialect.     Turbo   Turbo Pascal 5.0 for the IBM PC.  Few conflicts with             HP  Pascal,  so  the Language parameter is not often             needed for Turbo.  (Most important is that the Turbo             and  HP dialects use 16 and 32 bit integers, respec-             tively.)     UCSD    UCSD Pascal.  Similar to Turbo in many ways.     MPW     Macintosh Programmer's Workshop Pascal 2.0.   Should             also  do  a  pretty  good job for Lightspeed Pascal.             Object Pascal features are not supported, nor is theSun Release 4.1        Last change: local                       5P2C(1)                   USER COMMANDS                     P2C(1)             fact  that char variables are sometimes stored in 16             bits.     VAX     VAX/VMS  Pascal  version  3.5.   Most  but  not  all             language  features supported.  This has not yet been             tested on large programs.     Oregon  Oregon Software Pascal/2.  All features implemented.     Berk    Berkeley Pascal with Sun extensions.     TIP     Texas Instruments Pascal.     Apollo  Apollo Domain Pascal.     Modula  Modula-2.  Based on Wirth's _P_r_o_g_r_a_m_m_i_n_g _i_n _M_o_d_u_l_a-_2,             3rd edition.  Proper setting of the Language parame-             ter is _n_o_t optional.  Translation will be incomplete             in  most  cases,  but  should be good enough to work             with.  Structure of local sub-modules is essentially             ignored;  like-named  identifiers  may  be confused.             Type WORD is translated  as  an  integer,  but  type             ADDRESS  is translated as char * or void *; this may             cause inconsistencies in the output code.             Modula-2 modules have two parts in  separate  files.             Suppose  these  are called _f_o_o._d_e_f (definition part)             and _f_o_o._m_o_d (implementation part)  for  module  _f_o_o.             Then  a  pattern like %s.def must be included in the             ImportDir list, and LibraryFile must be  changed  to             refer   to   _s_y_s_t_e_m._m_2  instead  of  _s_y_s_t_e_m._i_m_p.  To             translate the definition part, give the command                  p2c foo.def             to translate the definition part  into  files  _f_o_o._h             and  _f_o_o._c;  the  latter will usually be empty.  The             command                  p2c -s foo.def foo.mod             will translate the  implementation  part  into  file             _f_o_o._c.     Even if all language features are supported for  a  dialect,     some  predefined  functions may be omitted.  In these cases,     the function call will be translated literally into C with a     warning.  Some hand modification may be required.CONFIGURATION PARAMETERS     _P_2_c is highly configurable.  The defaults are  suitable  for     most  applications,  but  customizing  these parameters willSun Release 4.1        Last change: local                       6P2C(1)                   USER COMMANDS                     P2C(1)     help you get the best possible translation.  Since the  out-     put  of  _p_2_c  is  intended  to be used as human-maintainable     source code, there are many parameters  for  describing  the     coding  style and conventions you prefer.  Others give hints     about your program that help _p_2_c to generate  more  correct,     efficient, or readable code.     The _p_2_c_r_c files contain a list of parameters, one per  line.     The system configuration file, which may be viewed using the     -i option to _p_2_c, serves as an example of the proper format.     Parameter  names  are case-insensitive.  If a parameter name     occurs exactly once in the system _p_2_c_r_c, this indicates that     it  must  have a unique value and the last value given to it     by the configuration files is used.   Other  parameters  are     written  several  times  in  a row; these are lists to which     each configuration line adds an entry.     Many _p_2_c_r_c options take a numeric value of 0 or  1,  roughly     corresponding  to "no" or "yes."  Sometimes a blank value or     the value  "def"  corresponds  to  an  intermediate  "maybe"     state.    For  example,  the  stylistic  option  ExtraParens     switches between copious or minimal parentheses  in  expres-     sions,  with the default being a nice compromise intended to     be best for readers with an average knowledge of C  operator     precedences.     Configuration options may also be  embedded  in  the  source     file in the form of Pascal comments:          {ShortOpt=0} {AvoidName=fred}          {FuncMacro slope(x,y)=atan2(y,x)*RadDeg}     disables automatic short-circuiting of and  and  or  expres-     sions,  adds  "_f_r_e_d"  to the list of names to avoid using in     generated C code, and defines a special translation for  the     Pascal  program's  _s_l_o_p_e function using the standard C _a_t_a_n_2     function and a constant _R_a_d_D_e_g  presumably  defined  in  the     program.   Whitespace  is  generally not allowed in embedded     parameters.  The `=' sign is required for  embedded  parame-     ters, though it is optional in _p_2_c_r_c files.  Comments within     embedded parameters are delimited by `##'.  Numeric  parame-     ters may replace `=' with `+' or `-' to increase or decrease     the parameter; list-based parameters may use `-' to remove a     name from a list rather than adding it.  Also, the parameter     name by itself  in  comment  braces  means  to  restore  the     parameter's value that was current before the last change:          {VarFiles=0  ## Pass FILE *'s params by value  even  if     VAR}          _s_o_m_e _d_e_c_l_a_r_a_t_i_o_n_s          {VarFiles    ## Back to original FILE * passing}Sun Release 4.1        Last change: local                       7P2C(1)                   USER COMMANDS                     P2C(1)     causes the parameter VarFiles to have the value 0 for  those     few  declarations,  without  affecting the parameter's value     elsewhere in the file.     If an embedded parameter appears in an include  file  or  in     interface  text  for  a module, the effect of the assignment     normally carries over to any  programs  that  included  that     file.   If the parameter name is preceded by a `*', then the     assignment is automatically undone  after  the  source  file     that contains it ends:          {IncludeFrom strings=<p2c/strings.h>}          {*ExportSymbol=pascal_%s}          module strings;     will record the location of  the  _s_t_r_i_n_g_s  module's  include     file  for the rest of the translation, but the assignment of     ExportSymbol pertains only to the module itself.     For the complete list of _p_2_c_r_c parameters, run _p_2_c with  the     -i  option.   Here  are some additional comments on selected     parameters:     ImportAll      Because Turbo Pascal only allows one unit per                    source  file, _p_2_c normally stops reading past                    the  word  _i_m_p_l_e_m_e_n_t_a_t_i_o_n  in  a  file  being                    scanned  for  interface  text.  But HP Pascal                    allows several modules per file and  so  this                    would  not  be  safe  to  do.   The ImportAll                    option lets you override the default behavior                    for your Pascal dialect.     AnsiC          This parameter selects which dialect of C  to                    use.  If 1, all conventions of ANSI C such as                    prototypes, void * pointers, etc.  are  used.                    If  0,  only  strict K&R (first edition) C is                    used.  The default  is  to  use  "traditional                    UNIX C," which includes enum and void but not                    void * or prototypes.  Once again there are a                    number  of other parameters which may be used                    to control the individual  features  if  just                    setting AnsiC is not enough.     C++            This tells _p_2_c to use a  number  of  language                    extensions  present in C++:  Specifically, it                    enables the "//" format for comments, use  of                    "anonymous  unions"  for variant records, use                    of declarations within the function body, use                    of  references for VAR parameters, and use of                    "new" and "delete" instead  of  "malloc"  and                    "free".   _P_2_c  will check for collisions with                    C++ reserved words unless you explicitly  setSun Release 4.1        Last change: local                       8P2C(1)                   USER COMMANDS                     P2C(1)                    the C++ option to zero.     TurboObjects   _P_2_c recognizes two major dialects of  object-                    oriented  Pascal.   Turbo  Pascal  6.0 object                    types  translate  fairly  directly  into  C++                    classes.    In  Apple's  Object  Pascal,  the                    object type has similar syntax but represents                    a  handle  (a  double  pointer)  to an object                    rather than an object itself.   The  TurboOb-                    jects  option (whose default is determined by                    the Language setting)  says  whether  objects                    should   be   direct   or   indirect  through                    pointers.  (_P_2_c uses pointers instead of han-                    dles; _p_2_c is most often used to make programs                    more portable, and few systems except the Mac                    use handles in this way.)     UseVExtern     Many non-UNIX linkers prohibit variables from                    being defined (not declared) by more than one                    source file.  One module must declare,  e.g.,                    "int  foo;",  and  all  others  must  declare                    "extern int foo;".  _P_2_c accomplishes this  by                    declaring   public   variables  "vextern"  in                    header files, and  arranging  for  the  macro                    vextern  to  expand  to  extern or to nothing                    when appropriate.  If  you  set  UseVExtern=0                    _p_2_c  will  instead  declare  variables  in  a                    simpler way that  works  only  on  UNIX-style                    linkers.     UseAnyptrMacros                    Certain C reserved words have meanings  which                    may   vary   from  one  C  implementation  to                    another.  _P_2_c uses special capitalized  names                    for  these  words; these names are defined as

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -