Changes in / [599dc6a:c9019ce]
- Files:
-
- 19 edited
-
doc/bibliography/pl.bib (modified) (10 diffs)
-
doc/user/Makefile (modified) (1 diff)
-
doc/user/user.tex (modified) (13 diffs)
-
libcfa/src/containers/string_res.cfa (modified) (2 diffs)
-
libcfa/src/fstream.cfa (modified) (4 diffs)
-
libcfa/src/fstream.hfa (modified) (4 diffs)
-
libcfa/src/gmp.hfa (modified) (2 diffs)
-
libcfa/src/iostream.cfa (modified) (11 diffs)
-
libcfa/src/iostream.hfa (modified) (3 diffs)
-
libcfa/src/parseconfig.cfa (modified) (1 diff)
-
libcfa/src/strstream.cfa (modified) (4 diffs)
-
libcfa/src/strstream.hfa (modified) (2 diffs)
-
src/AST/LinkageSpec.cpp (modified) (1 diff)
-
src/AST/LinkageSpec.hpp (modified) (1 diff)
-
tests/PRNG.cfa (modified) (9 diffs)
-
tests/designations.cfa (modified) (13 diffs)
-
tests/io/.expect/io.txt (modified) (1 diff)
-
tests/io/io.cfa (modified) (6 diffs)
-
tests/raii/dtor-early-exit.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r599dc6a rc9019ce 230 230 publisher = {MIT Press, Cambridge}, 231 231 year = 1986 232 } 233 234 @inproceedings{Srinivasan08, 235 author = {Srinivasan, Sriram and Mycroft, Alan}, 236 editor = {Vitek, Jan}, 237 title = {Kilim: Isolation-Typed Actors for Java}, 238 organization= {ECOOP 2008 -- Object-Oriented Programming}, 239 year = {2008}, 240 publisher = {Springer Berlin Heidelberg}, 241 address = {Berlin, Heidelberg}, 242 pages = {104--128}, 232 243 } 233 244 … … 419 430 } 420 431 421 @article{Delisle21,422 keywords = {concurrency, Cforall},423 contributer = {pabuhr@plg},424 author = {Thierry Delisle and Peter A. Buhr},425 title = {Advanced Control-flow and Concurrency in \textsf{C}$\mathbf{\forall}$},426 journal = spe,427 month = may,428 year = 2021,429 volume = 51,430 number = 5,431 pages = {1005-1042},432 optnote = {\href{https://onlinelibrary.wiley.com/doi/10.1002/spe.2925}{https://\-onlinelibrary.wiley.com/\-doi/\-10.1002/\-spe.2925}},433 }434 435 432 @article{Buhr00a, 436 433 keywords = {exception handling}, … … 1229 1226 } 1230 1227 1231 @phdthesis{Delisle22,1232 contributer = {pabuhr@plg},1233 author = {Delisle, Thierry},1234 title = {The \textsf{C}$\mathbf{\forall}$ Scheduler},1235 school = {School of Computer Science, University of Waterloo},1236 address = {Waterloo, Ontario, Canada, N2L 3G1},1237 publisher = {UWSpace},1238 year = 2022,1239 note = {\url{http://hdl.handle.net/10012/18941}}1240 }1241 1242 1228 @misc{CFAStackEvaluation, 1243 1229 contributer = {a3moss@plg}, … … 1657 1643 volume = 21, 1658 1644 number = 8, 1659 pages = {666-677}, 1660 publisher = {ACM New York, NY, USA}, 1645 pages = {666-677} 1661 1646 } 1662 1647 … … 2003 1988 title = {Concurrency in \textsf{C}$\mathbf{\forall}$}, 2004 1989 school = {School of Computer Science, University of Waterloo}, 2005 address = {Waterloo, Ontario, Canada, N2L 3G1},2006 publisher = {UWSpace},2007 1990 year = 2018, 2008 note = {\url{http://hdl.handle.net/10012/12888}}, 1991 optaddress = {Waterloo, Ontario, Canada, N2L 3G1}, 1992 note = {\href{https://uwspace.uwaterloo.ca/handle/10012/12888}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-12888}}, 1993 } 1994 1995 @article{Delisle21, 1996 keywords = {concurrency, Cforall}, 1997 contributer = {pabuhr@plg}, 1998 author = {Thierry Delisle and Peter A. Buhr}, 1999 title = {Advanced Control-flow and Concurrency in \textsf{C}$\mathbf{\forall}$}, 2000 journal = spe, 2001 month = may, 2002 year = 2021, 2003 volume = 51, 2004 number = 5, 2005 pages = {1005-1042}, 2006 optnote = {\href{https://onlinelibrary.wiley.com/doi/10.1002/spe.2925}{https://\-onlinelibrary.wiley.com/\-doi/\-10.1002/\-spe.2925}}, 2009 2007 } 2010 2008 … … 3347 3345 } 3348 3346 3349 @mastersthesis{Beach21,3350 contributer = {pabuhr@plg},3351 author = {Beach, Andrew James},3352 title = {Exception Handling in \textsf{C}$\mathbf{\forall}$},3353 school = {School of Computer Science, University of Waterloo},3354 address = {Waterloo, Ontario, Canada, N2L 3G1},3355 publisher = {UWSpace},3356 year = {2021},3357 note = {\url{http://hdl.handle.net/10012/17617}},3358 }3359 3360 3347 @article{Liskov79, 3361 3348 keywords = {exception handling}, … … 4089 4076 year = 2022, 4090 4077 address = {Waterloo, Ontario, Canada, N2L 3G1}, 4091 note = {\ url{http://hdl.handle.net/10012/18329}},4078 note = {\href{https://uwspace.uwaterloo.ca/handle/10012/18329}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/18329}}, 4092 4079 } 4093 4080 … … 4341 4328 month = sep, 4342 4329 optaddress = {Waterloo, Ontario, Canada, N2L 3G1}, 4343 note = {\ url{https://uwspace.uwaterloo.ca/handle/10012/13935}},4330 note = {\href{https://uwspace.uwaterloo.ca/handle/10012/13935}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-13935}}, 4344 4331 } 4345 4332 … … 4738 4725 year = 1996, 4739 4726 pages = {80-87}, 4740 }4741 4742 @inproceedings{Srinivasan08,4743 author = {Srinivasan, Sriram and Mycroft, Alan},4744 editor = {Vitek, Jan},4745 title = {Kilim: Isolation-Typed Actors for Java},4746 organization= {ECOOP 2008 -- Object-Oriented Programming},4747 year = {2008},4748 publisher = {Springer Berlin Heidelberg},4749 address = {Berlin, Heidelberg},4750 pages = {104--128},4751 4727 } 4752 4728 … … 5102 5078 } 5103 5079 5104 @article{Hesselink23,5105 keywords = {Concurrency, mutual exclusion, atomicity, critical section, efficiency},5106 contributer = {pabuhr@plg},5107 author = {Hesselink, Wim H. and Buhr, Peter A.},5108 title = {MCSH, a Lock with the Standard Interface},5109 issue_date = {June 2023},5110 publisher = {Association for Computing Machinery},5111 address = {New York, NY, USA},5112 volume = 10,5113 number = 2,5114 journal = {ACM Trans. Parallel Comput.},5115 issn = {2329-4949},5116 url = {https://doi.org/10.1145/3584696},5117 doi = {10.1145/3584696},5118 articleno = 11,5119 numpages = 23,5120 month = jun,5121 year = {2023},5122 }5123 5124 5080 @inproceedings{mprof, 5125 5081 keywords = {malloc}, -
doc/user/Makefile
r599dc6a rc9019ce 68 68 -${BibTeX} ${Build}/${basename $@} 69 69 # Some citations reference others so run again to resolve these citations 70 ${LaTeX} ${basename $@}.tex71 #-${BibTeX} ${Build}/${basename $@}70 # ${LaTeX} ${basename $@}.tex 71 -${BibTeX} ${Build}/${basename $@} 72 72 # Make index from *.aux entries and input index at end of document 73 73 makeindex -s ${Macros}/indexstyle ${Build}/${basename $@}.idx -
doc/user/user.tex
r599dc6a rc9019ce 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Jun 29 21:52:51202314 %% Update Count : 55 3313 %% Last Modified On : Mon Jun 5 21:18:29 2023 14 %% Update Count : 5521 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 3981 3981 3982 3982 The following \Index{manipulator}s control \Index{implicit output separation}. 3983 The effect of these manipulators is global for an output stream (except ©sep © and ©nosep©).3983 The effect of these manipulators is global for an output stream (except ©sepOn© and ©sepOff©). 3984 3984 \begin{enumerate} 3985 3985 \item 3986 \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} and \Indexc{sep Val}\index{manipulator!sepVal@©sepVal©}/\Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} set and get the separator string.3986 \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} and \Indexc{sep}\index{manipulator!sep@©sep©}/\Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} set and get the separator string. 3987 3987 The separator string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters). 3988 3988 \begin{cfa}[belowskip=0pt] 3989 3989 sepSet( sout, ", $\LstStringStyle{\textdollar}$" ); $\C{// set separator from " " to ", \$"}$ 3990 sout | 1 | 2 | 3 | " \"" | ®sep Val® | "\"";3990 sout | 1 | 2 | 3 | " \"" | ®sep® | "\""; 3991 3991 \end{cfa} 3992 3992 \begin{cfa}[showspaces=true,aboveskip=0pt] 3993 1®, $\ color{red}\LstStringStyle{\textdollar}$®2®, $\color{red}\LstStringStyle{\textdollar}$®3 ®", $\color{red}\LstStringStyle{\textdollar}$"®3993 1®, $\LstStringStyle{\textdollar}$®2®, $\LstStringStyle{\textdollar}$®3 ®", $\LstStringStyle{\textdollar}$"® 3994 3994 \end{cfa} 3995 3995 \begin{cfa}[belowskip=0pt] … … 4019 4019 4020 4020 \item 4021 \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} and \Indexc{sepTuple Val}\index{manipulator!sepTupleVal@©sepTupleVal©}/\Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} get and set the tuple separator-string.4021 \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} and \Indexc{sepTuple}\index{manipulator!sepTuple@©sepTuple©}/\Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} get and set the tuple separator-string. 4022 4022 The tuple separator-string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters). 4023 4023 \begin{cfa}[belowskip=0pt] 4024 4024 sepSetTuple( sout, " " ); $\C{// set tuple separator from ", " to " "}$ 4025 sout | t1 | t2 | " \"" | ®sepTuple Val® | "\"";4025 sout | t1 | t2 | " \"" | ®sepTuple® | "\""; 4026 4026 \end{cfa} 4027 4027 \begin{cfa}[showspaces=true,aboveskip=0pt] … … 4038 4038 4039 4039 \item 4040 \Indexc{sep Off}\index{manipulator!sepOff@©sepOff©} and \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} globally toggle printing the separator.4040 \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} globally toggle printing the separator. 4041 4041 \begin{cfa}[belowskip=0pt] 4042 sout | ®sepOff®| 1 | 2 | 3; $\C{// turn off implicit separator}$4042 sout | sepDisable | 1 | 2 | 3; $\C{// turn off implicit separator}$ 4043 4043 \end{cfa} 4044 4044 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4046 4046 \end{cfa} 4047 4047 \begin{cfa}[belowskip=0pt] 4048 sout | ®sepOn®| 1 | 2 | 3; $\C{// turn on implicit separator}$4048 sout | sepEnable | 1 | 2 | 3; $\C{// turn on implicit separator}$ 4049 4049 \end{cfa} 4050 4050 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4053 4053 4054 4054 \item 4055 \Indexc{sep }\index{manipulator!sep@©sep©} and \Indexc{nosep}\index{manipulator!nosep@©nosep©} locally toggle printing the separator with respect to the next printed item, and then return to the global separator setting.4055 \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} locally toggle printing the separator with respect to the next printed item, and then return to the global separator setting. 4056 4056 \begin{cfa}[belowskip=0pt] 4057 sout | 1 | ®nosep®| 2 | 3; $\C{// turn off implicit separator for the next item}$4057 sout | 1 | sepOff | 2 | 3; $\C{// turn off implicit separator for the next item}$ 4058 4058 \end{cfa} 4059 4059 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4061 4061 \end{cfa} 4062 4062 \begin{cfa}[belowskip=0pt] 4063 sout | sep Off | 1 | ®sep®| 2 | 3; $\C{// turn on implicit separator for the next item}$4063 sout | sepDisable | 1 | sepOn | 2 | 3; $\C{// turn on implicit separator for the next item}$ 4064 4064 \end{cfa} 4065 4065 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4068 4068 The tuple separator also responses to being turned on and off. 4069 4069 \begin{cfa}[belowskip=0pt] 4070 sout | t1 | ®nosep®| t2; $\C{// turn off implicit separator for the next item}$4070 sout | t1 | sepOff | t2; $\C{// turn off implicit separator for the next item}$ 4071 4071 \end{cfa} 4072 4072 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] 4073 4073 1, 2, 34, 5, 6 4074 4074 \end{cfa} 4075 ©sep © \emph{cannot} be used to start/end a line with a separator because separators do not appear at the start/end of a line;4075 ©sepOn© \emph{cannot} be used to start/end a line with a separator because separators do not appear at the start/end of a line; 4076 4076 use ©sep© to accomplish this functionality. 4077 4077 \begin{cfa}[belowskip=0pt] 4078 sout | ®sep® | 1 | 2 | 3 | ®sep®; $\C{// sepdoes nothing at start/end of line}$4078 sout | sepOn | 1 | 2 | 3 | sepOn; $\C{// sepOn does nothing at start/end of line}$ 4079 4079 \end{cfa} 4080 4080 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4082 4082 \end{cfa} 4083 4083 \begin{cfa}[belowskip=0pt] 4084 sout | ®sepVal® | 1 | 2 | 3 | ®sepVal® ; $\C{// use sepValto print separator at start/end of line}$4084 sout | sep | 1 | 2 | 3 | sep ; $\C{// use sep to print separator at start/end of line}$ 4085 4085 \end{cfa} 4086 4086 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] … … 4116 4116 \Indexc{nl}\index{manipulator!nl@©nl©} inserts a newline. 4117 4117 \begin{cfa} 4118 sout | ®nl®; $\C{// only print newline}$4118 sout | nl; $\C{// only print newline}$ 4119 4119 sout | 2; $\C{// implicit newline}$ 4120 sout | 3 | ®nl® | 4 | ®nl®; $\C{// terminating nl merged with implicit newline}$4121 sout | 5 | ®nl® | ®nl®; $\C{// again terminating nl merged with implicit newline}$4120 sout | 3 | nl | 4 | nl; $\C{// terminating nl merged with implicit newline}$ 4121 sout | 5 | nl | nl; $\C{// again terminating nl merged with implicit newline}$ 4122 4122 sout | 6; $\C{// implicit newline}$ 4123 4123 … … 4286 4286 For the C-string type, precision is the maximum number of printed characters, so the string is truncated if it exceeds the maximum. 4287 4287 \begin{cfa}[belowskip=0pt] 4288 sout | wd( 6,8, "abcd" ) | wd( 6,8, "abcdefghijk" ) | wd( 6,3, "abcd" ) | ®wd( 10, "" )® | 'X';4288 sout | wd( 6,8, "abcd" ) | wd( 6,8, "abcdefghijk" ) | wd( 6,3, "abcd" ); 4289 4289 \end{cfa} 4290 4290 \begin{cfa}[showspaces=true,aboveskip=0pt,belowskip=0pt] 4291 abcd abcdefgh abc® ®X 4292 \end{cfa} 4293 Note, printing the null string with minimum width L pads with L spaces. 4291 abcd abcdefgh abc 4292 \end{cfa} 4294 4293 4295 4294 \item … … 4374 4373 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\""; 4375 4374 4376 sout | sep Off| 1 | 2 | 3; // globally turn off implicit separator4377 sout | sep On| 1 | 2 | 3; // globally turn on implicit separator4378 4379 sout | 1 | nosep| 2 | 3; // locally turn on implicit separator4380 sout | sep Off | 1 | sep| 2 | 3; // globally turn off implicit separator4381 sout | sep On;4382 sout | t1 | nosep| t2; // locally turn on/off implicit separator4383 4384 sout | sep | 1 | 2 | 3 | sep ; // sepdoes nothing at start/end of line4375 sout | sepDisable | 1 | 2 | 3; // globally turn off implicit separator 4376 sout | sepEnable | 1 | 2 | 3; // globally turn on implicit separator 4377 4378 sout | 1 | sepOff | 2 | 3; // locally turn on implicit separator 4379 sout | sepDisable | 1 | sepOn | 2 | 3; // globally turn off implicit separator 4380 sout | sepEnable; 4381 sout | t1 | sepOff | t2; // locally turn on/off implicit separator 4382 4383 sout | sepOn | 1 | 2 | 3 | sepOn ; // sepOn does nothing at start/end of line 4385 4384 sout | sep | 1 | 2 | 3 | sep ; // use sep to print separator at start/end of line 4386 4385 } … … 4693 4692 sout | i | j | k | x | y | s; 4694 4693 } 4695 \end{cfa} 4696 \begin{cfa}[showspaces=true] 4694 4697 4695 3 0x5 7 1.234568e+07 987.654n abc 4698 4696 3 0x5 7 1.234568e+07 987.654n abc -
libcfa/src/containers/string_res.cfa
r599dc6a rc9019ce 9 9 // Author : Michael L. Brooks 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Jun 29 09:29:06 202313 // Update Count : 211 // Last Modified By : Michael L. Brooks 12 // Last Modified On : Fri Sep 03 11:00:00 2021 13 // Update Count : 1 14 14 // 15 15 … … 204 204 out | s[i]; 205 205 } 206 out | sep Val;206 out | sep; 207 207 // Re-apply newlines after done, for chaining version 208 208 if (anl) nlOn(out); -
libcfa/src/fstream.cfa
r599dc6a rc9019ce 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:09:52 202313 // Update Count : 5 3312 // Last Modified On : Sat Jun 17 08:51:12 2023 13 // Update Count : 528 14 14 // 15 15 … … 43 43 } // ?{} 44 44 45 inline bool getNL$( ofstream & os ) { return os.sawNL$; }46 inline void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; }47 inline bool getANL$( ofstream & os ) { return os.nlOnOff$; }48 49 45 inline bool sepPrt$( ofstream & os ) { setNL$( os, false ); return os.sepOnOff$; } 50 46 inline void sepReset$( ofstream & os ) { os.sepOnOff$ = os.sepDefault$; } … … 52 48 inline const char * sepGetCur$( ofstream & os ) { return os.sepCur$; } 53 49 inline void sepSetCur$( ofstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; } 54 50 inline bool getNL$( ofstream & os ) { return os.sawNL$; } 51 inline void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; } 52 inline bool getANL$( ofstream & os ) { return os.nlOnOff$; } 55 53 inline bool getPrt$( ofstream & os ) { return os.prt$; } 56 54 inline void setPrt$( ofstream & os, bool state ) { os.prt$ = state; } … … 65 63 void ^?{}( ofstream & os ) { close( os ); } 66 64 67 void nlOn( ofstream & os ) { os.nlOnOff$ = true; } 68 void nlOff( ofstream & os ) { os.nlOnOff$ = false; } 69 70 void sep( ofstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 71 void nosep( ofstream & os ) { os.sepOnOff$ = false; } 72 73 bool sepOn( ofstream & os ) { 65 void sepOn( ofstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 66 void sepOff( ofstream & os ) { os.sepOnOff$ = false; } 67 68 bool sepDisable( ofstream & os ) { 69 bool temp = os.sepDefault$; 70 os.sepDefault$ = false; 71 sepReset$( os ); 72 return temp; 73 } // sepDisable 74 75 bool sepEnable( ofstream & os ) { 74 76 bool temp = os.sepDefault$; 75 77 os.sepDefault$ = true; 76 78 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 77 79 return temp; 78 } // sepOn 79 80 bool sepOff( ofstream & os ) { 81 bool temp = os.sepDefault$; 82 os.sepDefault$ = false; 83 sepReset$( os ); 84 return temp; 85 } // sepOff 80 } // sepEnable 81 82 void nlOn( ofstream & os ) { os.nlOnOff$ = true; } 83 void nlOff( ofstream & os ) { os.nlOnOff$ = false; } 86 84 87 85 const char * sepGet( ofstream & os ) { return os.separator$; } -
libcfa/src/fstream.hfa
r599dc6a rc9019ce 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:08:31202313 // Update Count : 2 5112 // Last Modified On : Mon Jun 5 22:00:20 2023 13 // Update Count : 246 14 14 // 15 15 … … 40 40 41 41 // private 42 bool getNL$( ofstream & );43 void setNL$( ofstream &, bool );44 bool getANL$( ofstream & );45 46 42 bool sepPrt$( ofstream & ); 47 43 void sepReset$( ofstream & ); … … 49 45 const char * sepGetCur$( ofstream & ); 50 46 void sepSetCur$( ofstream &, const char [] ); 51 47 bool getNL$( ofstream & ); 48 void setNL$( ofstream &, bool ); 49 bool getANL$( ofstream & ); 52 50 bool getPrt$( ofstream & ); 53 51 void setPrt$( ofstream &, bool ); … … 57 55 58 56 // public 57 void sepOn( ofstream & ); 58 void sepOff( ofstream & ); 59 bool sepDisable( ofstream & ); 60 bool sepEnable( ofstream & ); 59 61 void nlOn( ofstream & ); 60 62 void nlOff( ofstream & ); 61 63 62 void sep( ofstream & );63 void nosep( ofstream & );64 bool sepOn( ofstream & );65 bool sepOff( ofstream & );66 64 const char * sepGet( ofstream & ); 67 65 void sepSet( ofstream &, const char [] ); -
libcfa/src/gmp.hfa
r599dc6a rc9019ce 10 10 // Created On : Tue Apr 19 08:43:43 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jun 29 09:43:30 202313 // Update Count : 3 312 // Last Modified On : Tue Apr 20 20:59:21 2021 13 // Update Count : 32 14 14 // 15 15 … … 265 265 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 266 266 gmp_printf( "%Zd", mp.mpz ); 267 sep ( os );267 sepOn( os ); 268 268 return os; 269 269 } // ?|? -
libcfa/src/iostream.cfa
r599dc6a rc9019ce 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 10:12:39202313 // Update Count : 13 8012 // Last Modified On : Mon Jan 9 09:27:58 2023 13 // Update Count : 1361 14 14 // 15 15 … … 50 50 fmt( os, "%c", c ); 51 51 if ( c == '\n' ) setNL$( os, true ); 52 return nosep( os );52 return sepOff( os ); 53 53 } // ?|? 54 54 void ?|?( ostype & os, char c ) { … … 284 284 285 285 if ( s == 0p ) { fmt( os, "%s", "0p" ); return os; } // null pointer 286 if ( s[0] == '\0' ) { nosep( os ); return os; } // null string => no leading/trailingseparator286 if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => no separator 287 287 288 288 // first character IS NOT spacing or closing punctuation => add left separator … … 300 300 fmt( os, "%s", s ); // fmt resets seperator, but reset it again 301 301 if ( sepPrt$( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 302 sep ( os );302 sepOn( os ); 303 303 } else { 304 nosep( os );304 sepOff( os ); 305 305 } // if 306 306 if ( ch == '\n' ) setNL$( os, true ); // check *AFTER* sepPrt$ call above as it resets NL flag … … 351 351 } // ?|? 352 352 353 ostype & sep( ostype & os ) { 354 return (ostype &)(os | sepGet( os )); 355 } // sep 356 357 ostype & sepTuple( ostype & os ) { 358 return os | sepGetTuple( os ); 359 } // sepTuple 360 353 361 ostype & nl( ostype & os ) { 354 362 (ostype &)(os | '\n'); 355 363 setPrt$( os, false ); // turn off 356 364 setNL$( os, true ); 357 return nosep( os );// prepare for next line365 return sepOff( os ); // prepare for next line 358 366 } // nl 359 367 … … 363 371 } // nonl 364 372 373 ostype & sepOn( ostype & os ) { 374 sepOn( os ); // call void returning 375 return os; 376 } // sepOn 377 378 ostype & sepOff( ostype & os ) { 379 sepOff( os ); // call void returning 380 return os; 381 } // sepOff 382 383 ostype & sepEnable( ostype & os ) { 384 sepEnable( os ); // call void returning 385 return os; 386 } // sepEnable 387 388 ostype & sepDisable( ostype & os ) { 389 sepDisable( os ); // call void returning 390 return os; 391 } // sepDisable 392 365 393 ostype & nlOn( ostype & os ) { 366 394 nlOn( os ); // call void returning … … 372 400 return os; 373 401 } // nlOff 374 375 ostype & sepVal( ostype & os ) {376 return (ostype &)(os | sepGet( os ));377 } // sepVal378 379 ostype & sepTupleVal( ostype & os ) {380 return os | sepGetTuple( os );381 } // sepTupleVal382 383 ostype & sep( ostype & os ) {384 sep( os ); // call void returning385 return os;386 } // sep387 388 ostype & nosep( ostype & os ) {389 nosep( os ); // call void returning390 return os;391 } // nosep392 393 ostype & sepOn( ostype & os ) {394 sepOn( os ); // call void returning395 return os;396 } // sepOn397 398 ostype & sepOff( ostype & os ) {399 sepOff( os ); // call void returning400 return os;401 } // sepOff402 402 } // distribution 403 403 … … 550 550 if ( cnt == 1 ) { 551 551 if ( f.flags.left ) { wd -= maxdig; f.wd = wd < 0 ? 1 : wd; } // update and restore f.wd for printing end chunk 552 nosep( os ); // no seperator between chunks552 sepOff( os ); // no seperator between chunks 553 553 } // if 554 554 } else { // print start chunk … … 595 595 else { f.pc = maxdig; f.flags.pc = true; } // left pad with precision 596 596 597 if ( cnt != 0 ) nosep( os ); // no seperator between chunks597 if ( cnt != 0 ) sepOff( os ); // no seperator between chunks 598 598 f.wd = wd; // reset f.wd for next chunk 599 599 f.flags.sign = false; // no leading +/- sign … … 773 773 } // if 774 774 775 if ( f.val[0] != '\0' && // null string => no leading separator 776 sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 775 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 777 776 778 777 #define SFMTNP "% * " … … 796 795 fmt( os, &fmtstr[star], f.wd, f.pc, f.val ); 797 796 } // if 798 if ( f.val[0] == '\0' ) { nosep( os ); } // null string => no trailing separator799 797 return os; 800 798 } // ?|? -
libcfa/src/iostream.hfa
r599dc6a rc9019ce 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:07:25202313 // Update Count : 4 2712 // Last Modified On : Thu Jun 15 22:34:31 2023 13 // Update Count : 411 14 14 // 15 15 … … 36 36 void setPrt$( ostype &, bool ); // set fmt called in output cascade 37 37 // public 38 void sepOn( ostype & ); // turn separator state on 39 void sepOff( ostype & ); // turn separator state off 40 bool sepDisable( ostype & ); // set default state to off, and return previous state 41 bool sepEnable( ostype & ); // set default state to on, and return previous state 38 42 void nlOn( ostype & ); // turn auto-newline state on 39 43 void nlOff( ostype & ); // turn auto-newline state off 40 44 41 void sep( ostype & ); // turn separator state on42 void nosep( ostype & ); // turn separator state off43 bool sepOn( ostype & ); // set default state to on, and return previous state44 bool sepOff( ostype & ); // set default state to off, and return previous state45 45 const char * sepGet( ostype & ); // get separator string 46 46 void sepSet( ostype &, const char [] ); // set separator to string (15 character maximum) … … 135 135 ostype & ?|?( ostype &, ostype & (*)( ostype & ) ); 136 136 void ?|?( ostype &, ostype & (*)( ostype & ) ); 137 138 137 ostype & nl( ostype & ); 139 138 ostype & nonl( ostype & ); 139 ostype & sep( ostype & ); 140 ostype & sepTuple( ostype & ); 141 ostype & sepOn( ostype & ); 142 ostype & sepOff( ostype & ); 143 ostype & sepDisable( ostype & ); 144 ostype & sepEnable( ostype & ); 140 145 ostype & nlOn( ostype & ); 141 146 ostype & nlOff( ostype & ); 142 143 ostype & sepVal( ostype & );144 ostype & sepTupleVal( ostype & );145 ostype & sep( ostype & );146 ostype & nosep( ostype & );147 ostype & sepOn( ostype & );148 ostype & sepOff( ostype & );149 147 } // distribution 150 148 -
libcfa/src/parseconfig.cfa
r599dc6a rc9019ce 29 29 // TODO: use string interface when it's ready (and implement exception msg protocol) 30 30 [ void ] msg( * Missing_Config_Entries ex ) { 31 serr | "The config file is missing " | ex->num_missing | "entr" | nosep| (ex->num_missing == 1 ? "y." : "ies.");31 serr | "The config file is missing " | ex->num_missing | "entr" | sepOff | (ex->num_missing == 1 ? "y." : "ies."); 32 32 } // msg 33 33 -
libcfa/src/strstream.cfa
r599dc6a rc9019ce 10 10 // Created On : Thu Apr 22 22:24:35 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 10:59:00 202313 // Update Count : 10 512 // Last Modified On : Sun Oct 10 16:13:20 2021 13 // Update Count : 101 14 14 // 15 15 … … 32 32 33 33 // private 34 inline bool getNL$( ostrstream & os ) { return os.sawNL$; }35 inline void setNL$( ostrstream & os, bool state ) { os.sawNL$ = state; }36 inline bool getANL$( ostrstream & os ) { return os.nlOnOff$; }37 34 inline bool sepPrt$( ostrstream & os ) { setNL$( os, false ); return os.sepOnOff$; } 38 35 inline void sepReset$( ostrstream & os ) { os.sepOnOff$ = os.sepDefault$; } … … 40 37 inline const char * sepGetCur$( ostrstream & os ) { return os.sepCur$; } 41 38 inline void sepSetCur$( ostrstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; } 39 inline bool getNL$( ostrstream & os ) { return os.sawNL$; } 40 inline void setNL$( ostrstream & os, bool state ) { os.sawNL$ = state; } 41 inline bool getANL$( ostrstream & os ) { return os.nlOnOff$; } 42 42 inline bool getPrt$( ostrstream & os ) { return os.prt$; } 43 43 inline void setPrt$( ostrstream & os, bool state ) { os.prt$ = state; } 44 44 45 45 // public 46 void nlOn( ostrstream & os ) { os.nlOnOff$ = true; }47 void nlOff( ostrstream & os ) { os.nlOnOff$ = false; }48 49 46 void ?{}( ostrstream & os, char buf[], size_t size ) { 50 47 os.buf$ = buf; … … 61 58 } // ?{} 62 59 63 void sep ( ostrstream & os ) { os.sepOnOff$ = ! getNL$( os ); }64 void nosep( ostrstream & os ) { os.sepOnOff$ = false; }60 void sepOn( ostrstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 61 void sepOff( ostrstream & os ) { os.sepOnOff$ = false; } 65 62 66 bool sepOn( ostrstream & os ) { 63 bool sepDisable( ostrstream & os ) { 64 bool temp = os.sepDefault$; 65 os.sepDefault$ = false; 66 sepReset$( os ); 67 return temp; 68 } // sepDisable 69 70 bool sepEnable( ostrstream & os ) { 67 71 bool temp = os.sepDefault$; 68 72 os.sepDefault$ = true; 69 73 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 70 74 return temp; 71 } // sep On75 } // sepEnable 72 76 73 bool sepOff( ostrstream & os ) { 74 bool temp = os.sepDefault$; 75 os.sepDefault$ = false; 76 sepReset$( os ); 77 return temp; 78 } // sepOff 77 void nlOn( ostrstream & os ) { os.nlOnOff$ = true; } 78 void nlOff( ostrstream & os ) { os.nlOnOff$ = false; } 79 79 80 80 const char * sepGet( ostrstream & os ) { return os.separator$; } -
libcfa/src/strstream.hfa
r599dc6a rc9019ce 10 10 // Created On : Thu Apr 22 22:20:59 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 10:58:58 202313 // Update Count : 5112 // Last Modified On : Sun Oct 10 10:14:22 2021 13 // Update Count : 47 14 14 // 15 15 … … 53 53 54 54 // public 55 void sepOn( ostrstream & ); 56 void sepOff( ostrstream & ); 57 bool sepDisable( ostrstream & ); 58 bool sepEnable( ostrstream & ); 55 59 void nlOn( ostrstream & ); 56 60 void nlOff( ostrstream & ); 57 61 58 void sep( ostrstream & );59 void nosep( ostrstream & );60 bool sepOn( ostrstream & );61 bool sepOff( ostrstream & );62 62 const char * sepGet( ostrstream & ); 63 63 void sepSet( ostrstream &, const char [] ); -
src/AST/LinkageSpec.cpp
r599dc6a rc9019ce 27 27 namespace Linkage { 28 28 29 Spec update( CodeLocation loc, Spec spec, const std::string * cmd ) { 30 assert( cmd ); 31 std::unique_ptr<const std::string> guard( cmd ); // allocated by lexer 32 if ( *cmd == "\"Cforall\"" ) { 33 spec.is_mangled = true; 34 return spec; 35 } else if ( *cmd == "\"C\"" ) { 36 spec.is_mangled = false; 37 return spec; 38 } else { 39 SemanticError( loc, "Invalid linkage specifier " + *cmd ); 29 Spec update( CodeLocation loc, Spec spec, const std::string * cmd ) { 30 assert( cmd ); 31 std::unique_ptr<const std::string> guard( cmd ); // allocated by lexer 32 if ( *cmd == "\"Cforall\"" ) { 33 spec.is_mangled = true; 34 return spec; 35 } else if ( *cmd == "\"C\"" ) { 36 spec.is_mangled = false; 37 return spec; 38 } else { 39 SemanticError( loc, "Invalid linkage specifier " + *cmd ); 40 } 40 41 } 41 }42 42 43 std::string name( Spec spec ) { 44 switch ( spec.val ) { 45 case Intrinsic.val: return "intrinsic"; 46 case C.val: return "C"; 47 case Cforall.val: return "Cforall"; 48 case AutoGen.val: return "autogenerated cfa"; 49 case Compiler.val: return "compiler built-in"; 50 case BuiltinCFA.val: return "cfa built-in"; 51 case BuiltinC.val: return "c built-in"; 52 default: return "<unnamed linkage spec>"; 43 44 std::string name( Spec spec ) { 45 switch ( spec.val ) { 46 case Intrinsic.val: return "intrinsic"; 47 case C.val: return "C"; 48 case Cforall.val: return "Cforall"; 49 case AutoGen.val: return "autogenerated cfa"; 50 case Compiler.val: return "compiler built-in"; 51 case BuiltinCFA.val: return "cfa built-in"; 52 case BuiltinC.val: return "c built-in"; 53 default: return "<unnamed linkage spec>"; 54 } 53 55 } 54 }55 56 56 57 } -
src/AST/LinkageSpec.hpp
r599dc6a rc9019ce 25 25 namespace Linkage { 26 26 27 /// Bitflags for linkage specifiers 28 enum { 29 Mangle = 1 << 0, 30 Generate = 1 << 1, 31 Overrideable = 1 << 2, 32 Builtin = 1 << 3, 33 GccBuiltin = 1 << 4 34 }; 35 36 /// Bitflag type for storage classes 37 struct spec_flags { 38 union { 39 unsigned int val; 40 struct { 41 bool is_mangled : 1; 42 bool is_generatable : 1; 43 bool is_overrideable : 1; 44 bool is_builtin : 1; 45 bool is_gcc_builtin : 1; 46 }; 27 /// Bitflags for linkage specifiers 28 enum { 29 Mangle = 1 << 0, 30 Generate = 1 << 1, 31 Overrideable = 1 << 2, 32 Builtin = 1 << 3, 33 GccBuiltin = 1 << 4 47 34 }; 48 35 49 constexpr spec_flags( unsigned int val ) : val(val) {} 50 }; 36 /// Bitflag type for storage classes 37 struct spec_flags { 38 union { 39 unsigned int val; 40 struct { 41 bool is_mangled : 1; 42 bool is_generatable : 1; 43 bool is_overrideable : 1; 44 bool is_builtin : 1; 45 bool is_gcc_builtin : 1; 46 }; 47 }; 51 48 52 using Spec = bitfield<spec_flags>; 49 constexpr spec_flags( unsigned int val ) : val(val) {} 50 }; 53 51 54 /// If `cmd` = "C" returns `spec` with `is_mangled = false`. 55 /// If `cmd` = "Cforall" returns `spec` with `is_mangled = true`. 56 Spec update( CodeLocation loc, Spec spec, const std::string * cmd ); 52 using Spec = bitfield<spec_flags>; 57 53 58 /// A human-readable name for this spec 59 std::string name( Spec spec ); 54 /// If `cmd` = "C" returns `spec` with `is_mangled = false`. 55 /// If `cmd` = "Cforall" returns `spec` with `is_mangled = true`. 56 Spec update( CodeLocation loc, Spec spec, const std::string * cmd ); 60 57 61 // Pre-defined flag combinations 58 /// A human-readable name for this spec 59 std::string name( Spec spec ); 62 60 63 /// C built-in defined in prelude 64 constexpr Spec Intrinsic = { Mangle | Generate | Overrideable | Builtin }; 65 /// Ordinary Cforall 66 constexpr Spec Cforall = { Mangle | Generate }; 67 /// C code: not overloadable, not mangled 68 constexpr Spec C = { Generate }; 69 /// Built by translator (e.g. struct assignment) 70 constexpr Spec AutoGen = { Mangle | Generate | Overrideable }; 71 /// GCC internal 72 constexpr Spec Compiler = { Mangle | Builtin | GccBuiltin }; 73 /// Mangled builtins 74 constexpr Spec BuiltinCFA = { Mangle | Generate | Builtin }; 75 /// Non-mangled builtins 76 constexpr Spec BuiltinC = { Generate | Builtin }; 61 // Pre-defined flag combinations 77 62 63 /// C built-in defined in prelude 64 constexpr Spec Intrinsic = { Mangle | Generate | Overrideable | Builtin }; 65 /// Ordinary Cforall 66 constexpr Spec Cforall = { Mangle | Generate }; 67 /// C code: not overloadable, not mangled 68 constexpr Spec C = { Generate }; 69 /// Built by translator (e.g. struct assignment) 70 constexpr Spec AutoGen = { Mangle | Generate | Overrideable }; 71 /// GCC internal 72 constexpr Spec Compiler = { Mangle | Builtin | GccBuiltin }; 73 /// Mangled builtins 74 constexpr Spec BuiltinCFA = { Mangle | Generate | Builtin }; 75 /// Non-mangled builtins 76 constexpr Spec BuiltinC = { Generate | Builtin }; 78 77 } 79 78 -
tests/PRNG.cfa
r599dc6a rc9019ce 10 10 // Created On : Wed Dec 29 09:38:12 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 10:18:35202313 // Update Count : 42 412 // Last Modified On : Thu May 25 15:39:52 2023 13 // Update Count : 422 14 14 // 15 15 … … 144 144 srand( rseed ); 145 145 146 sout | sep Off;146 sout | sepDisable; 147 147 sout | nl | wd(26, "rand()" ) | wd(12, "rand(5)") | wd(12, "rand(0,5)" ); 148 148 for ( 20 ) { … … 151 151 sout | wd(12, rand() % (5 - 0 + 1) + 0); 152 152 } // for 153 sout | sep On;153 sout | sepEnable; 154 154 sout | "seed" | rseed; 155 155 … … 185 185 if ( seed != 0 ) set_seed( prng, seed ); 186 186 187 sout | sep Off;187 sout | sepDisable; 188 188 sout | nl | wd(26, "PRNG()" ) | wd(12, "PRNG(5)") | wd(12, "PRNG(0,5)" ); 189 189 for ( 20 ) { … … 192 192 sout | wd(12, prng( prng, 0, 5 )); 193 193 } // for 194 sout | sep On;194 sout | sepEnable; 195 195 sout | "seed" | get_seed( prng ); 196 196 … … 220 220 if ( seed != 0 ) set_seed( seed ); 221 221 222 sout | sep Off;222 sout | sepDisable; 223 223 sout | nl | wd(26, "prng()" ) | wd(12, "prng(5)") | wd(12, "prng(0,5)" ); 224 224 for ( 20 ) { … … 227 227 sout | wd(12, prng( 0, 5 )); 228 228 } // for 229 sout | sep On;229 sout | sepEnable; 230 230 sout | "seed" | get_seed( prng ); 231 231 … … 256 256 thread$ & th = *active_thread(); 257 257 258 sout | sep Off;258 sout | sepDisable; 259 259 sout | nl | wd(26, "prng(t)" ) | wd(12, "prng(t,5)") | wd(12, "prng(t,0,5)" ); 260 260 for ( 20 ) { … … 263 263 sout | wd(12, prng( th, 0, 5 )); 264 264 } // for 265 sout | sep On;265 sout | sepEnable; 266 266 sout | "seed" | get_seed( prng ); 267 267 -
tests/designations.cfa
r599dc6a rc9019ce 10 10 // Created On : Thu Jun 29 15:26:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:31:21 2023 13 // Update Count : 28 14 // 15 16 #include <fstream.hfa> 12 // Last Modified On : Mon Mar 28 22:41:55 2022 13 // Update Count : 15 14 // 17 15 18 16 // Note: this test case has been crafted so that it compiles with both cfa and with gcc without any modifications. … … 23 21 #define AT @ 24 22 #else 23 int printf( const char *, ...); 25 24 #define _ = 26 25 #define AT … … 29 28 const int indentAmt = 2; 30 29 void indent( int level ) { 31 sout | wd( level, "" ) | nonl; 30 for ( int i = 0; i < level; ++i ) { 31 printf( " " ); 32 } 32 33 } 33 34 … … 39 40 void printA( struct A a, int level ) { 40 41 indent( level ); 41 sout | "(A){ " | a.x | a.y | a.ptr | " }";42 printf( "(A){ %d %d %p }\n", a.x, a.y, a.ptr ); 42 43 } 43 44 … … 48 49 void printB( struct B b, int level ) { 49 50 indent( level ); 50 sout | "(B){";51 printf( "(B){\n" ); 51 52 printA( b.a0, level+indentAmt ); 52 53 printA( b.a1, level+indentAmt ); 53 54 indent( level ); 54 sout | "}";55 printf( "}\n" ); 55 56 } 56 57 … … 62 63 void printC( struct C c, int level ) { 63 64 indent( level ); 64 sout | "(C){";65 printf( "(C){\n" ); 65 66 indent( level+indentAmt ); 66 sout | "(int[]{ " | c.arr[0] | c.arr[1] | c.arr[2] | " }";67 printf( "(int[]{ %d %d %d }\n", c.arr[0], c.arr[1], c.arr[2]); 67 68 printB( c.b, level+indentAmt ); 68 69 indent( level ); 69 sout | "}";70 printf( "}\n" ); 70 71 } 71 72 … … 78 79 void printD( struct D d, int level ) { 79 80 indent( level); 80 sout | "(D){ " | d.x | "}";81 printf( "(D ){ %d }\n", d.x ); 81 82 } 82 83 … … 91 92 92 93 struct Fred { 93 double i[3];94 int j;95 struct Mary {96 struct Jane {97 double j;98 } j;99 double i;100 } m;94 double i[3]; 95 int j; 96 struct Mary { 97 struct Jane { 98 double j; 99 } j; 100 double i; 101 } m; 101 102 }; 102 103 struct Fred s1 AT= { .m.j _ 3 }; … … 128 129 #endif 129 130 130 sout | "=====A=====";131 printf( "=====A=====\n" ); 131 132 printA( y0, 0 ); 132 133 printA( y1, 0 ); 133 134 printA( y2, 0 ); 134 sout | "=====A=====" | nl | nl;135 printf( "=====A=====\n\n" ); 135 136 136 137 // initialize only first element (z0.a.x), leaving everything else default-initialized (zero), no nested curly-braces … … 171 172 }; 172 173 173 sout | "=====B=====";174 printf( "=====B=====\n" ); 174 175 printB( z0, 0 ); 175 176 printB( z1, 0 ); … … 178 179 printB( z5, 0 ); 179 180 printB( z6, 0 ); 180 sout | "=====B=====" | nl | nl;181 printf( "=====B=====\n\n" ); 181 182 182 183 // TODO: what about extra things in a nested init? are empty structs skipped?? … … 189 190 }; 190 191 191 sout | "=====C=====";192 printf( "=====C=====\n" ); 192 193 printC( c1, 0 ); 193 sout | "=====C=====" | nl | nl;194 printf( "=====C=====\n\n" ); 194 195 195 196 #if ERROR … … 245 246 }; 246 247 247 sout | "=====E=====";248 printf( "=====E=====\n" ); 248 249 printA( e0.a, 0 ); 249 250 printA( e1.a, 0 ); 250 251 printA( e2.a, 0 ); 251 252 printB( e3.b, 0 ); 252 sout | "=====E=====" | nl | nl;253 printf( "=====E=====\n\n" ); 253 254 254 255 // special case of initialization: char[] can be initialized with a string literal -
tests/io/.expect/io.txt
r599dc6a rc9019ce 61 61 1, 2, 3 4, 5, 6 62 62 63 check sep /nosep63 check sepOn/sepOff 64 64 1 2 3 65 65 12 3 -
tests/io/io.cfa
r599dc6a rc9019ce 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 10:19:31 202313 // Update Count : 12 612 // Last Modified On : Sun Feb 21 10:56:33 2021 13 // Update Count : 121 14 14 // 15 15 … … 122 122 sout | "toggle separator"; 123 123 sout | f | "" | d | "" | ld; // floating point without separator 124 sout | sep Off | fc | dc | ldc;// complex without separator125 sout | fc | sep | dc | ldc;// local separator add126 sout | sep On | fc | dc | ldc;// complex with separator127 sout | fc | nosep| dc | ldc; // local separator removal128 sout | s1 | nosep | s2;// local separator removal124 sout | sepDisable | fc | dc | ldc; // complex without separator 125 sout | fc | sepOn | dc | ldc; // local separator add 126 sout | sepEnable | fc | dc | ldc; // complex with separator 127 sout | fc | sepOff | dc | ldc; // local separator removal 128 sout | s1 | sepOff | s2; // local separator removal 129 129 sout | s1 | "" | s2; // local separator removal 130 130 sout | nl; 131 131 132 132 sout | "change separator"; 133 sout | "from \"" | sep Val| "\"" | nonl;133 sout | "from \"" | sep | "\"" | nonl; 134 134 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 135 sout | " to \"" | sep Val| "\"";135 sout | " to \"" | sep | "\""; 136 136 sout | f | d | ld; 137 137 sout | fc | dc | ldc; … … 139 139 sout | t1 | t2; // print tuple 140 140 sout | nl; 141 sout | "from \"" | sep Val| "\" " | nonl;141 sout | "from \"" | sep | "\" " | nonl; 142 142 sepSet( sout, " " ); // restore separator 143 sout | "to \"" | sep Val| "\"";143 sout | "to \"" | sep | "\""; 144 144 sout | f | d | ld; 145 145 sout | fc | dc | ldc; … … 148 148 sout | nl; 149 149 150 sout | "check sep /nosep";151 sout | sep | 1 | 2 | 3 | sep;// no separator at start/end of line152 sout | 1 | nosep| 2 | 3; // locally turn off implicit separator153 sout | sep | sep | 1 | 2 | 3 | sep | nosep | sep| '\n' | nonl; // no separator at start/end of line154 sout | 1 | 2 | 3 | "\n\n" | sep | nonl;// no separator at start of next line150 sout | "check sepOn/sepOff"; 151 sout | sepOn | 1 | 2 | 3 | sepOn; // no separator at start/end of line 152 sout | 1 | sepOff | 2 | 3; // locally turn off implicit separator 153 sout | sepOn | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn | '\n' | nonl; // no separator at start/end of line 154 sout | 1 | 2 | 3 | "\n\n" | sepOn | nonl; // no separator at start of next line 155 155 sout | 1 | 2 | 3; 156 156 sout | nl; 157 157 158 158 sout | "check enable/disable"; 159 sout | sep Off | 1 | 2 | 3;// globally turn off implicit separation160 sout | 1 | sep | 2 | 3;// locally turn on implicit separator161 sout | sep On | 1 | 2 | 3 | sepOff;// globally turn on/off implicit separation162 sout | 1 | 2 | 3 | sep On;// globally turn on implicit separation163 sout | 1 | 2 | 3 | sep | sepOff;// ignore seperate at end of line164 sout | 1 | 2 | 3 | sep | sepOn;// separator at end of line159 sout | sepDisable | 1 | 2 | 3; // globally turn off implicit separation 160 sout | 1 | sepOn | 2 | 3; // locally turn on implicit separator 161 sout | sepEnable | 1 | 2 | 3 | sepDisable; // globally turn on/off implicit separation 162 sout | 1 | 2 | 3 | sepEnable; // globally turn on implicit separation 163 sout | 1 | 2 | 3 | sepOn | sepDisable; // ignore seperate at end of line 164 sout | 1 | 2 | 3 | sepOn | sepEnable; // separator at end of line 165 165 sout | 1 | 2 | 3; 166 166 sout | nl; … … 169 169 170 170 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 171 sout | t1 | t2 | " \"" | sep Val| "\"";171 sout | t1 | t2 | " \"" | sep | "\""; 172 172 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 173 sout | t1 | t2 | " \"" | sep Val| "\"";173 sout | t1 | t2 | " \"" | sep | "\""; 174 174 sout | t1 | t2; // print tuple 175 175 sout | nl; … … 180 180 sepSetTuple( sout, " " ); 181 181 sout | t3; 182 sout | sep | t3 | sepOff | t3 | sepOn| t3;182 sout | sepOn | t3 | sepDisable | t3 | sepEnable | t3; 183 183 sepSet( sout, "^" ); 184 184 sepSetTuple( sout, "-" ); -
tests/raii/dtor-early-exit.cfa
r599dc6a rc9019ce 10 10 // Created On : Wed Aug 17 08:26:25 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:15:56 202313 // Update Count : 1 112 // Last Modified On : Fri Dec 21 08:45:19 2018 13 // Update Count : 10 14 14 // 15 15 … … 244 244 245 245 int main() { 246 sep Off(sout);246 sepDisable(sout); 247 247 for (int i = 0; i < 4; i++) { 248 248 f(i);
Note:
See TracChangeset
for help on using the changeset viewer.