Changeset 5bd0aad


Ignore:
Timestamp:
Jul 17, 2017, 3:54:08 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
969b3fe
Parents:
e60e0dc (diff), 59e86eb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
4 added
21 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    re60e0dc r5bd0aad  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Jul 13 11:44:59 2017
    14 %% Update Count     : 335
     13%% Last Modified On : Mon Jul 17 10:21:17 2017
     14%% Update Count     : 348
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    134134
    135135% inline text and code index (cannot use ©)
    136 \newcommand{\Indexc}[1]{\lstinline$#1$\index{#1@\lstinline$#1$}}
     136\newcommand{\Indexc}[2][\@empty]{\lstinline[#1]$#2$\index{#2@\lstinline[#1]$#2$}}
    137137% code index (cannot use ©)
    138 \newcommand{\indexc}[1]{\index{#1@\lstinline$#1$}}
     138\newcommand{\indexc}[2][\@empty]{\index{#2@\lstinline[#1]$#2$}}
    139139
    140140% Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}.
  • doc/user/EHMHierarchy.fig

    re60e0dc r5bd0aad  
    1 #FIG 3.2  Produced by xfig version 3.2.5b
     1#FIG 3.2  Produced by xfig version 3.2.5c
    22Landscape
    33Center
     
    19192 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2
    2020        1 1 1.00 60.00 90.00
    21          1950 1425 3000 1200
     21         1950 1425 2925 1200
    22222 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2
    2323        1 1 1.00 60.00 90.00
     
    2929        1 1 1.00 60.00 90.00
    3030         4950 1950 4950 1725
    31 4 1 0 100 0 0 12 0.0000 0 135 195 1950 1650 IO\001
    32 4 1 0 100 0 0 12 0.0000 0 135 870 4950 1650 Arithmetic\001
    33 4 1 0 100 0 0 12 0.0000 0 135 315 1350 2100 File\001
    34 4 1 0 100 0 0 12 0.0000 0 135 690 2550 2100 Network\001
    35 4 1 0 100 0 0 12 0.0000 0 180 1170 3750 2100 DivideByZero\001
    36 4 1 0 100 0 0 12 0.0000 0 135 750 4950 2100 Overflow\001
    37 4 1 0 100 0 0 12 0.0000 0 135 855 6000 2100 Underflow\001
    38 4 1 0 100 0 0 12 0.0000 0 180 840 3450 1200 Exception\001
     314 1 0 50 -1 0 13 0.0000 2 135 225 1950 1650 IO\001
     324 1 0 50 -1 0 13 0.0000 2 135 915 4950 1650 Arithmetic\001
     334 1 0 50 -1 0 13 0.0000 2 150 330 1350 2100 File\001
     344 1 0 50 -1 0 13 0.0000 2 135 735 2550 2100 Network\001
     354 1 0 50 -1 0 13 0.0000 2 180 1215 3750 2100 DivideByZero\001
     364 1 0 50 -1 0 13 0.0000 2 150 810 4950 2100 Overflow\001
     374 1 0 50 -1 0 13 0.0000 2 150 915 6000 2100 Underflow\001
     384 1 0 50 -1 0 13 0.0000 2 180 855 3450 1200 Exception\001
  • doc/user/user.tex

    re60e0dc r5bd0aad  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Jul 13 11:44:57 2017
    14 %% Update Count     : 2690
     13%% Last Modified On : Mon Jul 17 13:06:40 2017
     14%% Update Count     : 2825
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    353353The 1999 C standard plus GNU extensions.
    354354\item
    355 {\lstset{deletekeywords={inline}}
    356 \Indexc{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{©-fgnu89-inline©}}
     355\Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}}
    357356Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files.
    358 }%
    359357\end{description}
    360358The following new \CFA options are available:
     
    479477\end{cfa}
    480478Existing C programs with keyword clashes can be converted by enclosing keyword identifiers in backquotes, and eventually the identifier name can be changed to a non-keyword name.
    481 \VRef[Figure]{f:InterpositionHeaderFile} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©:
     479\VRef[Figure]{f:HeaderFileInterposition} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©:
    482480
    483481\begin{figure}
     
    487485#define otype ®`®otype®`®               §\C{// make keyword an identifier}§
    488486#define __CFA_BFD_H__
    489 #endif // ! otype
    490 
    491 #®include_next® <bfd.h>                 §\C{// must have internal check for multiple expansion}§
    492 
     487#endif
     488
     489®#include_next <bfd.h>                  §\C{// must have internal check for multiple expansion}§
     490®
    493491#if defined( otype ) && defined( __CFA_BFD_H__ )        §\C{// reset only if set}§
    494492#undef otype
    495493#undef __CFA_BFD_H__
    496 #endif // otype && __CFA_BFD_H__
    497 \end{cfa}
    498 \caption{Interposition of Header File}
    499 \label{f:InterpositionHeaderFile}
     494#endif
     495\end{cfa}
     496\caption{Header-File Interposition}
     497\label{f:HeaderFileInterposition}
    500498\end{figure}
     499
     500
     501\section{Exponentiation Operator}
     502
     503C, \CC, and Java (and many other programming languages) have no exponentiation operator\index{exponentiation!operator}\index{operator!exponentiation}, \ie $x^y$, and instead use a routine, like \Indexc{pow}, to perform the exponentiation operation.
     504\CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@\lstinline$?\?$} and ©?\=?©\index{?\\=?@\lstinline$?\=?$}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$.
     505The priority of the exponentiation operator is between the cast and multiplicative operators, so that ©w * (int)x \ (int)y * z© is parenthesized as ©((w * (((int)x) \ ((int)y))) * z)©.
     506
     507As for \Index{division}, there are exponentiation operators for integral and floating-point types, including the builtin \Index{complex} types.
     508Unsigned integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication (or shifting if the base is 2).
     509Signed integral exponentiation\index{exponentiation!signed integral} is performed with repeated multiplication (or shifting if the base is 2), but yields a floating-point result because $b^{-e}=1/b^e$.
     510Hence, it is important to designate exponent integral-constants as unsigned or signed: ©3 \ 3u© return an integral result, while ©3 \ 3© returns a floating-point result.
     511Floating-point exponentiation\index{exponentiation!floating point} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative.
     512\begin{cfa}
     513sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl;
     514256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i
     515\end{cfa}
     516Parenthesis are necessary for the complex constants or the expresion is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©.
     517The exponentiation operator is available for all the basic types, but for user-defined types, only the integral version is available, if the user type defines multiplication, ©*©, and one, ©1©.
    501518
    502519
     
    922939        int i, j;
    923940        int mem() {              ®// implicit "this" parameter
    924                 i = 1;          ®// this->i
     941®               i = 1;          ®// this->i
    925942®               j = 3;          ®// this->j
    926943®       }
     
    929946Since CFA is non-object-oriented, the equivalent object-oriented program looks like:
    930947\begin{cfa}
    931 struct C {
    932         int i, j;
    933 };
    934 int mem( C &this ) {    // explicit "this" parameter
     948struct S { int i, j; };
     949int mem( S &this ) {    // explicit "this" parameter
    935950        ®this.®i = 1;                     // "this" is not elided
    936951        ®this.®j = 2;
     
    938953\end{cfa}
    939954but it is cumbersome having to write "©this.©" many times in a member.
    940 \CFA provides a ©with© clause/statement to elided the "©this.©".
    941 \begin{cfa}
    942 int mem( C &this ) ®with this® {
     955
     956\CFA provides a ©with© clause/statement to elided the "©this.©" by opening a scope containing field identifiers and changing the qualified fields into variables, giving an opportunity for optimizing qualified references.\footnote{
     957The ©with© statement comes from Pascal~\cite[\S~4.F]{Pascal}.}
     958\begin{cfa}
     959int mem( S &this ) ®with this® {
    943960        i = 1;                  ®// this.i
    944961®       j = 2;                  ®// this.j
     
    947964which extends to multiple routine parameters:
    948965\begin{cfa}
    949 struct D {
    950         double m, n;
    951 };
    952 int mem2( C &this1, D &this2 ) ®with this1, this2® {
     966struct T { double m, n; };
     967int mem2( S &this1, T &this2 ) ®with this1, this2® {
    953968        i = 1; j = 2;
    954969        m = 1.0; n = 2.0;
    955970}
    956971\end{cfa}
    957 The ©with© clause/statement comes from Pascal~\cite[\S~4.F]{Pascal}.
    958972
    959973The statement form is used within a block:
     
    965979                // access fields of s1 without qualification
    966980                ®with s2® {  // nesting
    967                         // access fields of s2 without qualification
     981                        // access fields of s1 and s2 without qualification
    968982                }
    969983        }
     
    974988\end{cfa}
    975989
    976 Names clashes when opening multiple structures are ambiguous.
    977 \begin{cfa}
    978 struct A { int i; int j; } a, c;
    979 struct B { int i; int k; } b, c;
     990When opening multiple structures, fields with the same name and type are ambiguous and must be fully qualified.
     991For fields with the same name but different type, context/cast can be used to disambiguate.
     992\begin{cfa}
     993struct S { int i; int j; double m; } a, c;
     994struct T { int i; int k; int m } b, c;
    980995®with a, b® {
    981         j + k;                                          §\C{// unambiguous}§
    982         i;                                                      §\C{// ambiguous}§
    983         a.i + b.i;                                      §\C{// unambiguous}§
    984 }
    985 ®with c® {                                              §\C{// ambiguous}§
    986         // ...
    987 }
     996        j + k;                                          §\C{// unambiguous, unique names define unique type}§
     997        i;                                                      §\C{// ambiguous, same name and type}§
     998        a.i + b.i;                                      §\C{// unambiguous, qualification defines unique type}§
     999        m;                                                      §\C{// ambiguous, no context to define unique type}§
     1000        m = 5.0;                                        §\C{// unambiguous, context defines unique type}§
     1001        m = 1;                                          §\C{// unambiguous, context defines unique type}§
     1002}
     1003®with c® { ... }                                §\C{// ambiguous, no context}§
     1004®with (S)c® { ... }                             §\C{// unambiguous, cast defines unique type}§
    9881005\end{cfa}
    9891006
    9901007
    9911008\section{Exception Handling}
     1009\label{s:ExceptionHandling}
    9921010
    9931011Exception handling provides two mechanism: change of control flow from a raise to a handler, and communication from the raise to the handler.
    994 \begin{cfa}
    995 exception void h( int i );
    996 exception int h( int i, double d );
    997 
     1012Transfer of control can be local, within a routine, or non-local, among routines.
     1013Non-local transfer can cause stack unwinding, i.e., non-local routine termination, depending on the kind of raise.
     1014\begin{cfa}
     1015exception_t E {};                               §\C{// exception type}§
    9981016void f(...) {
    999         ... throw h( 3 );
    1000         ... i = resume h( 3, 5.1 );
    1001 }
    1002 
     1017        ... throw E{}; ...                      §\C{// termination}§
     1018        ... throwResume E{}; ...        §\C{// resumption}§
     1019}
    10031020try {
    10041021        f(...);
    1005 } catch h( int w ) {
    1006         // reset
    1007 } resume h( int p, double x ) {
    1008         return 17;  // recover
     1022} catch( E e : §boolean-predicate§ ) {                  §\C{// termination handler}§
     1023        // recover and continue
     1024} catchResume( E e : §boolean-predicate§ ) {    §\C{// resumption handler}§
     1025        // repair and return
    10091026} finally {
    1010 }
    1011 \end{cfa}
    1012 So the type raised would be the mangled name of the exception prototype and that name would be matched at the handler clauses by comparing the strings.
    1013 The arguments for the call would have to be packed in a message and unpacked at handler clause and then a call made to the handler.
     1027        // always executed
     1028}
     1029\end{cfa}
     1030The kind of raise and handler match: ©throw© with ©catch© and @throwResume@ with @catchResume@.
     1031Then the exception type must match along with any additonal predicate must be true.
     1032The ©catch© and ©catchResume© handlers may appear in any oder.
     1033However, the ©finally© clause must
    10141034
    10151035
     
    15711591
    15721592\item
    1573 lvalue to reference conversion: \lstinline[deletekeywords={lvalue}]@lvalue-type cv1 T@ converts to ©cv2 T &©, which allows implicitly converting variables to references.
     1593lvalue to reference conversion: \lstinline[deletekeywords=lvalue]$lvalue-type cv1 T$ converts to ©cv2 T &©, which allows implicitly converting variables to references.
    15741594\begin{cfa}
    15751595int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &)
     
    26802700\begin{cfa}[belowskip=0pt]
    26812701char store[®sepSize®];                                          §\C{// sepSize is the maximum separator size}§
    2682 strcpy( store, sepGet( sout ) );
    2683 sepSet( sout, "_" );
     2702strcpy( store, sepGet( sout ) );                          §\C{// copy current separator}§
     2703sepSet( sout, "_" );                                            §\C{// change separator to underscore}§
    26842704sout | 1 | 2 | 3 | endl;
    26852705\end{cfa}
     
    26882708\end{cfa}
    26892709\begin{cfa}[belowskip=0pt]
    2690 sepSet( sout, store );
     2710sepSet( sout, store );                                          §\C{// change separator back to original}§
    26912711sout | 1 | 2 | 3 | endl;
    26922712\end{cfa}
     
    55635583\Celeven prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list:
    55645584\begin{quote2}
    5565 \lstset{deletekeywords={float}}
    5566 \begin{tabular}{@{}llll|l@{}}
    5567 \multicolumn{4}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
     5585\begin{tabular}{@{}lllll|l@{}}
     5586\multicolumn{5}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
    55685587\hline
    55695588\begin{tabular}{@{}l@{}}
     
    55735592\Indexc{errno.h}                \\
    55745593\Indexc{fenv.h}                 \\
    5575 \Indexc{float.h}                \\
    5576 \Indexc{inttypes.h}             \\
    5577 \Indexc{iso646.h}               \\
     5594\Indexc[deletekeywords=float]{float.h} \\
    55785595\end{tabular}
    55795596&
    55805597\begin{tabular}{@{}l@{}}
     5598\Indexc{inttypes.h}             \\
     5599\Indexc{iso646.h}               \\
    55815600\Indexc{limits.h}               \\
    55825601\Indexc{locale.h}               \\
    55835602\Indexc{math.h}                 \\
    55845603\Indexc{setjmp.h}               \\
     5604\end{tabular}
     5605&
     5606\begin{tabular}{@{}l@{}}
    55855607\Indexc{signal.h}               \\
    55865608\Indexc{stdalign.h}             \\
    55875609\Indexc{stdarg.h}               \\
    55885610\Indexc{stdatomic.h}    \\
     5611\Indexc{stdbool.h}              \\
     5612\Indexc{stddef.h}               \\
    55895613\end{tabular}
    55905614&
    55915615\begin{tabular}{@{}l@{}}
    5592 \Indexc{stdbool.h}              \\
    5593 \Indexc{stddef.h}               \\
    55945616\Indexc{stdint.h}               \\
    55955617\Indexc{stdio.h}                \\
     
    56075629\Indexc{wctype.h}               \\
    56085630                                                \\
    5609                                                 \\
    5610                                                 \\
    56115631\end{tabular}
    56125632&
     
    56145634\Indexc{unistd.h}               \\
    56155635\Indexc{gmp.h}                  \\
    5616                                                 \\
    5617                                                 \\
    56185636                                                \\
    56195637                                                \\
     
    56555673The table shows allocation routines supporting different combinations of storage-management capabilities:
    56565674\begin{center}
    5657 \begin{tabular}{@{}lr|l|l|l|l@{}}
    5658                 &                                       & \multicolumn{1}{c|}{fill}     & resize        & alignment     & array \\
     5675\begin{tabular}{@{}r|r|l|l|l|l@{}}
     5676\multicolumn{1}{c}{}&           & \multicolumn{1}{c|}{fill}     & resize        & alignment     & array \\
    56595677\hline
    56605678C               & ©malloc©                      & no                    & no            & no            & no    \\
     
    56635681                & ©memalign©            & no                    & no            & yes           & no    \\
    56645682                & ©posix_memalign©      & no                    & no            & yes           & no    \\
     5683\hline
    56655684C11             & ©aligned_alloc©       & no                    & no            & yes           & no    \\
     5685\hline
    56665686\CFA    & ©alloc©                       & no/copy/yes   & no/yes        & no            & yes   \\
    56675687                & ©align_alloc©         & no/yes                & no            & yes           & yes   \\
  • src/CodeGen/OperatorTable.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 14:33:05 2016
    13 // Update Count     : 10
     12// Last Modified On : Sat Jul 15 17:12:22 2017
     13// Update Count     : 15
    1414//
    1515
     
    3535                        {       "++?",          "++",   "_operator_preincr",                    OT_PREFIXASSIGN         },
    3636                        {       "--?",          "--",   "_operator_predecr",                    OT_PREFIXASSIGN         },
     37                        {       "?\\?",         "\\",   "_operator_exponential",                OT_INFIX                        },
    3738                        {       "?*?",          "*",    "_operator_multiply",                   OT_INFIX                        },
    3839                        {       "?/?",          "/",    "_operator_divide",                             OT_INFIX                        },
     
    5253                        {       "?|?",          "|",    "_operator_bitor",                              OT_INFIX                        },
    5354                        {       "?=?",          "=",    "_operator_assign",                             OT_INFIXASSIGN          },
     55                        {       "?\\=?",        "\\=",  "_operator_expassign",                  OT_INFIXASSIGN          },
    5456                        {       "?*=?",         "*=",   "_operator_multassign",                 OT_INFIXASSIGN          },
    5557                        {       "?/=?",         "/=",   "_operator_divassign",                  OT_INFIXASSIGN          },
  • src/Makefile.in

    re60e0dc r5bd0aad  
    216216        SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \
    217217        SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \
     218        SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \
    218219        SynTree/driver_cfa_cpp-Type.$(OBJEXT) \
    219220        SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \
     
    514515        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    515516        SymTab/FixFunction.cc SymTab/ImplementationType.cc \
    516         SymTab/TypeEquality.cc SymTab/Autogen.cc SynTree/Type.cc \
    517         SynTree/VoidType.cc SynTree/BasicType.cc \
     517        SymTab/TypeEquality.cc SymTab/Autogen.cc SymTab/TreeStruct.cc \
     518        SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
    518519        SynTree/PointerType.cc SynTree/ArrayType.cc \
    519520        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
     
    848849SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    849850        SymTab/$(DEPDIR)/$(am__dirstamp)
     851SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \
     852        SymTab/$(DEPDIR)/$(am__dirstamp)
    850853SynTree/$(am__dirstamp):
    851854        @$(MKDIR_P) SynTree
     
    10331036@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@
    10341037@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@
     1038@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@
    10351039@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@
    10361040@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
     
    20842088@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    20852089@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
     2090
     2091SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc
     2092@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
     2093@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
     2094@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@
     2095@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2096@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
     2097
     2098SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc
     2099@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
     2100@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
     2101@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@
     2102@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2103@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
    20862104
    20872105SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc
  • src/Parser/DeclarationNode.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:27:00 2017
    13 // Update Count     : 1019
     12// Last Modified On : Fri Jul 14 16:55:00 2017
     13// Update Count     : 1020
    1414//
    1515
     
    253253        newnode->type->aggregate.fields = fields;
    254254        newnode->type->aggregate.body = body;
     255        newnode->type->aggregate.tagged = false;
     256        newnode->type->aggregate.parent = nullptr;
    255257        return newnode;
    256258} // DeclarationNode::newAggregate
     
    273275        return newnode;
    274276} // DeclarationNode::newEnumConstant
     277
     278DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     279        assert( name );
     280        DeclarationNode * newnode = new DeclarationNode;
     281        newnode->type = new TypeData( TypeData::Aggregate );
     282        newnode->type->aggregate.kind = kind;
     283        newnode->type->aggregate.name = name;
     284        newnode->type->aggregate.actuals = actuals;
     285        newnode->type->aggregate.fields = fields;
     286        newnode->type->aggregate.body = body;
     287        newnode->type->aggregate.tagged = true;
     288        newnode->type->aggregate.parent = parent;
     289        return newnode;
     290} // DeclarationNode::newTreeStruct
    275291
    276292DeclarationNode * DeclarationNode::newName( string * name ) {
  • src/Parser/ExpressionNode.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:15 2017
    13 // Update Count     : 542
     12// Last Modified On : Sat Jul 15 16:09:04 2017
     13// Update Count     : 549
    1414//
    1515
     
    231231}
    232232
     233// Must harmonize with OperKinds.
    233234static const char *OperName[] = {
    234235        // diadic
    235         "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&",
     236        "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&",
    236237        "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
    237         "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
     238        "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
    238239        "?[?]", "...",
    239240        // monadic
  • src/Parser/ParseNode.h

    re60e0dc r5bd0aad  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:00:00 2017
    13 // Update Count     : 779
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 15 16:00:48 2017
     13// Update Count     : 785
    1414//
    1515
     
    141141};
    142142
     143// Must harmonize with OperName.
    143144enum class OperKinds {
    144145        // diadic
    145         SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,
     146        SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And,
    146147        BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
    147         Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
     148        Assign, AtAssn, ExpAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
    148149        Index, Range,
    149150        // monadic
     
    248249        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    249250
     251        // Perhaps this would best fold into newAggragate.
     252        static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     253
    250254        DeclarationNode();
    251255        ~DeclarationNode();
     
    332336
    333337        static UniqueName anonymous;
     338
     339        // Temp to test TreeStruct
     340        const std::string * parent_name;
    334341}; // DeclarationNode
    335342
  • src/Parser/TypeData.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:28:00 2017
    13 // Update Count     : 564
     12// Last Modified On : Fri Jul 14 16:58:00 2017
     13// Update Count     : 565
    1414//
    1515
     
    6363                aggregate.fields = nullptr;
    6464                aggregate.body = false;
     65                aggregate.tagged = false;
     66                aggregate.parent = nullptr;
    6567                break;
    6668          case AggregateInst:
     
    121123                delete aggregate.actuals;
    122124                delete aggregate.fields;
     125                delete aggregate.parent;
    123126                // delete aggregate;
    124127                break;
     
    192195                newtype->aggregate.kind = aggregate.kind;
    193196                newtype->aggregate.body = aggregate.body;
     197                newtype->aggregate.tagged = aggregate.tagged;
     198                newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
    194199                break;
    195200          case AggregateInst:
     
    619624        switch ( td->aggregate.kind ) {
    620625          case DeclarationNode::Struct:
     626                if ( td->aggregate.tagged ) {
     627                        at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );
     628                        buildForall( td->aggregate.params, at->get_parameters() );
     629                        break;
     630                }
    621631          case DeclarationNode::Coroutine:
    622632          case DeclarationNode::Monitor:
  • src/Parser/TypeData.h

    re60e0dc r5bd0aad  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:29:00 2017
    13 // Update Count     : 186
     12// Last Modified On : Fri Jul 14 16:57:00 2017
     13// Update Count     : 187
    1414//
    1515
     
    3131                DeclarationNode * fields;
    3232                bool body;
     33
     34                bool tagged;
     35                const std::string * parent;
    3336        };
    3437
  • src/Parser/lex.ll

    re60e0dc r5bd0aad  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Jul 12 18:04:44 2017
    13  * Update Count     : 535
     12 * Last Modified On : Sat Jul 15 15:46:34 2017
     13 * Update Count     : 542
    1414 */
    1515
     
    125125op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post}
    126126
    127 op_binary_only "/"|"%"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="
     127op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>="
    128128op_binary_over {op_unary_binary}|{op_binary_only}
    129129                                // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@="
     
    136136
    137137%%
    138                                    /* line directives */
     138                                /* line directives */
    139139^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" {
    140140        /* " stop highlighting */
     
    337337"-"                             { ASCIIOP_RETURN(); }
    338338"*"                             { ASCIIOP_RETURN(); }
     339"\\"                    { ASCIIOP_RETURN(); }                                   // CFA, exponentiation
    339340"/"                             { ASCIIOP_RETURN(); }
    340341"%"                             { ASCIIOP_RETURN(); }
     
    361362"+="                    { NAMEDOP_RETURN(PLUSassign); }
    362363"-="                    { NAMEDOP_RETURN(MINUSassign); }
     364"\\="                   { NAMEDOP_RETURN(EXPassign); }                  // CFA, exponentiation
    363365"*="                    { NAMEDOP_RETURN(MULTassign); }
    364366"/="                    { NAMEDOP_RETURN(DIVassign); }
  • src/Parser/parser.yy

    re60e0dc r5bd0aad  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 13 14:38:54 2017
    13 // Update Count     : 2431
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Jul 17 12:17:00 2017
     13// Update Count     : 2455
    1414//
    1515
     
    151151%token ELLIPSIS                                                                                 // ...
    152152
    153 %token MULTassign       DIVassign       MODassign                               // *=   /=      %=/
     153%token EXPassign        MULTassign      DIVassign       MODassign       // \=   *=      /=      %=
    154154%token PLUSassign       MINUSassign                                                     // +=   -=
    155155%token LSassign         RSassign                                                        // <<=  >>=
     
    168168%type<op> ptrref_operator                               unary_operator                          assignment_operator
    169169%type<en> primary_expression                    postfix_expression                      unary_expression
    170 %type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
    171 %type<en> relational_expression                 equality_expression                     AND_expression                          exclusive_OR_expression
    172 %type<en> inclusive_OR_expression               logical_AND_expression          logical_OR_expression           conditional_expression
    173 %type<en> constant_expression                   assignment_expression           assignment_expression_opt
     170%type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
     171%type<en> shift_expression                              relational_expression           equality_expression
     172%type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
     173%type<en> logical_AND_expression                logical_OR_expression
     174%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    174175%type<en> comma_expression                              comma_expression_opt
    175 %type<en> argument_expression_list              argument_expression                     assignment_opt
     176%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    176177%type<fctl> for_control_expression
    177178%type<en> subrange
     
    573574        ;
    574575
     576exponential_expression:
     577        cast_expression
     578        | exponential_expression '\\' cast_expression
     579                { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); }
     580        ;
     581
    575582multiplicative_expression:
    576         cast_expression
    577         | multiplicative_expression '*' cast_expression
     583        exponential_expression
     584        | multiplicative_expression '*' exponential_expression
    578585                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); }
    579         | multiplicative_expression '/' cast_expression
     586        | multiplicative_expression '/' exponential_expression
    580587                { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); }
    581         | multiplicative_expression '%' cast_expression
     588        | multiplicative_expression '%' exponential_expression
    582589                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); }
    583590        ;
     
    678685        '='                                                                                     { $$ = OperKinds::Assign; }
    679686        | ATassign                                                                      { $$ = OperKinds::AtAssn; }
     687        | EXPassign                                                                     { $$ = OperKinds::ExpAssn; }
    680688        | MULTassign                                                            { $$ = OperKinds::MulAssn; }
    681689        | DIVassign                                                                     { $$ = OperKinds::DivAssn; }
     
    972980                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    973981
    974         | handler_key '(' push push exception_declaration pop ')' compound_statement pop
    975                 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); }
    976         | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop
    977                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); }
     982        | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     983                { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); }
     984        | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     985                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); }
     986        ;
     987
     988handler_predicate_opt:
     989        //empty
     990        | ';' conditional_expression
    978991        ;
    979992
     
    16671680        | aggregate_key attribute_list_opt typegen_name         // CFA
    16681681                { $$ = $3->addQualifiers( $2 ); }
     1682
     1683// Temp, testing TreeStruct
     1684    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name
     1685        {
     1686            typedefTable.makeTypedef( *$4 );            // create typedef
     1687            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1688            forall = false;                             // reset
     1689        }
     1690      '{' field_declaration_list '}'
     1691        {
     1692            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1693                $4, nullptr, nullptr, $7, true )->addQualifiers( $3 );
     1694        }
     1695    | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname
     1696        {
     1697            typedefTable.makeTypedef( *$4 );            // create typedef
     1698            if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $
     1699            forall = false;                             // reset
     1700        }
     1701      '{' field_declaration_list '}'
     1702        {
     1703            $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct,
     1704                $4, $5, nullptr, $8, true )->addQualifiers( $3 );
     1705        }
    16691706        ;
    16701707
     
    18451882cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    18461883        parameter_declaration
    1847         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt
     1884        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
    18481885                { $$ = $1->addName( $2 ); }
    1849         | cfa_abstract_tuple identifier_or_type_name assignment_opt
     1886        | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18501887                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    18511888                { $$ = $1->addName( $2 ); }
    1852         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt
     1889        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18531890                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    18541891        | cfa_function_specifier
     
    18671904parameter_declaration:
    18681905                // No SUE declaration in parameter list.
    1869         declaration_specifier_nobody identifier_parameter_declarator assignment_opt
     1906        declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
    18701907                {
    18711908                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    18721909                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    18731910                }
    1874         | declaration_specifier_nobody type_parameter_redeclarator assignment_opt
     1911        | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
    18751912                {
    18761913                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    18801917
    18811918abstract_parameter_declaration:
    1882         declaration_specifier_nobody assignment_opt
     1919        declaration_specifier_nobody default_initialize_opt
    18831920                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    1884         | declaration_specifier_nobody abstract_parameter_declarator assignment_opt
     1921        | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
    18851922                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    18861923        ;
     
    30453082        ;
    30463083
    3047 assignment_opt:
     3084default_initialize_opt:
    30483085        // empty
    30493086                { $$ = nullptr; }
  • src/SymTab/Autogen.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:30:00 2017
    13 // Update Count     : 61
     12// Last Modified On : Fri Jul 14 16:41:00 2017
     13// Update Count     : 62
    1414//
    1515
     
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
    402402                // Builtins do not use autogeneration.
    403                 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||
     403                if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA ||
    404404                         aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
    405405                        return;
  • src/SymTab/module.mk

    re60e0dc r5bd0aad  
    1010## Author           : Richard C. Bilson
    1111## Created On       : Mon Jun  1 17:49:17 2015
    12 ## Last Modified By : Rob Schluntz
    13 ## Last Modified On : Tue Jul 07 16:22:23 2015
    14 ## Update Count     : 2
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jul 12 13:06:00 2017
     14## Update Count     : 3
    1515###############################################################################
    1616
     
    2121       SymTab/ImplementationType.cc \
    2222       SymTab/TypeEquality.cc \
    23        SymTab/Autogen.cc
     23       SymTab/Autogen.cc \
     24       SymTab/TreeStruct.cc
  • src/SynTree/Constant.cc

    re60e0dc r5bd0aad  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:11:00 2017
    13 // Update Count     : 28
     12// Last Modified On : Fri Jul 14 14:50:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    4646}
    4747
     48Constant Constant::null( Type * ptrtype ) {
     49        if ( nullptr == ptrtype ) {
     50                ptrtype = new PointerType(
     51                        Type::Qualifiers(),
     52                        new VoidType( Type::Qualifiers() )
     53                        );
     54        }
     55
     56        return Constant( ptrtype, "0", (unsigned long long int)0 );
     57}
     58
    4859unsigned long long Constant::get_ival() const {
    4960        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
  • src/SynTree/Constant.h

    re60e0dc r5bd0aad  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:13:00 2017
    13 // Update Count     : 15
     12// Last Modified On : Fri Jul 14 13:33:00 2017
     13// Update Count     : 16
    1414//
    1515
     
    4444        static Constant from_double( double d );
    4545
     46        /// generates a null pointer value for the given type. void * if omitted.
     47        static Constant null( Type * ptrtype = nullptr );
     48
    4649        virtual void accept( Visitor & v ) { v.visit( this ); }
    4750        virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); }
  • src/SynTree/Declaration.h

    re60e0dc r5bd0aad  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jun 27 15:31:00 2017
    13 // Update Count     : 122
     12// Last Modified On : Fri Jul 14 16:59:00 2017
     13// Update Count     : 123
    1414//
    1515
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}
     268        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {}
     269        StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {}
    269270        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270271
     
    273274        bool is_thread() { return kind == DeclarationNode::Thread; }
    274275
     276        // Tagged/Tree Structure Excetion
     277        bool get_tagged() { return tagged; }
     278        void set_tagged( bool newValue ) { tagged = newValue; }
     279        bool has_parent() { return parent_name != ""; }
     280        std::string get_parentName() { return parent_name; }
     281
    275282        virtual StructDecl *clone() const { return new StructDecl( *this ); }
    276283        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    279286        DeclarationNode::Aggregate kind;
    280287        virtual std::string typeString() const;
     288
     289        bool tagged;
     290        std::string parent_name;
    281291};
    282292
  • src/libcfa/Makefile.am

    re60e0dc r5bd0aad  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jun 28 15:36:00 2017
    14 ## Update Count     : 215
     13## Last Modified On : Fri Jun 14 17:00:00 2017
     14## Update Count     : 216
    1515###############################################################################
    1616
     
    5151
    5252libobjs = ${headers:=.o}
    53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} exception.c
     53libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     54        exception.c typeobject.c
    5455
    5556# not all platforms support concurrency, add option do disable it
     
    6869        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6970
     71libcfa_a-typeobject.o : typeobject.c
     72        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     73
    7074concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    7175        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    7276
    7377libcfa_d_a-exception.o : exception.c
     78        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     79
     80libcfa_d_a-typeobject.o : typeobject.c
    7481        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    7582
  • src/libcfa/Makefile.in

    re60e0dc r5bd0aad  
    154154        concurrency/coroutine.c concurrency/thread.c \
    155155        concurrency/kernel.c concurrency/monitor.c exception.c \
    156         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \
    157         concurrency/invoke.c concurrency/preemption.c
     156        typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     157        concurrency/alarm.c concurrency/invoke.c \
     158        concurrency/preemption.c
    158159am__dirstamp = $(am__leading_dot)dirstamp
    159160@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    177178        libcfa_d_a-interpose.$(OBJEXT) \
    178179        libhdr/libcfa_d_a-libdebug.$(OBJEXT) $(am__objects_2) \
    179         libcfa_d_a-exception.$(OBJEXT) $(am__objects_3)
     180        libcfa_d_a-exception.$(OBJEXT) libcfa_d_a-typeobject.$(OBJEXT) \
     181        $(am__objects_3)
    180182am_libcfa_d_a_OBJECTS = $(am__objects_4)
    181183libcfa_d_a_OBJECTS = $(am_libcfa_d_a_OBJECTS)
     
    188190        concurrency/coroutine.c concurrency/thread.c \
    189191        concurrency/kernel.c concurrency/monitor.c exception.c \
    190         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \
    191         concurrency/invoke.c concurrency/preemption.c
     192        typeobject.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     193        concurrency/alarm.c concurrency/invoke.c \
     194        concurrency/preemption.c
    192195@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    193196@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    209212        libcfa_a-interpose.$(OBJEXT) \
    210213        libhdr/libcfa_a-libdebug.$(OBJEXT) $(am__objects_6) \
    211         libcfa_a-exception.$(OBJEXT) $(am__objects_7)
     214        libcfa_a-exception.$(OBJEXT) libcfa_a-typeobject.$(OBJEXT) \
     215        $(am__objects_7)
    212216am_libcfa_a_OBJECTS = $(am__objects_8)
    213217libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     
    417421libobjs = ${headers:=.o}
    418422libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
    419         exception.c $(am__append_4)
     423        exception.c typeobject.c $(am__append_4)
    420424libcfa_a_SOURCES = ${libsrc}
    421425libcfa_a_CFLAGS = -nodebug -O2
     
    593597@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@
    594598@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-stdlib.Po@am__quote@
     599@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-typeobject.Po@am__quote@
    595600@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@
    596601@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@
     
    604609@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@
    605610@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
     611@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-typeobject.Po@am__quote@
    606612@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@
    607613@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@
     
    928934@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
    929935
     936libcfa_d_a-typeobject.obj: typeobject.c
     937@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-typeobject.Tpo -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     938@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-typeobject.Tpo $(DEPDIR)/libcfa_d_a-typeobject.Po
     939@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_d_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@
     940@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     941@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     942
    930943concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c
    931944@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-alarm.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-alarm.Tpo -c -o concurrency/libcfa_d_a-alarm.o `test -f 'concurrency/alarm.c' || echo '$(srcdir)/'`concurrency/alarm.c
     
    12281241@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    12291242@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-exception.obj `if test -f 'exception.c'; then $(CYGPATH_W) 'exception.c'; else $(CYGPATH_W) '$(srcdir)/exception.c'; fi`
     1243
     1244libcfa_a-typeobject.obj: typeobject.c
     1245@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-typeobject.obj -MD -MP -MF $(DEPDIR)/libcfa_a-typeobject.Tpo -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
     1246@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-typeobject.Tpo $(DEPDIR)/libcfa_a-typeobject.Po
     1247@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='typeobject.c' object='libcfa_a-typeobject.obj' libtool=no @AMDEPBACKSLASH@
     1248@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1249@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-typeobject.obj `if test -f 'typeobject.c'; then $(CYGPATH_W) 'typeobject.c'; else $(CYGPATH_W) '$(srcdir)/typeobject.c'; fi`
    12301250
    12311251concurrency/libcfa_a-alarm.o: concurrency/alarm.c
     
    15211541        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    15221542
     1543libcfa_a-typeobject.o : typeobject.c
     1544        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     1545
    15231546concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
    15241547        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    15251548
    15261549libcfa_d_a-exception.o : exception.c
     1550        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     1551
     1552libcfa_d_a-typeobject.o : typeobject.c
    15271553        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    15281554
  • src/libcfa/iostream.c

    re60e0dc r5bd0aad  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  6 18:14:17 2017
    13 // Update Count     : 396
     12// Last Modified On : Sun Jul 16 21:12:03 2017
     13// Update Count     : 398
    1414//
    1515
     
    125125forall( dtype ostype | ostream( ostype ) )
    126126ostype * ?|?( ostype * os, float _Complex fc ) {
    127         os | crealf( fc );
    128         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    129         if ( cimagf( fc ) >= 0 ) os | '+';                                      // negative value prints '-'
    130         os | cimagf( fc ) | 'i';
    131         sepReset( os, temp );                                                           // reset separator
     127        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     128        fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) );
    132129        return os;
    133130} // ?|?
     
    135132forall( dtype ostype | ostream( ostype ) )
    136133ostype * ?|?( ostype * os, double _Complex dc ) {
    137         os | creal( dc );
    138         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    139         if ( cimag( dc ) >= 0 ) os | '+';                                       // negative value prints '-'
    140         os | cimag( dc ) | 'i';
    141         sepReset( os, temp );                                                           // reset separator
     134        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     135        fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) );
    142136        return os;
    143137} // ?|?
     
    145139forall( dtype ostype | ostream( ostype ) )
    146140ostype * ?|?( ostype * os, long double _Complex ldc ) {
    147         os | creall( ldc );
    148         _Bool temp = sepDisable( os );                                          // disable separators within complex value
    149         if ( cimagl( ldc ) >= 0 ) os | '+';                                     // negative value prints '-'
    150         os | cimagl( ldc ) | 'i';
    151         sepReset( os, temp );                                                           // reset separator
     141        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     142        fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    152143        return os;
    153144} // ?|?
  • src/tests/gmp.c

    re60e0dc r5bd0aad  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 24 22:05:38 2017
    13 // Update Count     : 540
     12// Last Modified On : Thu Jul 13 16:35:01 2017
     13// Update Count     : 541
    1414//
    1515
     
    9595// Local Variables: //
    9696// tab-width: 4 //
    97 // compile-command: "cfa gmp.c -l gmp" //
     97// compile-command: "cfa gmp.c -lgmp" //
    9898// End: //
Note: See TracChangeset for help on using the changeset viewer.