Changes in / [7e08acf:e15ba975]
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r7e08acf re15ba975 939 939 title = {\textsf{C}$\mathbf{\forall}$ : Adding Modern Programming Language Features to C}, 940 940 year = 2018, 941 month = aug, 941 942 journal = spe, 942 note = { Accepted, to appear},943 note = {http://dx.doi.org/10.1002/spe.2624}, 943 944 } 944 945 … … 962 963 comment = { 963 964 The evidence given is thin. 964 } 965 }, 965 966 } 966 967 … … 1827 1828 key = {Peter Buhr}, 1828 1829 title = {CS343}, 1829 year = 201 7,1830 year = 2018, 1830 1831 howpublished= {\href{https://www.student.cs.uwaterloo.ca/~cs343}{https://\-www.student.cs.uwaterloo.ca/\-~cs343}}, 1831 1832 } … … 3362 3363 author = {Peter Buhr and David Dice and Wim H. Hesselink}, 3363 3364 journal = ccpe, 3364 volume opt= 30,3365 number opt = 4,3365 volume = 30, 3366 number = 18, 3366 3367 year = 2018, 3367 month = may,3368 month = sep, 3368 3369 publisher = {John Wiley \& Sons}, 3369 3370 note = {\url{https://doi-org.proxy.lib.uwaterloo.ca/10.1002/cpe.4475}} … … 3849 3850 keywords = {concurrency, critical section}, 3850 3851 contributer = {pabuhr@plg}, 3851 author = {Dominic Duggan and G .V. Cormack and John Ophel},3852 author = {Dominic Duggan and Gordon V. Cormack and John Ophel}, 3852 3853 title = {Kinded Type Inference for Parametric Overloading}, 3853 3854 journal = acta, … … 5855 5856 keywords = {Cyclone, existential types, polymorphism, type variables}, 5856 5857 contributer = {a3moss@plg}, 5857 author = {D .Grossman},5858 author = {Dan Grossman}, 5858 5859 title = {Quantified Types in an Imperative Language}, 5859 5860 journal = toplas, -
doc/user/user.tex
r7e08acf re15ba975 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 26 17:29:05201814 %% Update Count : 33 6613 %% Last Modified On : Fri Aug 31 07:54:50 2018 14 %% Update Count : 3396 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 210 210 Even with all its problems, C continues to be popular because it allows writing software at virtually any level in a computer system without restriction. 211 211 For system programming, where direct access to hardware, storage management, and real-time issues are a requirement, C is usually the only language of choice. 212 The TIOBE index~\cite{TIOBE} for July 2018 ranks the top 5 most \emph{popular} programming languages as:\Index*{Java} 16\%, C 14\%, \Index*[C++]{\CC{}} 7.5\%, Python 6\%, Visual Basic 4\% = 47.5\%, where the next 50 languages are less than 4\% each, with a long tail.212 The TIOBE index~\cite{TIOBE} for July 2018 ranks the top five most \emph{popular} programming languages as \Index*{Java} 16\%, C 14\%, \Index*[C++]{\CC{}} 7.5\%, Python 6\%, Visual Basic 4\% = 47.5\%, where the next 50 languages are less than 4\% each, with a long tail. 213 213 The top 3 rankings over the past 30 years are: 214 214 \begin{center} … … 351 351 The 2011 C standard plus GNU extensions. 352 352 \item 353 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline] @-fgnu89-inline@}}353 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}} 354 354 Use the traditional GNU semantics for inline routines in C11 mode, which allows inline routines in header files. 355 355 \end{description} … … 455 455 #endif 456 456 457 ®#include_next <bfdlink.h> 457 ®#include_next <bfdlink.h> §\C{// must have internal check for multiple expansion}§ 458 458 ® 459 459 #if defined( with ) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§ … … 504 504 505 505 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. 506 \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$.506 \CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@©?\?©} and ©?\=?©\index{?\\=?@©\=?©}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$. 507 507 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)©. 508 508 … … 516 516 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 517 517 \end{cfa} 518 Parenthesis are necessary for the complex constants or the expression is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©.518 Parenthesis are necessary for complex constants or the expression is parsed as ©1.0f+®(®2.0fi \ 3.0f®)®+2.0fi©. 519 519 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation versions are available. 520 520 For returning an integral value, the user type ©T© must define multiplication, ©*©, and one, ©1©; … … 527 527 528 528 529 %\subsection{\texorpdfstring{\protect\lstinline@if@ Statement}{if Statement}} 530 \subsection{\texorpdfstring{\LstKeywordStyle{if} Statement}{if Statement}} 531 532 The ©if© expression allows declarations, similar to ©for© declaration expression: 533 \begin{cfa} 534 if ( int x = f() ) ... §\C{// x != 0}§ 535 if ( int x = f(), y = g() ) ... §\C{// x != 0 \&\& y != 0}§ 536 if ( int x = f(), y = g(); ®x < y® ) ... §\C{// relational expression}§ 537 \end{cfa} 538 Unless a relational expression is specified, each variable is compared not equal to 0, which is the standard semantics for the ©if© expression, and the results are combined using the logical ©&&© operator.\footnote{\CC only provides a single declaration always compared not equal to 0.} 529 %\subsection{\texorpdfstring{\protect\lstinline@if@/\protect\lstinline@while@ Statement}{if Statement}} 530 \subsection{\texorpdfstring{\LstKeywordStyle{if}/\LstKeywordStyle{while} Statement}{if/while Statement}} 531 532 The ©if©/©while© expression allows declarations, similar to ©for© declaration expression. 533 (Does not make sense for ©do©-©while©.) 534 \begin{cfa} 535 if ( ®int x = f()® ) ... §\C{// x != 0}§ 536 if ( ®int x = f(), y = g()® ) ... §\C{// x != 0 \&\& y != 0}§ 537 if ( ®int x = f(), y = g(); x < y® ) ... §\C{// relational expression}§ 538 if ( ®struct S { int i; } x = { f() }; x.i < 4® ) §\C{// relational expression}§ 539 540 while ( ®int x = f()® ) ... §\C{// x != 0}§ 541 while ( ®int x = f(), y = g()® ) ... §\C{// x != 0 \&\& y != 0}§ 542 while ( ®int x = f(), y = g(); x < y® ) ... §\C{// relational expression}§ 543 while ( ®struct S { int i; } x = { f() }; x.i < 4® ) ... §\C{// relational expression}§ 544 \end{cfa} 545 Unless a relational expression is specified, each variable is compared not equal to 0, which is the standard semantics for the ©if©/©while© expression, and the results are combined using the logical ©&&© operator.\footnote{\CC only provides a single declaration always compared not equal to 0.} 539 546 The scope of the declaration(s) is local to the @if@ statement but exist within both the ``then'' and ``else'' clauses. 547 548 549 %\subsection{\texorpdfstring{\protect\lstinline@for@ Statement}{for Statement}} 550 \subsection{\texorpdfstring{\LstKeywordStyle{for} Statement}{for Statement}} 551 552 The ©for©/©while©/©do-while© loop-control allows empty or simplified ranges. 553 An empty conditional implies ©1©. 554 The up-to range ©~©\index{~@©~©} means exclusive range [M,N); 555 the up-to range ©~=©\index{~=@©~=©} means inclusive range [M,N]. 556 The down-to range ©-~©\index{-~@©-~©} means exclusive range [N,M); 557 the down-to range ©-~=©\index{-~=@©-~=©} means inclusive range [N,M]. 558 ©0© is the implicit start value; 559 ©1© is the implicit increment value for an up-to range and ©-1© for an implicit down-to range. 560 The loop index is polymorphic in the type of the start value or comparison value when start is implicitly ©0©. 561 \begin{cquote} 562 \begin{tabular}{@{}ll|l@{}} 563 \multicolumn{2}{c|}{for control} & \multicolumn{1}{c}{output} \\ 564 \hline 565 \begin{cfa} 566 while ®()® { sout | "empty"; break; } 567 do { sout | "empty"; break; } while ®()®; 568 for ®()® { sout | "empty"; break; } 569 for ( ®0® ) { sout | "A"; } 570 for ( ®1® ) { sout | "A"; } 571 for ( ®10® ) { sout | "A"; } 572 for ( ®1 ~= 10 ~ 2® ) { sout | "B"; } 573 for ( ®10 -~= 1 ~ -2® ) { sout | "C"; } 574 for ( ®0.5 ~ 5.5® ) { sout | "D"; } 575 for ( ®5.5 -~ 0.5® ) { sout | "E"; } 576 for ( ®i; 10® ) { sout | i; } 577 for ( ®i; 1 ~= 10 ~ 2® ) { sout | i; } 578 for ( ®i; 10 -~= 1 ~ -2® ) { sout | i; } 579 for ( ®i; 0.5 ~ 5.5® ) { sout | i; } 580 for ( ®i; 5.5 -~ 0.5® ) { sout | i; } 581 for ( ®ui; 2u ~= 10u ~ 2u® ) { sout | ui; } 582 for ( ®ui; 10u -~= 2u ~ -2u® ) { sout | ui; } 583 int start = 3, comp = 10, inc = 2; 584 for ( ®i; start ~ comp ~ inc + 1® ) { sout | i; } 585 \end{cfa} 586 & 587 \begin{cfa} 588 sout | endl; 589 sout | endl; 590 sout | endl; 591 sout | endl; 592 sout | endl; 593 sout | endl; 594 sout | endl; 595 sout | endl; 596 sout | endl; 597 sout | endl; 598 sout | endl; 599 sout | endl; 600 sout | endl; 601 sout | endl; 602 sout | endl; 603 sout | endl; 604 sout | endl; 605 606 sout | endl; 607 \end{cfa} 608 & 609 \begin{cfa} 610 empty 611 empty 612 empty 613 614 A 615 A A A A A A A A A A 616 B B B B B 617 C C C C C 618 D D D D D 619 E E E E E 620 0 1 2 3 4 5 6 7 8 9 621 1 3 5 7 9 622 10 8 6 4 2 623 0.5 1.5 2.5 3.5 4.5 624 5.5 4.5 3.5 2.5 1.5 625 2 4 6 8 10 626 10 8 6 4 2 627 628 3 6 9 629 \end{cfa} 630 \end{tabular} 631 \end{cquote} 540 632 541 633 … … 800 892 801 893 894 % for () => for ( ;; ) 895 % for ( 10 - t ) => for ( typeof(10 - t) ? = 0 ; ? < 10 - t; ? += 1 ) // using 0 and 1 896 % for ( i ; 10 - t ) => for ( typeof(10 - t) i = 0 ; i < 10 - t; i += 1 ) // using 0 and 1 897 % for ( T i ; 10 - t ) => for ( T i = 0 ; i < 10 - t; i += 1 ) // using 0 and 1 898 % for ( 3~9 ) => for ( int ? = 3 ; ? < 9; ? += 1 ) // using 1 899 % for ( i ; 3~9 ) => for ( int i = 3 ; i < 9; i += 1 ) // using 1 900 % for ( T i ; 3~9 ) => for ( T i = 3 ; i < 9; i += 1 ) // using 1 901 902 802 903 %\subsection{\texorpdfstring{Labelled \protect\lstinline@continue@ / \protect\lstinline@break@}{Labelled continue / break}} 803 904 \subsection{\texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break} Statement}{Labelled continue / break Statement}} … … 805 906 While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure. 806 907 Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting. 807 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@ \lstinline@continue@!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline@break@!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}, as in Java.908 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@©continue©!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@©break©!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}, as in Java. 808 909 For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement; 809 910 for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement. … … 890 991 \end{figure} 891 992 892 Both labelled ©continue© and ©break© are a ©goto©\index{goto@ \lstinline@goto@!restricted} restricted in the following ways:993 Both labelled ©continue© and ©break© are a ©goto©\index{goto@©goto©!restricted} restricted in the following ways: 893 994 \begin{itemize} 894 995 \item -
driver/as.cc
r7e08acf re15ba975 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // as.c -- 7 // as.c -- map assembler file, scan for debug information. If found, expand file by one character and insert Cforall 8 // language code on the N line from the start of the debug information. 8 9 // 9 10 // Author : Peter A. Buhr 10 11 // Created On : Wed Aug 1 10:49:42 2018 11 12 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 22 17:30:24201813 // Update Count : 9 313 // Last Modified On : Sat Sep 8 08:40:16 2018 14 // Update Count : 97 14 15 // 15 16 … … 43 44 off_t size = mystat.st_size; 44 45 45 char * start = (char *)mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); 46 if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); }; 46 if ( size ) { // cannot map 0 sized file 47 char * start = (char *)mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 ); 48 if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); }; 47 49 48 if ( char * cursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ?49 // Expand file by one byte to hold 2 character Cforall language code.50 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };50 if ( char * cursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ? 51 // Expand file by one byte to hold 2 character Cforall language code. 52 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); }; 51 53 52 for ( int i = 0; i < 8; i += 1 ) {// move N (magic) lines forward53 cursor = strstr( cursor, "\n" ) + 1;54 } // for54 for ( int i = 0; i < 8; i += 1 ) { // move N (magic) lines forward 55 cursor = strstr( cursor, "\n" ) + 1; 56 } // for 55 57 56 cursor -= 2;// backup over "c\n" language value57 if ( *(cursor - 1) != 'x' ) { fprintf( stderr, "invalid C language code\n" ); exit( EXIT_FAILURE ); };58 cursor -= 2; // backup over "c\n" language value 59 if ( *(cursor - 1) != 'x' ) { fprintf( stderr, "invalid C language code\n" ); exit( EXIT_FAILURE ); }; 58 60 59 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right61 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right 60 62 61 *(cursor) = '2'; // replace C language value with CFA 62 *(cursor + 1) = '5'; 63 *(cursor) = '2'; // replace C language value with CFA 64 *(cursor + 1) = '5'; 65 } // if 66 67 if ( munmap( start, size ) ) { perror( "munmap" ); exit( EXIT_FAILURE ); }; // update on disk 63 68 } // if 64 65 if ( munmap( start, size ) ) { perror( "munmap" ); exit( EXIT_FAILURE ); }; // update on disk66 69 67 70 argv[0] = "as"; -
driver/cc1.cc
r7e08acf re15ba975 10 10 // Created On : Fri Aug 26 14:23:51 2005 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 23 09:48:40201813 // Update Count : 12 212 // Last Modified On : Mon Sep 3 16:57:05 2018 13 // Update Count : 125 14 14 // 15 15 … … 32 32 string compiler_name( CFA_BACKEND_CC ); // path/name of C compiler 33 33 34 string D__GCC_X__( "-D__GCC_X__=" );35 34 string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" ); 36 35 string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" ); … … 46 45 enum { NumSuffixes = 2 }; 47 46 const string suffixes[NumSuffixes] = { "cfa", "hfa", }; 48 49 47 50 48 void suffix( string arg, const char * args[], int & nargs ) { … … 116 114 void Stage1( const int argc, const char * const argv[] ) { 117 115 int code; 118 int i;119 116 120 117 string arg; … … 139 136 cerr << "Stage1" << endl; 140 137 #endif // __DEBUG_H__ 138 checkEnv( args, nargs ); // arguments passed via environment variables 139 #ifdef __DEBUG_H__ 140 for ( int i = 1; i < argc; i += 1 ) { 141 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 142 } // for 143 #endif // __DEBUG_H__ 141 144 142 145 // process all the arguments 143 146 144 checkEnv( args, nargs ); // arguments passed via environment variables 145 146 for ( i = 1; i < argc; i += 1 ) { 147 #ifdef __DEBUG_H__ 148 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 149 #endif // __DEBUG_H__ 147 for ( int i = 1; i < argc; i += 1 ) { 150 148 arg = argv[i]; 151 #ifdef __DEBUG_H__152 cerr << "arg:\"" << arg << "\"" << endl;153 #endif // __DEBUG_H__154 149 if ( prefix( arg, "-" ) ) { 155 150 // strip g++ flags that are inappropriate or cause duplicates in subsequent passes … … 185 180 ncargs += 1; 186 181 i += 1; // and the argument 187 // } else if ( prefix( arg, D__GCC_X__ ) ) {188 // args[nargs] = "-x";189 // nargs += 1;190 // args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along191 // nargs += 1;192 // } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {193 // args[nargs] = "-x";194 // nargs += 1;195 // args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along196 // nargs += 1;197 // i += 1; // and the argument198 182 } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) { 199 183 bprefix = arg.substr( D__GCC_BPREFIX__.size() ); … … 251 235 #ifdef __DEBUG_H__ 252 236 cerr << "args:"; 253 for ( i = 1; i < nargs; i += 1 ) {237 for ( int i = 1; i < nargs; i += 1 ) { 254 238 cerr << " " << args[i]; 255 239 } // for … … 282 266 #ifdef __DEBUG_H__ 283 267 cerr << "nargs: " << nargs << endl; 284 for ( i = 0; args[i] != NULL; i += 1 ) {268 for ( int i = 0; args[i] != NULL; i += 1 ) { 285 269 cerr << args[i] << " "; 286 270 } // for … … 324 308 #ifdef __DEBUG_H__ 325 309 cerr << "cpp nargs: " << nargs << endl; 326 for ( i = 0; args[i] != NULL; i += 1 ) {310 for ( int i = 0; args[i] != NULL; i += 1 ) { 327 311 cerr << args[i] << " "; 328 312 } // for … … 377 361 #ifdef __DEBUG_H__ 378 362 cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl; 379 for ( i = 0; cargs[i] != NULL; i += 1 ) {363 for ( int i = 0; cargs[i] != NULL; i += 1 ) { 380 364 cerr << cargs[i] << " "; 381 365 } // for … … 407 391 408 392 void Stage2( const int argc, const char * const * argv ) { 409 int i;410 411 393 string arg; 412 394 … … 419 401 cerr << "Stage2" << endl; 420 402 #endif // __DEBUG_H__ 403 checkEnv( args, nargs ); // arguments passed via environment variables 404 #ifdef __DEBUG_H__ 405 for ( int i = 1; i < argc; i += 1 ) { 406 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 407 } // for 408 #endif // __DEBUG_H__ 421 409 422 410 // process all the arguments 423 411 424 checkEnv( args, nargs ); // arguments passed via environment variables 425 426 for ( i = 1; i < argc; i += 1 ) { 427 #ifdef __DEBUG_H__ 428 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 429 #endif // __DEBUG_H__ 412 for ( int i = 1; i < argc; i += 1 ) { 430 413 arg = argv[i]; 431 #ifdef __DEBUG_H__432 cerr << "arg:\"" << arg << "\"" << endl;433 #endif // __DEBUG_H__434 414 if ( prefix( arg, "-" ) ) { 435 415 // strip inappropriate flags … … 476 456 #ifdef __DEBUG_H__ 477 457 cerr << "args:"; 478 for ( i = 1; i < nargs; i += 1 ) {458 for ( int i = 1; i < nargs; i += 1 ) { 479 459 cerr << " " << args[i]; 480 460 } // for … … 492 472 #ifdef __DEBUG_H__ 493 473 cerr << "stage2 nargs: " << nargs << endl; 494 for ( i = 0; args[i] != NULL; i += 1 ) {474 for ( int i = 0; args[i] != NULL; i += 1 ) { 495 475 cerr << args[i] << " "; 496 476 } // for … … 506 486 int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) { 507 487 #ifdef __DEBUG_H__ 508 for ( int i = 0; env[i] != NULL; i += 1 ) {488 for ( int int i = 0; env[i] != NULL; i += 1 ) { 509 489 cerr << env[i] << endl; 510 490 } // for -
driver/cfa.cc
r7e08acf re15ba975 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 23 15:41:55201813 // Update Count : 27 012 // Last Modified On : Mon Sep 3 16:47:59 2018 13 // Update Count : 275 14 14 // 15 15 … … 43 43 const string suffixes[NumSuffixes] = { "cfa", "hfa", }; 44 44 45 voidsuffix( string arg, const char * args[], int & nargs ) {45 bool suffix( string arg, const char * args[], int & nargs ) { 46 46 //std::cerr << arg << std::endl; 47 47 size_t dot = arg.find_last_of( "." ); 48 48 //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl; 49 if ( dot == string::npos ) return ;49 if ( dot == string::npos ) return false; 50 50 string sx = arg.substr( dot + 1 ); 51 51 for ( int i = 0; i < NumSuffixes; i += 1 ) { … … 55 55 args[nargs] = "c"; 56 56 nargs += 1; 57 return ;57 return true; 58 58 } // if 59 59 } // for 60 return false; 60 61 } // suffix 61 62 … … 128 129 #ifdef __DEBUG_H__ 129 130 cerr << "CFA:" << endl; 131 for ( int i = 1; i < argc; i += 1 ) { 132 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; 133 } // for 130 134 #endif // __DEBUG_H__ 131 135 … … 133 137 134 138 for ( int i = 1; i < argc; i += 1 ) { 135 #ifdef __DEBUG_H__136 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;137 #endif // __DEBUG_H__138 139 arg = argv[i]; // convert to string value 139 #ifdef __DEBUG_H__140 cerr << "arg:\"" << arg << "\"" << endl;141 #endif // __DEBUG_H__142 140 if ( prefix( arg, "-" ) ) { 143 141 // pass through arguments … … 202 200 args[nargs] = argv[i]; // pass the argument along 203 201 nargs += 1; 204 } else if ( arg == "-x" ) {205 xflag = true;206 args[nargs] = argv[i]; // pass the argument along207 nargs += 1;208 i += 1; // advance to argument209 args[nargs] = argv[i]; // pass the argument along210 nargs += 1;211 // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x212 // nargs += 1;213 } else if ( prefix( arg, "-x" ) ) {214 xflag = true;215 args[nargs] = argv[i]; // pass the argument along216 nargs += 1;217 // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x218 // nargs += 1;219 202 } else if ( arg == "-w" ) { 220 203 args[nargs] = argv[i]; // pass the argument along … … 298 281 } // if 299 282 } else { 300 bool opt = false; 301 if ( ! xflag ) { 302 suffix( arg, args, nargs ); // check suffix 303 // args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x 304 // nargs += 1; 305 opt = true; 306 } // if 307 // concatenate other arguments 308 args[nargs] = argv[i]; 283 bool cfa = suffix( arg, args, nargs ); // check suffix 284 args[nargs] = argv[i]; // concatenate file 309 285 nargs += 1; 310 if ( opt) {286 if ( cfa ) { 311 287 args[nargs] = "-x"; 312 288 nargs += 1; 313 289 args[nargs] = "none"; 314 290 nargs += 1; 315 // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x316 // nargs += 1;317 291 } // if 318 292 nonoptarg = true; … … 320 294 } // if 321 295 } // for 296 297 args[nargs] = "-x"; // turn off language 298 nargs += 1; 299 args[nargs] = "none"; 300 nargs += 1; 322 301 323 302 #ifdef __x86_64__ -
libcfa/src/heap.cfa
r7e08acf re15ba975 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 23 06:11:44201813 // Update Count : 51 112 // Last Modified On : Thu Sep 6 09:01:30 2018 13 // Update Count : 513 14 14 // 15 15 … … 329 329 #endif // __CFA_DEBUG__ 330 330 331 assert( heapManager.heapBegin == 0 ); // always perform check, done once 332 heapManager{}; 331 //assert( heapManager.heapBegin != 0 ); 332 //heapManager{}; 333 if ( heapManager.heapBegin == 0 ) heapManager{}; 333 334 } // memory_startup 334 335 … … 700 701 701 702 static inline void * mallocNoStats( size_t size ) { // necessary for malloc statistics 702 assert( heapManager.heapBegin != 0 ); 703 //assert( heapManager.heapBegin != 0 ); 704 if ( unlikely( heapManager.heapBegin == 0 ) ) heapManager{}; // called before memory_startup ? 703 705 void * area = doMalloc( size ); 704 706 if ( unlikely( area == 0 ) ) errno = ENOMEM; // POSIX
Note: See TracChangeset
for help on using the changeset viewer.