Changeset 5bd0aad
- Timestamp:
- Jul 17, 2017, 3:54:08 PM (7 years ago)
- 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. - Files:
-
- 4 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/LaTeXmacros/common.tex
re60e0dc r5bd0aad 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Jul 13 11:44:59201714 %% Update Count : 3 3513 %% Last Modified On : Mon Jul 17 10:21:17 2017 14 %% Update Count : 348 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 134 134 135 135 % 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$}} 137 137 % code index (cannot use ©) 138 \newcommand{\indexc}[ 1]{\index{#1@\lstinline$#1$}}138 \newcommand{\indexc}[2][\@empty]{\index{#2@\lstinline[#1]$#2$}} 139 139 140 140 % 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.5 b1 #FIG 3.2 Produced by xfig version 3.2.5c 2 2 Landscape 3 3 Center … … 19 19 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 20 20 1 1 1.00 60.00 90.00 21 1950 1425 3000120021 1950 1425 2925 1200 22 22 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 23 23 1 1 1.00 60.00 90.00 … … 29 29 1 1 1.00 60.00 90.00 30 30 4950 1950 4950 1725 31 4 1 0 100 0 0 12 0.0000 0 135 195 1950 1650 IO\00132 4 1 0 100 0 0 12 0.0000 0 135 8704950 1650 Arithmetic\00133 4 1 0 100 0 0 12 0.0000 0 135 3151350 2100 File\00134 4 1 0 100 0 0 12 0.0000 0 135 6902550 2100 Network\00135 4 1 0 100 0 0 12 0.0000 0 180 11703750 2100 DivideByZero\00136 4 1 0 100 0 0 12 0.0000 0 135 750 4950 2100 Overflow\00137 4 1 0 100 0 0 12 0.0000 0 135 855 6000 2100 Underflow\00138 4 1 0 100 0 0 12 0.0000 0 180 8403450 1200 Exception\00131 4 1 0 50 -1 0 13 0.0000 2 135 225 1950 1650 IO\001 32 4 1 0 50 -1 0 13 0.0000 2 135 915 4950 1650 Arithmetic\001 33 4 1 0 50 -1 0 13 0.0000 2 150 330 1350 2100 File\001 34 4 1 0 50 -1 0 13 0.0000 2 135 735 2550 2100 Network\001 35 4 1 0 50 -1 0 13 0.0000 2 180 1215 3750 2100 DivideByZero\001 36 4 1 0 50 -1 0 13 0.0000 2 150 810 4950 2100 Overflow\001 37 4 1 0 50 -1 0 13 0.0000 2 150 915 6000 2100 Underflow\001 38 4 1 0 50 -1 0 13 0.0000 2 180 855 3450 1200 Exception\001 -
doc/user/user.tex
re60e0dc r5bd0aad 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Jul 13 11:44:57201714 %% Update Count : 2 69013 %% Last Modified On : Mon Jul 17 13:06:40 2017 14 %% Update Count : 2825 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 353 353 The 1999 C standard plus GNU extensions. 354 354 \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$}} 357 356 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files. 358 }%359 357 \end{description} 360 358 The following new \CFA options are available: … … 479 477 \end{cfa} 480 478 Existing 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©: 482 480 483 481 \begin{figure} … … 487 485 #define otype ®`®otype®`® §\C{// make keyword an identifier}§ 488 486 #define __CFA_BFD_H__ 489 #endif // ! otype490 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 ® 493 491 #if defined( otype ) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§ 494 492 #undef otype 495 493 #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} 500 498 \end{figure} 499 500 501 \section{Exponentiation Operator} 502 503 C, \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$. 505 The 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 507 As for \Index{division}, there are exponentiation operators for integral and floating-point types, including the builtin \Index{complex} types. 508 Unsigned integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication (or shifting if the base is 2). 509 Signed 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$. 510 Hence, 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. 511 Floating-point exponentiation\index{exponentiation!floating point} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative. 512 \begin{cfa} 513 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl; 514 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 515 \end{cfa} 516 Parenthesis are necessary for the complex constants or the expresion is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©. 517 The 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©. 501 518 502 519 … … 922 939 int i, j; 923 940 int mem() { ®// implicit "this" parameter 924 i = 1; ®// this->i941 ® i = 1; ®// this->i 925 942 ® j = 3; ®// this->j 926 943 ® } … … 929 946 Since CFA is non-object-oriented, the equivalent object-oriented program looks like: 930 947 \begin{cfa} 931 struct C { 932 int i, j; 933 }; 934 int mem( C &this ) { // explicit "this" parameter 948 struct S { int i, j; }; 949 int mem( S &this ) { // explicit "this" parameter 935 950 ®this.®i = 1; // "this" is not elided 936 951 ®this.®j = 2; … … 938 953 \end{cfa} 939 954 but 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{ 957 The ©with© statement comes from Pascal~\cite[\S~4.F]{Pascal}.} 958 \begin{cfa} 959 int mem( S &this ) ®with this® { 943 960 i = 1; ®// this.i 944 961 ® j = 2; ®// this.j … … 947 964 which extends to multiple routine parameters: 948 965 \begin{cfa} 949 struct D { 950 double m, n; 951 }; 952 int mem2( C &this1, D &this2 ) ®with this1, this2® { 966 struct T { double m, n; }; 967 int mem2( S &this1, T &this2 ) ®with this1, this2® { 953 968 i = 1; j = 2; 954 969 m = 1.0; n = 2.0; 955 970 } 956 971 \end{cfa} 957 The ©with© clause/statement comes from Pascal~\cite[\S~4.F]{Pascal}.958 972 959 973 The statement form is used within a block: … … 965 979 // access fields of s1 without qualification 966 980 ®with s2® { // nesting 967 // access fields of s 2 without qualification981 // access fields of s1 and s2 without qualification 968 982 } 969 983 } … … 974 988 \end{cfa} 975 989 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; 990 When opening multiple structures, fields with the same name and type are ambiguous and must be fully qualified. 991 For fields with the same name but different type, context/cast can be used to disambiguate. 992 \begin{cfa} 993 struct S { int i; int j; double m; } a, c; 994 struct T { int i; int k; int m } b, c; 980 995 ®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}§ 988 1005 \end{cfa} 989 1006 990 1007 991 1008 \section{Exception Handling} 1009 \label{s:ExceptionHandling} 992 1010 993 1011 Exception 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 1012 Transfer of control can be local, within a routine, or non-local, among routines. 1013 Non-local transfer can cause stack unwinding, i.e., non-local routine termination, depending on the kind of raise. 1014 \begin{cfa} 1015 exception_t E {}; §\C{// exception type}§ 998 1016 void 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 } 1003 1020 try { 1004 1021 f(...); 1005 } catch h( int w ) {1006 // re set1007 } resume h( int p, double x ) {1008 return 17; // recover1022 } 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 1009 1026 } 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} 1030 The kind of raise and handler match: ©throw© with ©catch© and @throwResume@ with @catchResume@. 1031 Then the exception type must match along with any additonal predicate must be true. 1032 The ©catch© and ©catchResume© handlers may appear in any oder. 1033 However, the ©finally© clause must 1014 1034 1015 1035 … … 1571 1591 1572 1592 \item 1573 lvalue to reference conversion: \lstinline[deletekeywords= {lvalue}]@lvalue-type cv1 T@converts to ©cv2 T &©, which allows implicitly converting variables to references.1593 lvalue to reference conversion: \lstinline[deletekeywords=lvalue]$lvalue-type cv1 T$ converts to ©cv2 T &©, which allows implicitly converting variables to references. 1574 1594 \begin{cfa} 1575 1595 int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &) … … 2680 2700 \begin{cfa}[belowskip=0pt] 2681 2701 char store[®sepSize®]; §\C{// sepSize is the maximum separator size}§ 2682 strcpy( store, sepGet( sout ) ); 2683 sepSet( sout, "_" ); 2702 strcpy( store, sepGet( sout ) ); §\C{// copy current separator}§ 2703 sepSet( sout, "_" ); §\C{// change separator to underscore}§ 2684 2704 sout | 1 | 2 | 3 | endl; 2685 2705 \end{cfa} … … 2688 2708 \end{cfa} 2689 2709 \begin{cfa}[belowskip=0pt] 2690 sepSet( sout, store ); 2710 sepSet( sout, store ); §\C{// change separator back to original}§ 2691 2711 sout | 1 | 2 | 3 | endl; 2692 2712 \end{cfa} … … 5563 5583 \Celeven prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list: 5564 5584 \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} \\ 5568 5587 \hline 5569 5588 \begin{tabular}{@{}l@{}} … … 5573 5592 \Indexc{errno.h} \\ 5574 5593 \Indexc{fenv.h} \\ 5575 \Indexc{float.h} \\ 5576 \Indexc{inttypes.h} \\ 5577 \Indexc{iso646.h} \\ 5594 \Indexc[deletekeywords=float]{float.h} \\ 5578 5595 \end{tabular} 5579 5596 & 5580 5597 \begin{tabular}{@{}l@{}} 5598 \Indexc{inttypes.h} \\ 5599 \Indexc{iso646.h} \\ 5581 5600 \Indexc{limits.h} \\ 5582 5601 \Indexc{locale.h} \\ 5583 5602 \Indexc{math.h} \\ 5584 5603 \Indexc{setjmp.h} \\ 5604 \end{tabular} 5605 & 5606 \begin{tabular}{@{}l@{}} 5585 5607 \Indexc{signal.h} \\ 5586 5608 \Indexc{stdalign.h} \\ 5587 5609 \Indexc{stdarg.h} \\ 5588 5610 \Indexc{stdatomic.h} \\ 5611 \Indexc{stdbool.h} \\ 5612 \Indexc{stddef.h} \\ 5589 5613 \end{tabular} 5590 5614 & 5591 5615 \begin{tabular}{@{}l@{}} 5592 \Indexc{stdbool.h} \\5593 \Indexc{stddef.h} \\5594 5616 \Indexc{stdint.h} \\ 5595 5617 \Indexc{stdio.h} \\ … … 5607 5629 \Indexc{wctype.h} \\ 5608 5630 \\ 5609 \\5610 \\5611 5631 \end{tabular} 5612 5632 & … … 5614 5634 \Indexc{unistd.h} \\ 5615 5635 \Indexc{gmp.h} \\ 5616 \\5617 \\5618 5636 \\ 5619 5637 \\ … … 5655 5673 The table shows allocation routines supporting different combinations of storage-management capabilities: 5656 5674 \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 \\ 5659 5677 \hline 5660 5678 C & ©malloc© & no & no & no & no \\ … … 5663 5681 & ©memalign© & no & no & yes & no \\ 5664 5682 & ©posix_memalign© & no & no & yes & no \\ 5683 \hline 5665 5684 C11 & ©aligned_alloc© & no & no & yes & no \\ 5685 \hline 5666 5686 \CFA & ©alloc© & no/copy/yes & no/yes & no & yes \\ 5667 5687 & ©align_alloc© & no/yes & no & yes & yes \\ -
src/CodeGen/OperatorTable.cc
re60e0dc r5bd0aad 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 14:33:05 201613 // Update Count : 1 012 // Last Modified On : Sat Jul 15 17:12:22 2017 13 // Update Count : 15 14 14 // 15 15 … … 35 35 { "++?", "++", "_operator_preincr", OT_PREFIXASSIGN }, 36 36 { "--?", "--", "_operator_predecr", OT_PREFIXASSIGN }, 37 { "?\\?", "\\", "_operator_exponential", OT_INFIX }, 37 38 { "?*?", "*", "_operator_multiply", OT_INFIX }, 38 39 { "?/?", "/", "_operator_divide", OT_INFIX }, … … 52 53 { "?|?", "|", "_operator_bitor", OT_INFIX }, 53 54 { "?=?", "=", "_operator_assign", OT_INFIXASSIGN }, 55 { "?\\=?", "\\=", "_operator_expassign", OT_INFIXASSIGN }, 54 56 { "?*=?", "*=", "_operator_multassign", OT_INFIXASSIGN }, 55 57 { "?/=?", "/=", "_operator_divassign", OT_INFIXASSIGN }, -
src/Makefile.in
re60e0dc r5bd0aad 216 216 SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \ 217 217 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \ 218 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \ 218 219 SynTree/driver_cfa_cpp-Type.$(OBJEXT) \ 219 220 SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \ … … 514 515 SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \ 515 516 SymTab/FixFunction.cc SymTab/ImplementationType.cc \ 516 SymTab/TypeEquality.cc SymTab/Autogen.cc Sy nTree/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 \ 518 519 SynTree/PointerType.cc SynTree/ArrayType.cc \ 519 520 SynTree/FunctionType.cc SynTree/ReferenceToType.cc \ … … 848 849 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \ 849 850 SymTab/$(DEPDIR)/$(am__dirstamp) 851 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \ 852 SymTab/$(DEPDIR)/$(am__dirstamp) 850 853 SynTree/$(am__dirstamp): 851 854 @$(MKDIR_P) SynTree … … 1033 1036 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@ 1034 1037 @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@ 1035 1039 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@ 1036 1040 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@ … … 2084 2088 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2085 2089 @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 2091 SymTab/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 2098 SymTab/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` 2086 2104 2087 2105 SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc -
src/Parser/DeclarationNode.cc
re60e0dc r5bd0aad 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 201713 // Update Count : 10 1912 // Last Modified On : Fri Jul 14 16:55:00 2017 13 // Update Count : 1020 14 14 // 15 15 … … 253 253 newnode->type->aggregate.fields = fields; 254 254 newnode->type->aggregate.body = body; 255 newnode->type->aggregate.tagged = false; 256 newnode->type->aggregate.parent = nullptr; 255 257 return newnode; 256 258 } // DeclarationNode::newAggregate … … 273 275 return newnode; 274 276 } // DeclarationNode::newEnumConstant 277 278 DeclarationNode * 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 275 291 276 292 DeclarationNode * DeclarationNode::newName( string * name ) { -
src/Parser/ExpressionNode.cc
re60e0dc r5bd0aad 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:15201713 // Update Count : 54 212 // Last Modified On : Sat Jul 15 16:09:04 2017 13 // Update Count : 549 14 14 // 15 15 … … 231 231 } 232 232 233 // Must harmonize with OperKinds. 233 234 static const char *OperName[] = { 234 235 // diadic 235 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "? *?", "?/?", "?%?", "||", "&&",236 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&", 236 237 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?", 237 "?=?", "?@=?", "? *=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",238 "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", 238 239 "?[?]", "...", 239 240 // monadic -
src/Parser/ParseNode.h
re60e0dc r5bd0aad 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 13:00:00201713 // Update Count : 7 7911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 15 16:00:48 2017 13 // Update Count : 785 14 14 // 15 15 … … 141 141 }; 142 142 143 // Must harmonize with OperName. 143 144 enum class OperKinds { 144 145 // diadic 145 SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,146 SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And, 146 147 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, 148 149 Index, Range, 149 150 // monadic … … 248 249 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 250 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 250 254 DeclarationNode(); 251 255 ~DeclarationNode(); … … 332 336 333 337 static UniqueName anonymous; 338 339 // Temp to test TreeStruct 340 const std::string * parent_name; 334 341 }; // DeclarationNode 335 342 -
src/Parser/TypeData.cc
re60e0dc r5bd0aad 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 201713 // Update Count : 56 412 // Last Modified On : Fri Jul 14 16:58:00 2017 13 // Update Count : 565 14 14 // 15 15 … … 63 63 aggregate.fields = nullptr; 64 64 aggregate.body = false; 65 aggregate.tagged = false; 66 aggregate.parent = nullptr; 65 67 break; 66 68 case AggregateInst: … … 121 123 delete aggregate.actuals; 122 124 delete aggregate.fields; 125 delete aggregate.parent; 123 126 // delete aggregate; 124 127 break; … … 192 195 newtype->aggregate.kind = aggregate.kind; 193 196 newtype->aggregate.body = aggregate.body; 197 newtype->aggregate.tagged = aggregate.tagged; 198 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; 194 199 break; 195 200 case AggregateInst: … … 619 624 switch ( td->aggregate.kind ) { 620 625 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 } 621 631 case DeclarationNode::Coroutine: 622 632 case DeclarationNode::Monitor: -
src/Parser/TypeData.h
re60e0dc r5bd0aad 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 201713 // Update Count : 18 612 // Last Modified On : Fri Jul 14 16:57:00 2017 13 // Update Count : 187 14 14 // 15 15 … … 31 31 DeclarationNode * fields; 32 32 bool body; 33 34 bool tagged; 35 const std::string * parent; 33 36 }; 34 37 -
src/Parser/lex.ll
re60e0dc r5bd0aad 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Jul 12 18:04:44 201713 * Update Count : 5 3512 * Last Modified On : Sat Jul 15 15:46:34 2017 13 * Update Count : 542 14 14 */ 15 15 … … 125 125 op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post} 126 126 127 op_binary_only "/"|"%"|" ^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="127 op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>=" 128 128 op_binary_over {op_unary_binary}|{op_binary_only} 129 129 // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@=" … … 136 136 137 137 %% 138 138 /* line directives */ 139 139 ^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" { 140 140 /* " stop highlighting */ … … 337 337 "-" { ASCIIOP_RETURN(); } 338 338 "*" { ASCIIOP_RETURN(); } 339 "\\" { ASCIIOP_RETURN(); } // CFA, exponentiation 339 340 "/" { ASCIIOP_RETURN(); } 340 341 "%" { ASCIIOP_RETURN(); } … … 361 362 "+=" { NAMEDOP_RETURN(PLUSassign); } 362 363 "-=" { NAMEDOP_RETURN(MINUSassign); } 364 "\\=" { NAMEDOP_RETURN(EXPassign); } // CFA, exponentiation 363 365 "*=" { NAMEDOP_RETURN(MULTassign); } 364 366 "/=" { NAMEDOP_RETURN(DIVassign); } -
src/Parser/parser.yy
re60e0dc r5bd0aad 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jul 13 14:38:54201713 // Update Count : 24 3111 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 17 12:17:00 2017 13 // Update Count : 2455 14 14 // 15 15 … … 151 151 %token ELLIPSIS // ... 152 152 153 %token MULTassign DIVassign MODassign // *= /= %=/153 %token EXPassign MULTassign DIVassign MODassign // \= *= /= %= 154 154 %token PLUSassign MINUSassign // += -= 155 155 %token LSassign RSassign // <<= >>= … … 168 168 %type<op> ptrref_operator unary_operator assignment_operator 169 169 %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 174 175 %type<en> comma_expression comma_expression_opt 175 %type<en> argument_expression_list argument_expression assignment_opt176 %type<en> argument_expression_list argument_expression default_initialize_opt 176 177 %type<fctl> for_control_expression 177 178 %type<en> subrange … … 573 574 ; 574 575 576 exponential_expression: 577 cast_expression 578 | exponential_expression '\\' cast_expression 579 { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); } 580 ; 581 575 582 multiplicative_expression: 576 cast_expression577 | multiplicative_expression '*' cast_expression583 exponential_expression 584 | multiplicative_expression '*' exponential_expression 578 585 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); } 579 | multiplicative_expression '/' cast_expression586 | multiplicative_expression '/' exponential_expression 580 587 { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); } 581 | multiplicative_expression '%' cast_expression588 | multiplicative_expression '%' exponential_expression 582 589 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); } 583 590 ; … … 678 685 '=' { $$ = OperKinds::Assign; } 679 686 | ATassign { $$ = OperKinds::AtAssn; } 687 | EXPassign { $$ = OperKinds::ExpAssn; } 680 688 | MULTassign { $$ = OperKinds::MulAssn; } 681 689 | DIVassign { $$ = OperKinds::DivAssn; } … … 972 980 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 973 981 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 988 handler_predicate_opt: 989 //empty 990 | ';' conditional_expression 978 991 ; 979 992 … … 1667 1680 | aggregate_key attribute_list_opt typegen_name // CFA 1668 1681 { $$ = $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 } 1669 1706 ; 1670 1707 … … 1845 1882 cfa_parameter_declaration: // CFA, new & old style parameter declaration 1846 1883 parameter_declaration 1847 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt1884 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt 1848 1885 { $$ = $1->addName( $2 ); } 1849 | cfa_abstract_tuple identifier_or_type_name assignment_opt1886 | cfa_abstract_tuple identifier_or_type_name default_initialize_opt 1850 1887 // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator). 1851 1888 { $$ = $1->addName( $2 ); } 1852 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt1889 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt 1853 1890 { $$ = $2->addName( $3 )->addQualifiers( $1 ); } 1854 1891 | cfa_function_specifier … … 1867 1904 parameter_declaration: 1868 1905 // No SUE declaration in parameter list. 1869 declaration_specifier_nobody identifier_parameter_declarator assignment_opt1906 declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt 1870 1907 { 1871 1908 typedefTable.addToEnclosingScope( TypedefTable::ID ); 1872 1909 $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); 1873 1910 } 1874 | declaration_specifier_nobody type_parameter_redeclarator assignment_opt1911 | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt 1875 1912 { 1876 1913 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 1880 1917 1881 1918 abstract_parameter_declaration: 1882 declaration_specifier_nobody assignment_opt1919 declaration_specifier_nobody default_initialize_opt 1883 1920 { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); } 1884 | declaration_specifier_nobody abstract_parameter_declarator assignment_opt1921 | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt 1885 1922 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 1886 1923 ; … … 3045 3082 ; 3046 3083 3047 assignment_opt:3084 default_initialize_opt: 3048 3085 // empty 3049 3086 { $$ = nullptr; } -
src/SymTab/Autogen.cc
re60e0dc r5bd0aad 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:30:00 201713 // Update Count : 6 112 // Last Modified On : Fri Jul 14 16:41:00 2017 13 // Update Count : 62 14 14 // 15 15 … … 401 401 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 402 402 // Builtins do not use autogeneration. 403 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||403 if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA || 404 404 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) { 405 405 return; -
src/SymTab/module.mk
re60e0dc r5bd0aad 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Rob Schluntz13 ## Last Modified On : Tue Jul 07 16:22:23 201514 ## Update Count : 212 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jul 12 13:06:00 2017 14 ## Update Count : 3 15 15 ############################################################################### 16 16 … … 21 21 SymTab/ImplementationType.cc \ 22 22 SymTab/TypeEquality.cc \ 23 SymTab/Autogen.cc 23 SymTab/Autogen.cc \ 24 SymTab/TreeStruct.cc -
src/SynTree/Constant.cc
re60e0dc r5bd0aad 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:11:00 201713 // Update Count : 2 812 // Last Modified On : Fri Jul 14 14:50:00 2017 13 // Update Count : 29 14 14 // 15 15 … … 46 46 } 47 47 48 Constant 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 48 59 unsigned long long Constant::get_ival() const { 49 60 assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); -
src/SynTree/Constant.h
re60e0dc r5bd0aad 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:13:00 201713 // Update Count : 1 512 // Last Modified On : Fri Jul 14 13:33:00 2017 13 // Update Count : 16 14 14 // 15 15 … … 44 44 static Constant from_double( double d ); 45 45 46 /// generates a null pointer value for the given type. void * if omitted. 47 static Constant null( Type * ptrtype = nullptr ); 48 46 49 virtual void accept( Visitor & v ) { v.visit( this ); } 47 50 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } -
src/SynTree/Declaration.h
re60e0dc r5bd0aad 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 201713 // Update Count : 12 212 // Last Modified On : Fri Jul 14 16:59:00 2017 13 // Update Count : 123 14 14 // 15 15 … … 266 266 typedef AggregateDecl Parent; 267 267 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 : "" ) {} 269 270 StructDecl( const StructDecl &other ) : Parent( other ) {} 270 271 … … 273 274 bool is_thread() { return kind == DeclarationNode::Thread; } 274 275 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 275 282 virtual StructDecl *clone() const { return new StructDecl( *this ); } 276 283 virtual void accept( Visitor &v ) { v.visit( this ); } … … 279 286 DeclarationNode::Aggregate kind; 280 287 virtual std::string typeString() const; 288 289 bool tagged; 290 std::string parent_name; 281 291 }; 282 292 -
src/libcfa/Makefile.am
re60e0dc r5bd0aad 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jun 28 15:36:00 201714 ## Update Count : 21 513 ## Last Modified On : Fri Jun 14 17:00:00 2017 14 ## Update Count : 216 15 15 ############################################################################### 16 16 … … 51 51 52 52 libobjs = ${headers:=.o} 53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} exception.c 53 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 54 exception.c typeobject.c 54 55 55 56 # not all platforms support concurrency, add option do disable it … … 68 69 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 69 70 71 libcfa_a-typeobject.o : typeobject.c 72 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 73 70 74 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 71 75 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 72 76 73 77 libcfa_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 80 libcfa_d_a-typeobject.o : typeobject.c 74 81 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 75 82 -
src/libcfa/Makefile.in
re60e0dc r5bd0aad 154 154 concurrency/coroutine.c concurrency/thread.c \ 155 155 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 158 159 am__dirstamp = $(am__leading_dot)dirstamp 159 160 @BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \ … … 177 178 libcfa_d_a-interpose.$(OBJEXT) \ 178 179 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) 180 182 am_libcfa_d_a_OBJECTS = $(am__objects_4) 181 183 libcfa_d_a_OBJECTS = $(am_libcfa_d_a_OBJECTS) … … 188 190 concurrency/coroutine.c concurrency/thread.c \ 189 191 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 192 195 @BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \ 193 196 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-thread.$(OBJEXT) \ … … 209 212 libcfa_a-interpose.$(OBJEXT) \ 210 213 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) 212 216 am_libcfa_a_OBJECTS = $(am__objects_8) 213 217 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS) … … 417 421 libobjs = ${headers:=.o} 418 422 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 419 exception.c $(am__append_4)423 exception.c typeobject.c $(am__append_4) 420 424 libcfa_a_SOURCES = ${libsrc} 421 425 libcfa_a_CFLAGS = -nodebug -O2 … … 593 597 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-rational.Po@am__quote@ 594 598 @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@ 595 600 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@ 596 601 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@ … … 604 609 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-rational.Po@am__quote@ 605 610 @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@ 606 612 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@ 607 613 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@ … … 928 934 @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` 929 935 936 libcfa_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 930 943 concurrency/libcfa_d_a-alarm.o: concurrency/alarm.c 931 944 @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 … … 1228 1241 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1229 1242 @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 1244 libcfa_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` 1230 1250 1231 1251 concurrency/libcfa_a-alarm.o: concurrency/alarm.c … … 1521 1541 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1522 1542 1543 libcfa_a-typeobject.o : typeobject.c 1544 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $< 1545 1523 1546 concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c 1524 1547 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1525 1548 1526 1549 libcfa_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 1552 libcfa_d_a-typeobject.o : typeobject.c 1527 1553 ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $< 1528 1554 -
src/libcfa/iostream.c
re60e0dc r5bd0aad 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 6 18:14:17201713 // Update Count : 39 612 // Last Modified On : Sun Jul 16 21:12:03 2017 13 // Update Count : 398 14 14 // 15 15 … … 125 125 forall( dtype ostype | ostream( ostype ) ) 126 126 ostype * ?|?( 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 ) ); 132 129 return os; 133 130 } // ?|? … … 135 132 forall( dtype ostype | ostream( ostype ) ) 136 133 ostype * ?|?( 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 ) ); 142 136 return os; 143 137 } // ?|? … … 145 139 forall( dtype ostype | ostream( ostype ) ) 146 140 ostype * ?|?( 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 ) ); 152 143 return os; 153 144 } // ?|? -
src/tests/gmp.c
re60e0dc r5bd0aad 10 10 // Created On : Tue Apr 19 08:55:51 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 24 22:05:38201713 // Update Count : 54 012 // Last Modified On : Thu Jul 13 16:35:01 2017 13 // Update Count : 541 14 14 // 15 15 … … 95 95 // Local Variables: // 96 96 // tab-width: 4 // 97 // compile-command: "cfa gmp.c -l 97 // compile-command: "cfa gmp.c -lgmp" // 98 98 // End: //
Note: See TracChangeset
for help on using the changeset viewer.