Changeset 937e51d for src/examples
- Timestamp:
- Jun 26, 2015, 4:00:26 PM (11 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 0df292b, e0ff3e6
- Parents:
- eb50842 (diff), 1869adf (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. - Location:
- src/examples
- Files:
-
- 2 added
- 3 deleted
- 40 edited
-
Makefile.am (added)
-
Makefile.in (modified) (1 diff)
-
abstype.c (modified) (2 diffs)
-
array.c (modified) (3 diffs)
-
array.h (modified) (3 diffs)
-
assert.c (added)
-
constants.c (modified) (1 diff)
-
control_structures.c (modified) (2 diffs)
-
ctxts.c (modified) (1 diff)
-
esskaykay.c (modified) (2 diffs)
-
forward.c (modified) (2 diffs)
-
fstream.c (modified) (2 diffs)
-
fstream.h (modified) (2 diffs)
-
fstream_test.c (modified) (1 diff)
-
fwrite.c (modified) (1 diff)
-
hello.c (modified) (1 diff)
-
huge.c (modified) (1 diff)
-
identity.c (modified) (1 diff)
-
includes.c (modified) (2 diffs)
-
index.h (modified) (1 diff)
-
iostream.c (modified) (2 diffs)
-
iostream.h (modified) (4 diffs)
-
it_out.c (modified) (2 diffs)
-
iterator.c (modified) (2 diffs)
-
iterator.h (modified) (3 diffs)
-
min.c (modified) (2 diffs)
-
new.c (modified) (1 diff)
-
prolog.c (modified) (2 diffs)
-
quad.c (modified) (1 diff)
-
quoted_keyword.c (modified) (3 diffs)
-
rodolfo1.c (deleted)
-
rodolfo2.c (deleted)
-
s.c (modified) (1 diff)
-
simple.c (modified) (1 diff)
-
simplePoly.c (modified) (2 diffs)
-
simpler.c (modified) (1 diff)
-
specialize.c (modified) (2 diffs)
-
square.c (modified) (1 diff)
-
square.cf (deleted)
-
sum.c (modified) (2 diffs)
-
swap.c (modified) (1 diff)
-
twice.c (modified) (1 diff)
-
vector_int.c (modified) (3 diffs)
-
vector_int.h (modified) (2 diffs)
-
vector_test.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/examples/Makefile.in
reb50842 r937e51d 1 ######################### -*- Mode: Makefile-Gmake -*- ######################## 2 ## 3 ## Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 4 ## 5 ## The contents of this file are covered under the licence agreement in the 6 ## file "LICENCE" distributed with Cforall. 7 ## 8 ## Makefile.in -- 9 ## 10 ## Author : Peter A. Buhr 11 ## Created On : Sat May 16 11:34:24 2015 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat May 16 11:35:25 2015 14 ## Update Count : 2 1 # Makefile.in generated by automake 1.11.3 from Makefile.am. 2 # @configure_input@ 3 4 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software 6 # Foundation, Inc. 7 # This Makefile.in is free software; the Free Software Foundation 8 # gives unlimited permission to copy and/or distribute it, 9 # with or without modifications, as long as this notice is preserved. 10 11 # This program is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 # PARTICULAR PURPOSE. 15 16 @SET_MAKE@ 17 18 ######################## -*- Mode: Makefile-Automake -*- ###################### 15 19 ############################################################################### 16 20 17 CC := @CFA_BINDIR@/cfa 18 CFLAGS = -g -Wall -Wno-unused-function -MMD 19 MAKEFILE_NAME = ${firstword ${MAKEFILE_LIST}} # makefile name 20 21 OBJECTS1 = iostream.o fstream.o fstream_test.o 22 EXEC1 = fstream_test 23 24 OBJECTS2 = vector_int.o fstream.o iostream.o array.o iterator.o vector_test.o 25 EXEC2 = vector_test 26 27 OBJECTS = ${OBJECTS1} ${OBJECTS2} # all object files 28 DEPENDS = ${OBJECTS:.o=.d} # substitute ".o" with ".d" 29 EXECS = ${EXEC1} ${EXEC2} # all executables 30 31 ########## Targets ########## 32 33 .PHONY : all clean # not file names 34 35 all : ${EXECS} # build all executables 36 37 ${EXEC1} : ${OBJECTS1} # link step 1st executable 38 ${CC} ${CFLAGS} $^ -o $@ # additional object files before $^ 39 40 ${EXEC2} : ${OBJECTS2} # link step 2nd executable 41 ${CC} ${CFLAGS} $^ -o $@ # additional object files before $^ 42 43 ${OBJECTS} : ${MAKEFILE_NAME} # OPTIONAL : changes to this file => recompile 44 45 -include ${DEPENDS} # include *.d files containing program dependences 46 47 clean : # remove files that can be regenerated 48 rm -f ${DEPENDS} ${OBJECTS} ${EXECS} *.class 49 50 distclean : clean 21 VPATH = @srcdir@ 22 pkgdatadir = $(datadir)/@PACKAGE@ 23 pkgincludedir = $(includedir)/@PACKAGE@ 24 pkglibdir = $(libdir)/@PACKAGE@ 25 pkglibexecdir = $(libexecdir)/@PACKAGE@ 26 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 27 install_sh_DATA = $(install_sh) -c -m 644 28 install_sh_PROGRAM = $(install_sh) -c 29 install_sh_SCRIPT = $(install_sh) -c 30 INSTALL_HEADER = $(INSTALL_DATA) 31 transform = $(program_transform_name) 32 NORMAL_INSTALL = : 33 PRE_INSTALL = : 34 POST_INSTALL = : 35 NORMAL_UNINSTALL = : 36 PRE_UNINSTALL = : 37 POST_UNINSTALL = : 38 noinst_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) 39 subdir = src/examples 40 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 41 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 42 am__aclocal_m4_deps = $(top_srcdir)/configure.ac 43 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 44 $(ACLOCAL_M4) 45 mkinstalldirs = $(install_sh) -d 46 CONFIG_HEADER = $(top_builddir)/config.h 47 CONFIG_CLEAN_FILES = 48 CONFIG_CLEAN_VPATH_FILES = 49 PROGRAMS = $(noinst_PROGRAMS) 50 am_fstream_test_OBJECTS = iostream.$(OBJEXT) fstream.$(OBJEXT) \ 51 fstream_test.$(OBJEXT) 52 fstream_test_OBJECTS = $(am_fstream_test_OBJECTS) 53 fstream_test_LDADD = $(LDADD) 54 am_vector_test_OBJECTS = vector_int.$(OBJEXT) fstream.$(OBJEXT) \ 55 iostream.$(OBJEXT) array.$(OBJEXT) iterator.$(OBJEXT) \ 56 vector_test.$(OBJEXT) 57 vector_test_OBJECTS = $(am_vector_test_OBJECTS) 58 vector_test_LDADD = $(LDADD) 59 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 60 depcomp = $(SHELL) $(top_srcdir)/automake/depcomp 61 am__depfiles_maybe = depfiles 62 am__mv = mv -f 63 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 64 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 65 CCLD = $(CC) 66 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 67 SOURCES = $(fstream_test_SOURCES) $(vector_test_SOURCES) 68 DIST_SOURCES = $(fstream_test_SOURCES) $(vector_test_SOURCES) 69 ETAGS = etags 70 CTAGS = ctags 71 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 72 ACLOCAL = @ACLOCAL@ 73 ALLOCA = @ALLOCA@ 74 AMTAR = @AMTAR@ 75 AUTOCONF = @AUTOCONF@ 76 AUTOHEADER = @AUTOHEADER@ 77 AUTOMAKE = @AUTOMAKE@ 78 AWK = @AWK@ 79 BACKEND_CC = @BACKEND_CC@ 80 CC = @CFA_BINDIR@/cfa 81 CCDEPMODE = @CCDEPMODE@ 82 CFA_BINDIR = @CFA_BINDIR@ 83 CFA_INCDIR = @CFA_INCDIR@ 84 CFA_LIBDIR = @CFA_LIBDIR@ 85 CFA_PREFIX = @CFA_PREFIX@ 86 87 # applies to both programs 88 CFLAGS = -g -Wall -Wno-unused-function # TEMPORARY: does not build with -O2 89 CPP = @CPP@ 90 CPPFLAGS = @CPPFLAGS@ 91 CXX = @CXX@ 92 CXXDEPMODE = @CXXDEPMODE@ 93 CXXFLAGS = @CXXFLAGS@ 94 CYGPATH_W = @CYGPATH_W@ 95 DEFS = @DEFS@ 96 DEPDIR = @DEPDIR@ 97 ECHO_C = @ECHO_C@ 98 ECHO_N = @ECHO_N@ 99 ECHO_T = @ECHO_T@ 100 EGREP = @EGREP@ 101 EXEEXT = @EXEEXT@ 102 GCC_PATH = @GCC_PATH@ 103 GREP = @GREP@ 104 INSTALL = @INSTALL@ 105 INSTALL_DATA = @INSTALL_DATA@ 106 INSTALL_PROGRAM = @INSTALL_PROGRAM@ 107 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 108 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 109 LDFLAGS = @LDFLAGS@ 110 LEX = @LEX@ 111 LEXLIB = @LEXLIB@ 112 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ 113 LIBOBJS = @LIBOBJS@ 114 LIBS = @LIBS@ 115 LTLIBOBJS = @LTLIBOBJS@ 116 MAINT = @MAINT@ 117 MAKEINFO = @MAKEINFO@ 118 MKDIR_P = @MKDIR_P@ 119 OBJEXT = @OBJEXT@ 120 PACKAGE = @PACKAGE@ 121 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 122 PACKAGE_NAME = @PACKAGE_NAME@ 123 PACKAGE_STRING = @PACKAGE_STRING@ 124 PACKAGE_TARNAME = @PACKAGE_TARNAME@ 125 PACKAGE_URL = @PACKAGE_URL@ 126 PACKAGE_VERSION = @PACKAGE_VERSION@ 127 PATH_SEPARATOR = @PATH_SEPARATOR@ 128 RANLIB = @RANLIB@ 129 SET_MAKE = @SET_MAKE@ 130 SHELL = @SHELL@ 131 STRIP = @STRIP@ 132 VERSION = @VERSION@ 133 YACC = @YACC@ 134 YFLAGS = @YFLAGS@ 135 abs_builddir = @abs_builddir@ 136 abs_srcdir = @abs_srcdir@ 137 abs_top_builddir = @abs_top_builddir@ 138 abs_top_srcdir = @abs_top_srcdir@ 139 ac_ct_CC = @ac_ct_CC@ 140 ac_ct_CXX = @ac_ct_CXX@ 141 am__include = @am__include@ 142 am__leading_dot = @am__leading_dot@ 143 am__quote = @am__quote@ 144 am__tar = @am__tar@ 145 am__untar = @am__untar@ 146 bindir = @bindir@ 147 build_alias = @build_alias@ 148 builddir = @builddir@ 149 datadir = @datadir@ 150 datarootdir = @datarootdir@ 151 docdir = @docdir@ 152 dvidir = @dvidir@ 153 exec_prefix = @exec_prefix@ 154 host_alias = @host_alias@ 155 htmldir = @htmldir@ 156 includedir = @includedir@ 157 infodir = @infodir@ 158 install_sh = @install_sh@ 159 libdir = @libdir@ 160 libexecdir = @libexecdir@ 161 localedir = @localedir@ 162 localstatedir = @localstatedir@ 163 mandir = @mandir@ 164 mkdir_p = @mkdir_p@ 165 oldincludedir = @oldincludedir@ 166 pdfdir = @pdfdir@ 167 prefix = @prefix@ 168 program_transform_name = @program_transform_name@ 169 psdir = @psdir@ 170 sbindir = @sbindir@ 171 sharedstatedir = @sharedstatedir@ 172 srcdir = @srcdir@ 173 sysconfdir = @sysconfdir@ 174 target_alias = @target_alias@ 175 top_build_prefix = @top_build_prefix@ 176 top_builddir = @top_builddir@ 177 top_srcdir = @top_srcdir@ 178 fstream_test_SOURCES = iostream.c fstream.c fstream_test.c 179 vector_test_SOURCES = vector_int.c fstream.c iostream.c array.c iterator.c vector_test.c 180 all: all-am 181 182 .SUFFIXES: 183 .SUFFIXES: .c .o .obj 184 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 185 @for dep in $?; do \ 186 case '$(am__configure_deps)' in \ 187 *$$dep*) \ 188 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 189 && { if test -f $@; then exit 0; else break; fi; }; \ 190 exit 1;; \ 191 esac; \ 192 done; \ 193 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ 194 $(am__cd) $(top_srcdir) && \ 195 $(AUTOMAKE) --gnu src/examples/Makefile 196 .PRECIOUS: Makefile 197 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 198 @case '$?' in \ 199 *config.status*) \ 200 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 201 *) \ 202 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 203 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 204 esac; 205 206 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 207 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 208 209 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 210 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 211 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) 212 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 213 $(am__aclocal_m4_deps): 214 215 clean-noinstPROGRAMS: 216 -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) 217 fstream_test$(EXEEXT): $(fstream_test_OBJECTS) $(fstream_test_DEPENDENCIES) $(EXTRA_fstream_test_DEPENDENCIES) 218 @rm -f fstream_test$(EXEEXT) 219 $(LINK) $(fstream_test_OBJECTS) $(fstream_test_LDADD) $(LIBS) 220 vector_test$(EXEEXT): $(vector_test_OBJECTS) $(vector_test_DEPENDENCIES) $(EXTRA_vector_test_DEPENDENCIES) 221 @rm -f vector_test$(EXEEXT) 222 $(LINK) $(vector_test_OBJECTS) $(vector_test_LDADD) $(LIBS) 223 224 mostlyclean-compile: 225 -rm -f *.$(OBJEXT) 226 227 distclean-compile: 228 -rm -f *.tab.c 229 230 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 231 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream.Po@am__quote@ 232 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstream_test.Po@am__quote@ 233 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iostream.Po@am__quote@ 234 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Po@am__quote@ 235 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_int.Po@am__quote@ 236 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector_test.Po@am__quote@ 237 238 .c.o: 239 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 240 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 241 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 242 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 243 @am__fastdepCC_FALSE@ $(COMPILE) -c $< 244 245 .c.obj: 246 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 247 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 248 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 249 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 250 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 251 252 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 253 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 254 unique=`for i in $$list; do \ 255 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 256 done | \ 257 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 258 END { if (nonempty) { for (i in files) print i; }; }'`; \ 259 mkid -fID $$unique 260 tags: TAGS 261 262 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 263 $(TAGS_FILES) $(LISP) 264 set x; \ 265 here=`pwd`; \ 266 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 267 unique=`for i in $$list; do \ 268 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 269 done | \ 270 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 271 END { if (nonempty) { for (i in files) print i; }; }'`; \ 272 shift; \ 273 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 274 test -n "$$unique" || unique=$$empty_fix; \ 275 if test $$# -gt 0; then \ 276 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 277 "$$@" $$unique; \ 278 else \ 279 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 280 $$unique; \ 281 fi; \ 282 fi 283 ctags: CTAGS 284 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 285 $(TAGS_FILES) $(LISP) 286 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 287 unique=`for i in $$list; do \ 288 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 289 done | \ 290 $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 291 END { if (nonempty) { for (i in files) print i; }; }'`; \ 292 test -z "$(CTAGS_ARGS)$$unique" \ 293 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 294 $$unique 295 296 GTAGS: 297 here=`$(am__cd) $(top_builddir) && pwd` \ 298 && $(am__cd) $(top_srcdir) \ 299 && gtags -i $(GTAGS_ARGS) "$$here" 300 301 distclean-tags: 302 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 303 304 distdir: $(DISTFILES) 305 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 306 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 307 list='$(DISTFILES)'; \ 308 dist_files=`for file in $$list; do echo $$file; done | \ 309 sed -e "s|^$$srcdirstrip/||;t" \ 310 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 311 case $$dist_files in \ 312 */*) $(MKDIR_P) `echo "$$dist_files" | \ 313 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 314 sort -u` ;; \ 315 esac; \ 316 for file in $$dist_files; do \ 317 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 318 if test -d $$d/$$file; then \ 319 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 320 if test -d "$(distdir)/$$file"; then \ 321 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 322 fi; \ 323 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 324 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 325 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 326 fi; \ 327 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 328 else \ 329 test -f "$(distdir)/$$file" \ 330 || cp -p $$d/$$file "$(distdir)/$$file" \ 331 || exit 1; \ 332 fi; \ 333 done 334 check-am: all-am 335 check: check-am 336 all-am: Makefile $(PROGRAMS) 337 installdirs: 338 install: install-am 339 install-exec: install-exec-am 340 install-data: install-data-am 341 uninstall: uninstall-am 342 343 install-am: all-am 344 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 345 346 installcheck: installcheck-am 347 install-strip: 348 if test -z '$(STRIP)'; then \ 349 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 350 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 351 install; \ 352 else \ 353 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 354 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 355 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ 356 fi 357 mostlyclean-generic: 358 359 clean-generic: 360 361 distclean-generic: 362 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 363 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 364 365 maintainer-clean-generic: 366 @echo "This command is intended for maintainers to use" 367 @echo "it deletes files that may require special tools to rebuild." 368 clean: clean-am 369 370 clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am 371 372 distclean: distclean-am 373 -rm -rf ./$(DEPDIR) 374 -rm -f Makefile 375 distclean-am: clean-am distclean-compile distclean-generic \ 376 distclean-tags 377 378 dvi: dvi-am 379 380 dvi-am: 381 382 html: html-am 383 384 html-am: 385 386 info: info-am 387 388 info-am: 389 390 install-data-am: 391 392 install-dvi: install-dvi-am 393 394 install-dvi-am: 395 396 install-exec-am: 397 398 install-html: install-html-am 399 400 install-html-am: 401 402 install-info: install-info-am 403 404 install-info-am: 405 406 install-man: 407 408 install-pdf: install-pdf-am 409 410 install-pdf-am: 411 412 install-ps: install-ps-am 413 414 install-ps-am: 415 416 installcheck-am: 417 418 maintainer-clean: maintainer-clean-am 419 -rm -rf ./$(DEPDIR) 420 -rm -f Makefile 421 maintainer-clean-am: distclean-am maintainer-clean-generic 422 423 mostlyclean: mostlyclean-am 424 425 mostlyclean-am: mostlyclean-compile mostlyclean-generic 426 427 pdf: pdf-am 428 429 pdf-am: 430 431 ps: ps-am 432 433 ps-am: 434 435 uninstall-am: 436 437 .MAKE: install-am install-strip 438 439 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 440 clean-noinstPROGRAMS ctags distclean distclean-compile \ 441 distclean-generic distclean-tags distdir dvi dvi-am html \ 442 html-am info info-am install install-am install-data \ 443 install-data-am install-dvi install-dvi-am install-exec \ 444 install-exec-am install-html install-html-am install-info \ 445 install-info-am install-man install-pdf install-pdf-am \ 446 install-ps install-ps-am install-strip installcheck \ 447 installcheck-am installdirs maintainer-clean \ 448 maintainer-clean-generic mostlyclean mostlyclean-compile \ 449 mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ 450 uninstall-am 451 452 453 # Tell versions [3.59,3.63) of GNU make to not export all variables. 454 # Otherwise a system limit (for SysV at least) may be exceeded. 455 .NOEXPORT: -
src/examples/abstype.c
reb50842 r937e51d 1 // "cfa-cpp -nx Abstype.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // abstype.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:10:01 2015 13 // Update Count : 4 14 // 2 15 3 16 type T | { T x( T ); }; 4 17 5 18 T y( T t ) { 6 T t_instance;7 return x( t );19 T t_instance; 20 return x( t ); 8 21 } 9 22 … … 16 29 17 30 U x( U u ) { 18 U u_instance = u;19 (*u)++;20 return u;31 U u_instance = u; 32 (*u)++; 33 return u; 21 34 } 22 35 23 36 int *break_abstraction( U u ) { 24 return u;37 return u; 25 38 } 39 40 // Local Variables: // 41 // tab-width: 4 // 42 // compile-command: "cfa abstype.c" // 43 // End: // -
src/examples/array.c
reb50842 r937e51d 1 // "cfa -c -o array.o array.c" 2 // "cfa -CFA array.c > array_out.c" 3 // "gcc32 array_out.c ../LibCfa/libcfa.a" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // array.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:10:13 2015 13 // Update Count : 2 14 // 4 15 5 16 #include "array.h" … … 16 27 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 17 28 elt_type * begin( array_type array ) { 18 return &array[ 0 ];29 return &array[ 0 ]; 19 30 } 20 31 … … 22 33 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 23 34 elt_type * end( array_type array ) { 24 return &array[ last( array ) ] + 1;35 return &array[ last( array ) ] + 1; 25 36 } 37 38 // Local Variables: // 39 // tab-width: 4 // 40 // compile-command: "cfa array.c" // 41 // End: // -
src/examples/array.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // array.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:10:32 2015 13 // Update Count : 2 14 // 15 1 16 #ifndef ARRAY_H 2 17 #define ARRAY_H … … 7 22 // element has index 0. 8 23 context array( type array_type, type elt_type ) { 9 lvalue elt_type ?[?]( array_type, int );24 lvalue elt_type ?[?]( array_type, int ); 10 25 }; 11 26 12 27 // A bounded array is an array that carries its maximum index with it. 13 28 context bounded_array( type array_type, type elt_type | array( array_type, elt_type ) ) { 14 int last( array_type );29 int last( array_type ); 15 30 }; 16 31 … … 32 47 33 48 #endif // ARRAY_H 49 50 // Local Variables: // 51 // tab-width: 4 // 52 // compile-command: "cfa array.c" // 53 // End: // -
src/examples/constants.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // constants.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 20:44:48 2015 13 // Update Count : 75 14 // 15 1 16 int foo() { 2 1_234_Ul; 3 -0_177; 4 0x_ff_FF_ff_FF; 5 +9_223_372_036_854_775_807; 6 12.123_333_E_27; 7 0X_1.ff_ff_ff_ff_ff_fff_P_1023; 8 '\0'; 9 '\1_2_3'; 10 L_'\x_ff_ee'; 11 L"a_bc\u_00_40xyz\xff_AA"; 12 "a_bc\\ 13 u_00_40xyz"; 17 1_234_Ul; 18 -0_177; 19 017_777_777_777; 20 037_777_777_777; 21 0x_7f_FF_ff_FF; 22 0x_ff_FF_ff_FF; 23 2_147_483_647; 24 4_294_967_295; 25 4_294_967_296; 26 4_294_967_296U; 27 0_777_777_777_777_777_777_777; 28 01_777_777_777_777_777_777_777; 29 0; 30 0L; 31 0LL; 32 1; 33 1L; 34 1LL; 35 10; 36 10L; 37 10LL; 38 2U; 39 2UL; 40 2ULL; 41 2LU; 42 2LLU; 43 0x_7f_FF_ff_FF_ff_FF_ff_FF; 44 0x_ff_FF_ff_FF_ff_FF_ff_FF; 45 9_223_372_036_854_775_807; 46 18_446_744_073_709_551_615; 47 3.141_59f; 48 3.14159; 49 12.123_333_E_27L; 50 0X_1.ff_ff_ff_ff_ff_fff_P_1023; 51 '\0'; 52 '\1_2_3'; 53 L'\x_ff_ee'; 54 L_"\x_ff_ee"; 55 L"a_b\r\Qyc\u_00_40 x_y_z\xff_AA"; 56 L_"a_b\r\Qyc\u_00_40\ 57 x_y_z\xff_AA"; 58 "abc" "def" "ghi"; 14 59 } 15 60 16 61 // Local Variables: // 17 // compile-command: "../../bin/cfa -std=c99 constants.c" // 62 // tab-width: 4 // 63 // compile-command: "cfa constants.c" // 18 64 // End: // -
src/examples/control_structures.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // control_structures.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 4 14:02:50 2015 13 // Update Count : 24 14 // 15 1 16 int main() { 2 L1: { 3 L2: switch ( 3_333_333 ) { // underscores in constant 4 case 1,2,3: // 4~8, 4...8 not working 5 L3: for ( ;; ) { 6 L4: for ( ;; ) { 7 break L1; // labelled break 8 break L2; 9 break L3; 10 break L4; 11 #if 0 12 continue L1; // labelled continue 13 continue L2; 14 continue L3; 15 continue L4; 16 #endif 17 } // for 18 } // for 19 break; 20 default: 21 break L1; 22 } // switch 23 3; 24 int i, j; 25 choose ( 7 ) { 26 case 1,2,3: 27 i = 3; 28 fallthru; 29 case 4,5,6: 30 j = 3; 31 default: ; 32 } // choose 33 } // block 17 L1: { 18 L2: switch ( 3_333_333 ) { // underscores in constant 19 case 1,2,3: // CFA 20 case 4~8: // CFA 21 case 9 ... 10: // gcc, must have spaces 22 L3: for ( ;; ) { 23 L4: for ( ;; ) { 24 break L1; // labelled break 25 break L2; 26 break L3; 27 break L4; 28 //continue L1; // labelled continue - should be an error 29 //continue L2; // should be an error 30 continue L3; 31 continue L4; 32 } // for 33 } // for 34 break; 35 default: 36 break L1; 37 } // switch 38 3; 39 int i, j; 40 choose ( 7 ) { 41 case 1,2,3: 42 i = 3; 43 4; 44 fallthru; 45 case 4,5,6: 46 j = 3; 47 default: ; 48 } // choose 49 } // block 34 50 35 51 #if 0 36 try {37 int i = 3;38 } catch( int ) {39 } catch( double ) {40 } catch( ... ) {41 } finally {42 } // try52 try { 53 int i = 3; 54 } catch( int ) { 55 } catch( double ) { 56 } catch( ... ) { 57 } finally { 58 } // try 43 59 #endif 44 60 … … 46 62 47 63 // Local Variables: // 48 // compile-command: "../../bin/cfa control_structures.c" // 64 // tab-width: 4 // 65 // compile-command: "cfa control_structures.c" // 49 66 // End: // -
src/examples/ctxts.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // ctxts.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:11:19 2015 13 // Update Count : 2 14 // 15 1 16 context has_f( type T ) { 2 T f( T );17 T f( T ); 3 18 }; 4 19 5 20 context has_g( type U | has_f( U ) ) { 6 U g( U );21 U g( U ); 7 22 }; 8 23 9 24 forall( type V | has_g( V ) ) void h( V ); 25 26 // Local Variables: // 27 // tab-width: 4 // 28 // compile-command: "cfa ctxts.c" // 29 // End: // -
src/examples/esskaykay.c
reb50842 r937e51d 1 // "./cfa-cpp -cn esskaykay.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // esskaykay.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:11:45 2015 13 // Update Count : 2 14 // 2 15 3 16 // forall (type A, type B, type C) C ess (C (*f) (A,B), B (*g) (A), A x) { return f(x,g(x)); } … … 10 23 11 24 forall (type A) A esskaykay (A x) { ess (kay, kay, x); } 25 26 // Local Variables: // 27 // tab-width: 4 // 28 // compile-command: "cfa esskaykay.c" // 29 // End: // -
src/examples/forward.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // forward.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:11:57 2015 13 // Update Count : 2 14 // 15 1 16 forall(type T) lvalue T *?( T* ); 2 17 int ?=?( int*, int ); … … 6 21 7 22 void f() { 8 *x;23 *x; 9 24 } 10 25 11 26 // Local Variables: // 12 // compile-command: "../../bin/cfa forward.c" // 27 // tab-width: 4 // 28 // compile-command: "cfa forward.c" // 13 29 // End: // -
src/examples/fstream.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fstream.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:12:33 2015 13 // Update Count : 2 14 // 15 1 16 #include "fstream.h" 2 17 … … 7 22 8 23 struct ofstream { 9 FILE *file;10 int fail;24 FILE *file; 25 int fail; 11 26 }; 12 27 13 28 ofstream *write( ofstream *os, const char *data, streamsize_type size ) { 14 if ( ! os->fail ) {15 fwrite( data, size, 1, os->file );16 os->fail = ferror( os->file );17 }18 return os;29 if ( ! os->fail ) { 30 fwrite( data, size, 1, os->file ); 31 os->fail = ferror( os->file ); 32 } 33 return os; 19 34 } 20 35 21 36 int fail( ofstream *os ) { 22 return os->fail;37 return os->fail; 23 38 } 24 39 25 40 static ofstream *make_ofstream() { 26 ofstream *new_stream = malloc( sizeof( ofstream ) );27 new_stream->fail = 0;28 return new_stream;41 ofstream *new_stream = malloc( sizeof( ofstream ) ); 42 new_stream->fail = 0; 43 return new_stream; 29 44 } 30 45 31 46 ofstream *ofstream_stdout() { 32 ofstream *stdout_stream = make_ofstream();33 stdout_stream->file = stdout;34 return stdout_stream;47 ofstream *stdout_stream = make_ofstream(); 48 stdout_stream->file = stdout; 49 return stdout_stream; 35 50 } 36 51 37 52 ofstream *ofstream_stderr() { 38 ofstream *stderr_stream = make_ofstream();39 stderr_stream->file = stderr;40 return stderr_stream;53 ofstream *stderr_stream = make_ofstream(); 54 stderr_stream->file = stderr; 55 return stderr_stream; 41 56 } 42 57 43 58 ofstream *ofstream_fromfile( const char *name ) { 44 ofstream *file_stream = make_ofstream();45 file_stream->file = fopen( name, "w" );46 file_stream->fail = file_stream->file == 0;47 return file_stream;59 ofstream *file_stream = make_ofstream(); 60 file_stream->file = fopen( name, "w" ); 61 file_stream->fail = file_stream->file == 0; 62 return file_stream; 48 63 } 49 64 50 65 void ofstream_close( ofstream *os ) { 51 if ( os->file != stdout && os->file != stderr ) {52 os->fail = fclose( os->file );53 }54 free( os );66 if ( os->file != stdout && os->file != stderr ) { 67 os->fail = fclose( os->file ); 68 } 69 free( os ); 55 70 } 56 71 57 72 struct ifstream { 58 FILE *file;59 int fail;60 int eof;73 FILE *file; 74 int fail; 75 int eof; 61 76 }; 62 77 63 78 ifstream *read( ifstream *is, char *data, streamsize_type size ) { 64 if ( ! is->fail && ! is->eof ) {65 fread( data, size, 1, is->file );66 is->fail = ferror( is->file );67 is->eof = feof( is->file );68 }69 return is;79 if ( ! is->fail && ! is->eof ) { 80 fread( data, size, 1, is->file ); 81 is->fail = ferror( is->file ); 82 is->eof = feof( is->file ); 83 } 84 return is; 70 85 } 71 86 72 87 ifstream *unread( ifstream *is, char c ) { 73 if ( ! is->fail ) { 74 if ( ! EOF == ungetc( c, is->file ) ) { 75 is->fail = 1; 88 if ( ! is->fail ) { 89 if ( ! EOF == ungetc( c, is->file ) ) { 90 is->fail = 1; 91 } 76 92 } 77 } 78 return is; 93 return is; 79 94 } 80 95 81 96 int fail( ifstream *is ) { 82 return is->fail;97 return is->fail; 83 98 } 84 99 85 100 int eof( ifstream *is ) { 86 return is->eof;101 return is->eof; 87 102 } 88 103 89 104 static ifstream *make_ifstream() { 90 ifstream *new_stream = malloc( sizeof( ifstream ) );91 new_stream->fail = 0;92 new_stream->eof = 0;93 return new_stream;105 ifstream *new_stream = malloc( sizeof( ifstream ) ); 106 new_stream->fail = 0; 107 new_stream->eof = 0; 108 return new_stream; 94 109 } 95 110 96 111 ifstream *ifstream_stdin() { 97 ifstream *stdin_stream = make_ifstream();98 stdin_stream->file = stdin;99 return stdin_stream;112 ifstream *stdin_stream = make_ifstream(); 113 stdin_stream->file = stdin; 114 return stdin_stream; 100 115 } 101 116 102 117 ifstream *ifstream_fromfile( const char *name ) { 103 ifstream *file_stream = make_ifstream();104 file_stream->file = fopen( name, "r" );105 file_stream->fail = file_stream->file == 0;106 return file_stream;118 ifstream *file_stream = make_ifstream(); 119 file_stream->file = fopen( name, "r" ); 120 file_stream->fail = file_stream->file == 0; 121 return file_stream; 107 122 } 123 124 // Local Variables: // 125 // tab-width: 4 // 126 // compile-command: "cfa fstream.c" // 127 // End: // -
src/examples/fstream.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fstream.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:13:08 2015 13 // Update Count : 1 14 // 15 1 16 #ifndef __FSTREAM_H__ 2 17 #define __FSTREAM_H__ … … 27 42 28 43 #endif // __FSTREAM_H__ 44 45 // Local Variables: // 46 // tab-width: 4 // 47 // compile-command: "cfa fstream.c" // 48 // End: // -
src/examples/fstream_test.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fstream_test.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:13:43 2015 13 // Update Count : 2 14 // 15 1 16 #include "fstream.h" 2 17 3 18 int main() { 4 ofstream *sout = ofstream_stdout();5 ifstream *sin = ifstream_stdin();6 int nombre;7 sout << "Appuyez un nombre, s'il vous plâit:\n";8 sin >> &nombre;9 sout << "Vous avez appuyé: " << nombre << "\n";19 ofstream *sout = ofstream_stdout(); 20 ifstream *sin = ifstream_stdin(); 21 int nombre; 22 sout << "Appuyez un nombre, s'il vous plâit:\n"; 23 sin >> &nombre; 24 sout << "Vous avez appuyé: " << nombre << "\n"; 10 25 } 26 27 // Local Variables: // 28 // tab-width: 4 // 29 // compile-command: "cfa fstream_test.c" // 30 // End: // -
src/examples/fwrite.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // fwrite.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:14:12 2015 13 // Update Count : 1 14 // 15 1 16 extern "C" { 2 #include <stdio.h>17 #include <stdio.h> 3 18 } 4 19 5 20 int main() { 6 fwrite( "test\n", 5, 1, stdout );21 fwrite( "test\n", 5, 1, stdout ); 7 22 } 23 24 // Local Variables: // 25 // tab-width: 4 // 26 // compile-command: "cfa fwrite.c" // 27 // End: // -
src/examples/hello.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // hello.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:14:58 2015 13 // Update Count : 1 14 // 15 1 16 #include "fstream.h" 2 17 3 18 int main() { 4 ofstream *sout = ofstream_stdout();5 ifstream *sin = ifstream_stdin();6 sout << "Bonjour au monde!\n";7 sout << 3 << " " << 3.5 << " " << 'a' << " " << "abc" << "\n";8 int i, j, k;9 sin >> &i >> &j >> &k;10 sout << "i:" << i << " j:" << j << " k:" << k << "\n";19 ofstream *sout = ofstream_stdout(); 20 ifstream *sin = ifstream_stdin(); 21 sout << "Bonjour au monde!\n"; 22 sout << 3 << " " << 3.5 << " " << 'a' << " " << "abc" << "\n"; 23 int i, j, k; 24 sin >> &i >> &j >> &k; 25 sout << "i:" << i << " j:" << j << " k:" << k << "\n"; 11 26 } 12 27 13 28 // Local Variables: // 14 // compile-command: "../../bin/cfa hello.c fstream.o iostream.o" // 29 // tab-width: 4 // 30 // compile-command: "cfa hello.c fstream.o iostream.o" // 15 31 // End: // -
src/examples/huge.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // huge.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:15:34 2015 13 // Update Count : 1 14 // 15 1 16 int huge( int n, forall( type T ) T (*f)( T ) ) { 2 if ( n <= 0 )3 return f( 0 );4 else5 return huge( n - 1, f( f ) );17 if ( n <= 0 ) 18 return f( 0 ); 19 else 20 return huge( n - 1, f( f ) ); 6 21 } 22 23 // Local Variables: // 24 // tab-width: 4 // 25 // compile-command: "cfa huge.c" // 26 // End: // -
src/examples/identity.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // identity.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:16:30 2015 13 // Update Count : 2 14 // 15 1 16 #include "fstream.h" 2 17 3 18 forall( type T ) 4 19 T identity( T t ) { 5 return t;20 return t; 6 21 } 7 22 8 23 int main() { 9 ofstream *sout = ofstream_stdout();10 char c = 'a';11 c = identity( c );12 sout << c << ' ' << identity( c ) << '\n';13 int i = 5;14 i = identity( i );15 sout << i << ' ' << identity( i ) << '\n';16 double d = 3.2;17 d = identity( d );18 sout << d << ' ' << identity( d ) << '\n';24 ofstream *sout = ofstream_stdout(); 25 char c = 'a'; 26 c = identity( c ); 27 sout << c << ' ' << identity( c ) << '\n'; 28 int i = 5; 29 i = identity( i ); 30 sout << i << ' ' << identity( i ) << '\n'; 31 double d = 3.2; 32 d = identity( d ); 33 sout << d << ' ' << identity( d ) << '\n'; 19 34 } 20 35 21 36 // Local Variables: // 22 // compile-command: "../../bin/cfa identity.c fstream.o iostream.o" // 37 // tab-width: 4 // 38 // compile-command: "cfa identity.c fstream.o iostream.o" // 23 39 // End: // -
src/examples/includes.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // includes.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 15:54:17 2015 13 // Update Count : 7 14 // 15 1 16 #if 1 2 17 //#include <aio.h> // FAILS -- includes locale.h … … 34 49 #include <curses.h> 35 50 #else 36 #include < time.h> // FAILS -- includes locale.h51 #include <curses.h> 37 52 #endif // 0 38 53 39 54 // Local Variables: // 40 // compile-command: "../../bin/cfa includes.c" // 55 // tab-width: 4 // 56 // compile-command: "cfa includes.c" // 41 57 // End: // -
src/examples/index.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // index.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:17:31 2015 13 // Update Count : 1 14 // 15 1 16 context index( type T ) { 2 T ?+?( T, T );3 T ?-?( T, T );4 const T 0, 1;17 T ?+?( T, T ); 18 T ?-?( T, T ); 19 const T 0, 1; 5 20 }; 21 22 // Local Variables: // 23 // tab-width: 4 // 24 // compile-command: "cfa index.c" // 25 // End: // -
src/examples/iostream.c
reb50842 r937e51d 1 // "cfa -c -o iostream.o iostream.c" 2 // "cfa -v -E iostream.c > iostream_out.c" 3 // "cfa -CFA iostream.c > iostream_out.c" 4 // "cfa iostream_out.c" 5 // "gcc32 iostream_out.c LibCfa/libcfa.a" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // iostream.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:18:13 2015 13 // Update Count : 2 14 // 6 15 7 16 #include "iostream.h" … … 10 19 //#include <string.h> 11 20 //#include <ctype.h> 12 typedef long unsigned int size_t;13 size_t strlen(const char *s);21 typedef long unsigned int size_t; 22 size_t strlen(const char *s); 14 23 } 15 24 16 25 forall( dtype ostype | ostream( ostype ) ) 17 26 ostype * ?<<?( ostype *os, char c ) { 18 return write( os, &c, 1 );27 return write( os, &c, 1 ); 19 28 } 20 29 21 30 forall( dtype ostype | ostream( ostype ) ) 22 31 ostype * ?<<?( ostype *os, int i ) { 23 char buffer[20]; // larger than the largest integer24 sprintf( buffer, "%d", i );25 return write( os, buffer, strlen( buffer ) );32 char buffer[20]; // larger than the largest integer 33 sprintf( buffer, "%d", i ); 34 return write( os, buffer, strlen( buffer ) ); 26 35 } 27 36 28 37 forall( dtype ostype | ostream( ostype ) ) 29 38 ostype * ?<<?( ostype *os, double d ) { 30 char buffer[32]; // larger than the largest double31 sprintf( buffer, "%g", d );32 return write( os, buffer, strlen( buffer ) );39 char buffer[32]; // larger than the largest double 40 sprintf( buffer, "%g", d ); 41 return write( os, buffer, strlen( buffer ) ); 33 42 } 34 43 35 44 forall( dtype ostype | ostream( ostype ) ) 36 45 ostype * ?<<?( ostype *os, const char *cp ) { 37 return write( os, cp, strlen( cp ) );46 return write( os, cp, strlen( cp ) ); 38 47 } 39 48 40 49 forall( dtype istype | istream( istype ) ) 41 50 istype * ?>>?( istype *is, char *cp ) { 42 return read( is, cp, 1 );51 return read( is, cp, 1 ); 43 52 } 44 53 45 54 forall( dtype istype | istream( istype ) ) 46 55 istype * ?>>?( istype *is, int *ip ) { 47 char cur;56 char cur; 48 57 49 // skip some whitespace50 do {51 is >> &cur;52 if ( fail( is ) || eof( is ) ) return is;53 } while ( !( cur >= '0' && cur <= '9' ) );58 // skip some whitespace 59 do { 60 is >> &cur; 61 if ( fail( is ) || eof( is ) ) return is; 62 } while ( !( cur >= '0' && cur <= '9' ) ); 54 63 55 // accumulate digits56 *ip = 0;57 while ( cur >= '0' && cur <= '9' ) {58 *ip = *ip * 10 + ( cur - '0' );59 is >> &cur;60 if ( fail( is ) || eof( is ) ) return is;61 }64 // accumulate digits 65 *ip = 0; 66 while ( cur >= '0' && cur <= '9' ) { 67 *ip = *ip * 10 + ( cur - '0' ); 68 is >> &cur; 69 if ( fail( is ) || eof( is ) ) return is; 70 } 62 71 63 unread( is, cur );64 return is;72 unread( is, cur ); 73 return is; 65 74 } 75 76 // Local Variables: // 77 // tab-width: 4 // 78 // compile-command: "cfa iostream.c" // 79 // End: // -
src/examples/iostream.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // iostream.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:18:46 2015 13 // Update Count : 1 14 // 15 1 16 #ifndef IOSTREAM_H 2 17 #define IOSTREAM_H … … 5 20 6 21 context ostream( dtype ostype ) { 7 ostype *write( ostype *, const char *, streamsize_type );8 int fail( ostype * );22 ostype *write( ostype *, const char *, streamsize_type ); 23 int fail( ostype * ); 9 24 }; 10 25 11 26 context writeable( type T ) { 12 forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, T );27 forall( dtype ostype | ostream( ostype ) ) ostype * ?<<?( ostype *, T ); 13 28 }; 14 29 … … 22 37 23 38 context istream( dtype istype ) { 24 istype *read( istype *, char *, streamsize_type );25 istype *unread( istype *, char );26 int fail( istype * );27 int eof( istype * );39 istype *read( istype *, char *, streamsize_type ); 40 istype *unread( istype *, char ); 41 int fail( istype * ); 42 int eof( istype * ); 28 43 }; 29 44 30 45 context readable( type T ) { 31 forall( dtype istype | istream( istype ) ) istype * ?<<?( istype *, T );46 forall( dtype istype | istream( istype ) ) istype * ?<<?( istype *, T ); 32 47 }; 33 48 … … 39 54 40 55 #endif // IOSTREAM_H 56 57 // Local Variables: // 58 // tab-width: 4 // 59 // compile-command: "cfa iostream.c" // 60 // End: // -
src/examples/it_out.c
reb50842 r937e51d 1 # 1 "iterator.c" 2 # 1 "<built-in>" 3 # 1 "<command line>" 4 # 1 "iterator.c" 5 # 1 "iterator.h" 1 6 7 8 9 # 1 "iostream.h" 1 10 11 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // it_out.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:41:23 2015 13 // Update Count : 4 14 // 12 15 13 16 typedef unsigned long streamsize_type; 14 17 15 16 17 context ostream( dtype os_type ) 18 { 19 20 os_type *write( os_type *, const char *, streamsize_type ); 21 22 23 int fail( os_type * ); 18 context ostream( dtype os_type ) { 19 os_type *write( os_type *, const char *, streamsize_type ); 20 int fail( os_type * ); 24 21 }; 25 22 26 27 28 29 context writeable( type T ) 30 { 31 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T ); 23 context writeable( type T ) { 24 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T ); 32 25 }; 33 34 35 26 36 27 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, char ); … … 38 29 forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, const char * ); 39 30 40 41 42 43 context istream( dtype is_type ) 44 { 45 46 is_type *read( is_type *, char *, streamsize_type ); 47 48 49 is_type *unread( is_type *, char ); 50 51 52 int fail( is_type * ); 53 54 55 int eof( is_type * ); 31 context istream( dtype is_type ) { 32 is_type *read( is_type *, char *, streamsize_type ); 33 is_type *unread( is_type *, char ); 34 int fail( is_type * ); 35 int eof( is_type * ); 56 36 }; 57 37 58 59 60 61 context readable( type T ) 62 { 63 forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T ); 38 context readable( type T ) { 39 forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T ); 64 40 }; 65 66 67 41 68 42 forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, char* ); 69 43 forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, int* ); 70 # 5 "iterator.h" 271 44 45 context iterator( type iterator_type, type elt_type ) { 46 iterator_type ?++( iterator_type* ); 47 iterator_type ++?( iterator_type* ); 48 int ?==?( iterator_type, iterator_type ); 49 int ?!=?( iterator_type, iterator_type ); 72 50 73 context iterator( type iterator_type, type elt_type ) 74 { 75 76 iterator_type ?++( iterator_type* ); 77 iterator_type ++?( iterator_type* ); 78 79 80 int ?==?( iterator_type, iterator_type ); 81 int ?!=?( iterator_type, iterator_type ); 82 83 84 lvalue elt_type *?( iterator_type ); 51 lvalue elt_type *?( iterator_type ); 85 52 }; 86 53 87 54 forall( type elt_type | writeable( elt_type ), 55 type iterator_type | iterator( iterator_type, elt_type ), 56 dtype os_type | ostream( os_type ) ) 57 void write_all( iterator_type begin, iterator_type end, os_type *os ); 88 58 89 59 forall( type elt_type | writeable( elt_type ), 90 type iterator_type | iterator( iterator_type, elt_type ), 91 dtype os_type | ostream( os_type ) ) 92 void write_all( iterator_type begin, iterator_type end, os_type *os ); 93 # 2 "iterator.c" 2 60 type iterator_type | iterator( iterator_type, elt_type ), 61 dtype os_type | ostream( os_type ) ) 62 void write_all( elt_type begin, iterator_type end, os_type *os ) { 63 os << begin; 64 } 94 65 95 forall( type elt_type | writeable( elt_type ), 96 type iterator_type | iterator( iterator_type, elt_type ), 97 dtype os_type | ostream( os_type ) ) 98 void 99 write_all( elt_type begin, iterator_type end, os_type *os ) 100 { 101 os << begin; 102 } 66 // Local Variables: // 67 // tab-width: 4 // 68 // compile-command: "cfa it_out.c" // 69 // End: // -
src/examples/iterator.c
reb50842 r937e51d 1 // "cfa iterator.c" 2 // "cfa -CFA iterator.c > iterator_out.c" 3 // "gcc31 iterator_out.c ../LibCfa/libcfa.a" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // iterator.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:41:41 2015 13 // Update Count : 3 14 // 4 15 5 16 #include "iterator.h" … … 11 22 /// iterator_type i; 12 23 /// for ( i = begin; i != end; ++i ) { 13 /// func( *i );24 /// func( *i ); 14 25 /// } 15 26 /// } 16 27 17 28 forall( type elt_type | writeable( elt_type ), 18 type iterator_type | iterator( iterator_type, elt_type ),19 dtype os_type | ostream( os_type ) )29 type iterator_type | iterator( iterator_type, elt_type ), 30 dtype os_type | ostream( os_type ) ) 20 31 void write_all( iterator_type begin, iterator_type end, os_type *os ) { 21 iterator_type i;22 for ( i = begin; i != end; ++i ) {23 os << *i << ' ';24 }32 iterator_type i; 33 for ( i = begin; i != end; ++i ) { 34 os << *i << ' '; 35 } 25 36 } 26 37 27 38 forall( type elt_type | writeable( elt_type ), 28 type iterator_type | iterator( iterator_type, elt_type ),29 dtype os_type | ostream( os_type ) )39 type iterator_type | iterator( iterator_type, elt_type ), 40 dtype os_type | ostream( os_type ) ) 30 41 void write_reverse( iterator_type begin, iterator_type end, os_type *os ) { 31 iterator_type i; // "= end;" does not work32 i = end;33 do {34 --i;35 os << *i << ' ';36 } while ( i != begin );42 iterator_type i; // "= end;" does not work 43 i = end; 44 do { 45 --i; 46 os << *i << ' '; 47 } while ( i != begin ); 37 48 } 49 50 // Local Variables: // 51 // tab-width: 4 // 52 // compile-command: "cfa iterator.c" // 53 // End: // -
src/examples/iterator.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // iterator.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:41:57 2015 13 // Update Count : 3 14 // 15 1 16 #ifndef ITERATOR_H 2 17 #define ITERATOR_H … … 6 21 // An iterator can be used to traverse a data structure. 7 22 context iterator( type iterator_type, type elt_type ) { 8 // point to the next element9 // iterator_type ?++( iterator_type * );10 iterator_type ++?( iterator_type * );11 iterator_type --?( iterator_type * );23 // point to the next element 24 // iterator_type ?++( iterator_type * ); 25 iterator_type ++?( iterator_type * ); 26 iterator_type --?( iterator_type * ); 12 27 13 // can be tested for equality with other iterators14 int ?==?( iterator_type, iterator_type );15 int ?!=?( iterator_type, iterator_type );28 // can be tested for equality with other iterators 29 int ?==?( iterator_type, iterator_type ); 30 int ?!=?( iterator_type, iterator_type ); 16 31 17 // dereference to get the pointed-at element18 lvalue elt_type *?( iterator_type );32 // dereference to get the pointed-at element 33 lvalue elt_type *?( iterator_type ); 19 34 }; 20 35 21 36 context iterator_for ( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) { 22 // [ iterator_type begin, iterator_type end ] get_iterators( collection_type );23 iterator_type begin( collection_type );24 iterator_type end( collection_type );37 // [ iterator_type begin, iterator_type end ] get_iterators( collection_type ); 38 iterator_type begin( collection_type ); 39 iterator_type end( collection_type ); 25 40 }; 26 41 … … 30 45 // writes the range [begin, end) to the given stream 31 46 forall( type elt_type | writeable( elt_type ), 32 type iterator_type | iterator( iterator_type, elt_type ),33 dtype os_type | ostream( os_type ) )47 type iterator_type | iterator( iterator_type, elt_type ), 48 dtype os_type | ostream( os_type ) ) 34 49 void write_all( iterator_type begin, iterator_type end, os_type *os ); 35 50 36 51 forall( type elt_type | writeable( elt_type ), 37 type iterator_type | iterator( iterator_type, elt_type ),38 dtype os_type | ostream( os_type ) )52 type iterator_type | iterator( iterator_type, elt_type ), 53 dtype os_type | ostream( os_type ) ) 39 54 void write_reverse( iterator_type begin, iterator_type end, os_type *os ); 40 55 41 56 #endif // ITERATOR_H 57 58 // Local Variables: // 59 // tab-width: 4 // 60 // compile-command: "cfa iterator.c" // 61 // End: // -
src/examples/min.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // min.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:23:19 2015 13 // Update Count : 2 14 // 15 1 16 extern "C" { 2 int printf( const char *, ... );17 int printf( const char *, ... ); 3 18 //#include <stdio.h> 4 19 } … … 6 21 forall( type T | { int ?<?( T, T ); } ) 7 22 T min( const T t1, const T t2 ) { 8 return t1 < t2 ? t1 : t2;23 return t1 < t2 ? t1 : t2; 9 24 } 10 25 11 26 int main() { 12 char c;13 // c = min( 'z', 'a' );14 // printf( "minimum %d\n", c );15 int i;16 i = min( 4, 3 );17 printf( "minimum %d\n", min( 4, 3 ) );18 float f;19 f = min( 4.0, 3.1 );20 printf( "minimum %g\n", f );21 double d;22 d = min( 4.0, 3.2 );23 printf( "minimum %g\n", d );27 char c; 28 // c = min( 'z', 'a' ); 29 // printf( "minimum %d\n", c ); 30 int i; 31 i = min( 4, 3 ); 32 printf( "minimum %d\n", min( 4, 3 ) ); 33 float f; 34 f = min( 4.0, 3.1 ); 35 printf( "minimum %g\n", f ); 36 double d; 37 d = min( 4.0, 3.2 ); 38 printf( "minimum %g\n", d ); 24 39 } 25 40 26 41 // Local Variables: // 27 // compile-command: "../../bin/cfa min.c" // 42 // tab-width: 4 // 43 // compile-command: "cfa min.c" // 28 44 // End: // -
src/examples/new.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // new.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:23:55 2015 13 // Update Count : 1 14 // 15 1 16 forall( type T ) 2 17 void f( T *t ) { 3 t--;4 *t;5 ++t;6 t += 2;7 t + 2;8 --t;9 t -= 2;10 t - 4;11 t[7];12 7[t];18 t--; 19 *t; 20 ++t; 21 t += 2; 22 t + 2; 23 --t; 24 t -= 2; 25 t - 4; 26 t[7]; 27 7[t]; 13 28 } 29 30 // Local Variables: // 31 // tab-width: 4 // 32 // compile-command: "cfa new.c" // 33 // End: // -
src/examples/prolog.c
reb50842 r937e51d 1 // "./cfa prolog.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // prolog.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:25:52 2015 13 // Update Count : 1 14 // 2 15 3 16 extern "C" { extern int printf( const char *fmt, ... ); } … … 13 26 14 27 context ArithmeticType( type T ) { 15 void is_arithmetic( T );28 void is_arithmetic( T ); 16 29 }; 17 30 18 31 context IntegralType( type T | ArithmeticType( T ) ) { 19 void is_integer( T );32 void is_integer( T ); 20 33 }; 21 34 22 35 forall( type T | IntegralType( T ) | { void printResult( T ); } ) 23 36 void hornclause( T param ) { 24 printResult( param );37 printResult( param ); 25 38 } 26 39 27 40 int main() { 28 int x;29 double x;30 char * x;31 hornclause( x );41 int x; 42 double x; 43 char * x; 44 hornclause( x ); 32 45 } 46 47 // Local Variables: // 48 // tab-width: 4 // 49 // compile-command: "cfa prolog.c" // 50 // End: // -
src/examples/quad.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // quad.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:26:36 2015 13 // Update Count : 2 14 // 15 1 16 extern "C" { 2 #include <stdio.h>17 #include <stdio.h> 3 18 } 4 19 5 20 forall( type T | { T ?*?( T, T ); } ) 6 21 T square( T t ) { 7 return t * t;22 return t * t; 8 23 } 9 24 10 25 forall( type U | { U square( U ); } ) 11 26 U quad( U u ) { 12 return square( square( u ) );27 return square( square( u ) ); 13 28 } 14 29 15 30 int main() { 16 int N = 2;17 printf( "result of quad of %d is %d\n", N, quad( N ) );31 int N = 2; 32 printf( "result of quad of %d is %d\n", N, quad( N ) ); 18 33 } 19 34 20 35 // Local Variables: // 21 // compile-command: "../../bin/cfa quad.c" // 36 // tab-width: 4 // 37 // compile-command: "cfa quad.c" // 22 38 // End: // -
src/examples/quoted_keyword.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // quoted_keyword.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:27:26 2015 13 // Update Count : 2 14 // 15 1 16 // test quoted keyword usage 2 17 int `catch`; 3 18 4 19 struct { 5 int `type`;6 int `struct`;20 int `type`; 21 int `struct`; 7 22 } st; 8 23 … … 11 26 12 27 int foo() { 13 int w = `catch` + st.`type` + st.`struct` + `throw`;28 int w = `catch` + st.`type` + st.`struct` + `throw`; 14 29 } 15 30 … … 17 32 18 33 // Local Variables: // 19 // compile-command: "../../bin/cfa quoted_keyword.c" // 34 // tab-width: 4 // 35 // compile-command: "cfa quoted_keyword.c" // 20 36 // End: // -
src/examples/s.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // s.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:42:39 2015 13 // Update Count : 2 14 // 15 1 16 //int ?!=?( int, int ); 2 17 3 18 void f() { 4 // int a;5 // a ? 4 : 5;6 1 ? 4 : 5;7 0 ? 4 : 5;19 // int a; 20 // a ? 4 : 5; 21 1 ? 4 : 5; 22 0 ? 4 : 5; 8 23 } 24 25 // Local Variables: // 26 // tab-width: 4 // 27 // compile-command: "cfa s.c" // 28 // End: // -
src/examples/simple.c
reb50842 r937e51d 1 // './cfa square.c' 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // simple.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:30:27 2015 13 // Update Count : 3 14 // 2 15 3 16 extern "C" { 4 int printf( const char *fmt, ... );17 int printf( const char *fmt, ... ); 5 18 } 6 19 7 20 context has_star( type T ) { 8 T ?*?( T, T );21 T ?*?( T, T ); 9 22 }; 10 23 11 24 int ?*?( int, int ); 12 int ?=?( int *, int );25 int ?=?( int *, int ); 13 26 14 27 forall( type T | has_star( T ) ) 15 28 T square( T t ) { 16 return t * t;29 return t * t; 17 30 } 18 31 19 32 int main() { 20 printf( "result of square of 5 is %d\n", square( 5 ) );33 printf( "result of square of 5 is %d\n", square( 5 ) ); 21 34 } 35 36 // Local Variables: // 37 // tab-width: 4 // 38 // compile-command: "cfa simple.c" // 39 // End: // -
src/examples/simplePoly.c
reb50842 r937e51d 1 // './cfa-cpp -nc < simplePoly.c' 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // simplePoly.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:31:17 2015 13 // Update Count : 2 14 // 2 15 3 16 forall( type T, type U | { T f( T, U ); } ) 4 T q( T t, U u ) 5 { 6 return f( t, u ); 17 T q( T t, U u ) { 18 return f( t, u ); 7 19 // return t; 8 20 } … … 11 23 12 24 void g( void ) { 13 int y;14 double x;25 int y; 26 double x; 15 27 // if ( y ) 16 q( 3, &x );28 q( 3, &x ); 17 29 } 30 31 // Local Variables: // 32 // tab-width: 4 // 33 // compile-command: "cfa simplePoly.c" // 34 // End: // -
src/examples/simpler.c
reb50842 r937e51d 1 // "./cfa-cpp -c simpler.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // simpler.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:31:48 2015 13 // Update Count : 1 14 // 2 15 3 16 forall( type T ) T id( T, T ); 4 17 5 18 int main() { 6 id( 0, 7 );19 id( 0, 7 ); 7 20 } 21 22 // Local Variables: // 23 // tab-width: 4 // 24 // compile-command: "cfa simpler.c" // 25 // End: // -
src/examples/specialize.c
reb50842 r937e51d 1 // "./cfa specialize.c" 2 // "./cfa -g simple.c" 3 // "./cfa -CFA simple.c > simple_out.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // specialize.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:32:26 2015 13 // Update Count : 2 14 // 4 15 5 16 /// void f( const int * ); … … 25 36 26 37 extern "C" { 27 int printf( const char*, ... );38 int printf( const char*, ... ); 28 39 } 29 40 30 41 forall( type T ) T f( T t ) 31 42 { 32 printf( "in f; sizeof T is %d\n", sizeof( T ) );33 return t;43 printf( "in f; sizeof T is %d\n", sizeof( T ) ); 44 return t; 34 45 } 35 46 36 47 void g( int (*p)(int) ) 37 48 { 38 printf( "g: f(7) returned %d\n", f(7) );49 printf( "g: f(7) returned %d\n", f(7) ); 39 50 } 40 51 41 52 int main() { 42 g( f );53 g( f ); 43 54 } 55 56 // Local Variables: // 57 // tab-width: 4 // 58 // compile-command: "cfa specialize.c" // 59 // End: // -
src/examples/square.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // square.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:43:34 2015 13 // Update Count : 2 14 // 15 1 16 extern "C" { 2 17 #include <stdio.h> 3 18 } 4 19 5 forall( type T | { T ?*?( T, T ); } )20 forall( type T | { T ?*?( T, T ); } ) 6 21 T square( T t ) { 7 return t * t;22 return t * t; 8 23 } 9 24 25 //char ?*?( char a1, char a2 ) { 26 // return (char)( (int)a1 * (int)a2 ); 27 //} 28 10 29 int main() { 11 printf( "result of square of 5 is %d\n", square( 5 ) ); 12 printf( "result of square of 5 is %f\n", square( 5.0 ) ); 30 char c = 5; 31 short int s = 5; 32 int i = 5; 33 float f = 5.0; 34 double d = 5.0; 35 // printf( "result of square of 5 is %d\n", (char)square( c ) ); 36 printf( "result of square of 5 is %d\n", square( s ) ); 37 printf( "result of square of 5 is %d\n", square( i ) ); 38 printf( "result of square of 5 is %f\n", square( f ) ); 39 printf( "result of square of 5 is %f\n", square( d ) ); 13 40 } 41 42 // Local Variables: // 43 // tab-width: 4 // 44 // compile-command: "cfa square.c" // 45 // End: // -
src/examples/sum.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // sum.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 1 20:46:35 2015 13 // Update Count : 18 14 // 15 1 16 extern "C" { 2 int printf( const char *, ... );17 int printf( const char *, ... ); 3 18 } 4 19 5 20 context sumable( type T ) { 6 const T 0;7 T ?+?( T, T );8 T ?++( T * );9 T ?+=?( T *, T );21 const T 0; 22 T ?+?( T, T ); 23 T ?++( T * ); 24 T ?+=?( T *, T ); 10 25 }; 11 26 12 27 forall( type T | sumable( T ) ) 13 28 T sum( int n, T a[] ) { 14 T total;// instantiate T, select 015 total = 0;16 for ( int i = 0; i < n; i += 1 )17 total = total + a[i];// select +18 return total;29 T total; // instantiate T, select 0 30 total = 0; 31 for ( int i = 0; i < n; i += 1 ) 32 total = total + a[i]; // select + 33 return total; 19 34 } 20 35 … … 27 42 28 43 int main() { 29 const int size = 10, low = 0, High = 10;30 int si = 0, ai[10]; // size 31 int i;32 for ( i = low; i < High; i+= 1 ) {33 si += i;34 ai[i] = i;35 }36 printf( "sum from %d to %d is %d, check %d\n",37 low, High, sum( size, ai ), si );44 const int low = 5, High = 15, size = High - low; 45 int si = 0, ai[size]; 46 int v = low; 47 for ( int i = 0; i < size; i += 1, v += 1 ) { 48 si += v; 49 ai[i] = v; 50 } 51 printf( "sum from %d to %d is %d, check %d\n", 52 low, High, sum( size, ai ), si ); 38 53 39 // char ci[10];40 // char c = sum( size, ci );41 // float fi[10];42 // float f = sum( size, fi );54 // char ci[size]; 55 // char c = sum( size, ci ); 56 // float fi[size]; 57 // float f = sum( size, fi ); 43 58 44 double sd = 0.0, ad[10]; // size 45 for ( i = low; i < High; i += 1 ) { 46 double d = i / (double)size;47 sd += d;48 ad[i] = d;49 }50 printf( "sum from %g to %g is %g, check %g\n",51 low / (double)size, High / (double)size, sum( size, ad ), sd );59 double sd = 0.0, ad[size]; 60 double v = low / 10.0; 61 for ( int i = 0; i < size; i += 1, v += 0.1 ) { 62 sd += v; 63 ad[i] = v; 64 } 65 printf( "sum from %g to %g is %g, check %g\n", 66 low / 10.0, High / 10.0, sum( size, ad ), sd ); 52 67 } 53 68 54 69 // Local Variables: // 55 // compile-command: "../../bin/cfa sum.c" // 70 // tab-width: 4 // 71 // compile-command: "cfa sum.c" // 56 72 // End: // -
src/examples/swap.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // swap.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:34:47 2015 13 // Update Count : 1 14 // 15 1 16 extern "C" { 2 int printf( const char *, ... );17 int printf( const char *, ... ); 3 18 } 4 19 5 20 forall( type T ) 6 21 void swap( T *left, T *right ) { 7 T temp = *left;8 *left = *right;9 *right = temp;22 T temp = *left; 23 *left = *right; 24 *right = temp; 10 25 } 11 26 12 27 int main() { 13 int x = 1, y = 2;14 printf( "%d %d\n", x, y );15 swap( &x, &y );16 printf( "%d %d\n", x, y );28 int x = 1, y = 2; 29 printf( "%d %d\n", x, y ); 30 swap( &x, &y ); 31 printf( "%d %d\n", x, y ); 17 32 } 18 33 19 34 // Local Variables: // 20 // compile-command: "../../bin/cfa swap.c" // 35 // tab-width: 4 // 36 // compile-command: "cfa swap.c" // 21 37 // End: // -
src/examples/twice.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // twice.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:37:23 2015 13 // Update Count : 1 14 // 15 1 16 #include "fstream.h" 2 17 3 18 forall( type T | { T ?+?( T, T ); T ?++( T * ); [T] ?+=?( T *, T ); } ) 4 19 T twice( const T t ) { 5 return t + t;20 return t + t; 6 21 } 7 22 8 23 int main() { 9 ofstream *sout = ofstream_stdout();10 sout << twice( 1 ) << ' ' << twice( 3.2 ) << '\n';24 ofstream *sout = ofstream_stdout(); 25 sout << twice( 1 ) << ' ' << twice( 3.2 ) << '\n'; 11 26 } 12 27 13 28 // Local Variables: // 14 // compile-command: "../../bin/cfa twice.c fstream.o iostream.o" // 29 // tab-width: 4 // 30 // compile-command: "cfa twice.c fstream.o iostream.o" // 15 31 // End: // -
src/examples/vector_int.c
reb50842 r937e51d 1 // "cfa vector_int.c" 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // vector_int.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:38:05 2015 13 // Update Count : 3 14 // 2 15 3 16 #include "vector_int.h" … … 10 23 11 24 vector_int vector_int_allocate() { 12 return vector_int_allocate( DEFAULT_CAPACITY );25 return vector_int_allocate( DEFAULT_CAPACITY ); 13 26 } 14 27 15 28 vector_int vector_int_allocate( int reserve ) { 16 vector_int new_vector;17 new_vector.last = -1;18 new_vector.capacity = reserve;19 new_vector.data = malloc( sizeof( int ) * reserve );20 return new_vector;29 vector_int new_vector; 30 new_vector.last = -1; 31 new_vector.capacity = reserve; 32 new_vector.data = malloc( sizeof( int ) * reserve ); 33 return new_vector; 21 34 } 22 35 23 36 void vector_int_deallocate( vector_int vec ) { 24 free( vec.data );37 free( vec.data ); 25 38 } 26 39 27 40 void reserve( vector_int *vec, int reserve ) { 28 if ( reserve > vec->capacity ) {29 vec->data = realloc( vec->data, sizeof( int ) * reserve );30 vec->capacity = reserve;31 }41 if ( reserve > vec->capacity ) { 42 vec->data = realloc( vec->data, sizeof( int ) * reserve ); 43 vec->capacity = reserve; 44 } 32 45 } 33 46 34 47 void append( vector_int *vec, int element ) { 35 vec->last++;36 if ( vec->last == vec->capacity ) {37 vec->capacity *= 2;38 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity );39 }40 vec->data[ vec->last ] = element;48 vec->last++; 49 if ( vec->last == vec->capacity ) { 50 vec->capacity *= 2; 51 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity ); 52 } 53 vec->data[ vec->last ] = element; 41 54 } 42 55 … … 44 57 45 58 lvalue int ?[?]( vector_int vec, int index ) { 46 return vec.data[ index ];59 return vec.data[ index ]; 47 60 } 48 61 49 62 int last( vector_int vec ) { 50 return vec.last;63 return vec.last; 51 64 } 52 65 66 67 // Local Variables: // 68 // tab-width: 4 // 69 // compile-command: "cfa vector_int.c" // 70 // End: // -
src/examples/vector_int.h
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // vector_int.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:39:05 2015 13 // Update Count : 2 14 // 15 1 16 #ifndef VECTOR_INT_H 2 17 #define VECTOR_INT_H … … 5 20 6 21 typedef struct vector_int { 7 int last;// last used index8 int capacity;// last possible index before reallocation9 int *data;// array22 int last; // last used index 23 int capacity; // last possible index before reallocation 24 int *data; // array 10 25 } vector_int; 11 26 12 vector_int vector_int_allocate(); // allocate vector with default capacity13 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity14 void vector_int_deallocate( vector_int ); // deallocate vector's storage27 vector_int vector_int_allocate(); // allocate vector with default capacity 28 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity 29 void vector_int_deallocate( vector_int ); // deallocate vector's storage 15 30 16 void reserve( vector_int *vec, int reserve ); // reserve more capacity17 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary31 void reserve( vector_int *vec, int reserve ); // reserve more capacity 32 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary 18 33 19 34 // implement bounded_array 20 35 21 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize)22 int last( vector_int vec ); // return last element36 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize) 37 int last( vector_int vec ); // return last element 23 38 24 39 #endif // VECTOR_INT_H 40 41 // Local Variables: // 42 // tab-width: 4 // 43 // compile-command: "cfa vector_int.c" // 44 // End: // -
src/examples/vector_test.c
reb50842 r937e51d 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // vector_test.c -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:42:55 2015 13 // Update Count : 2 14 // 15 1 16 #include "fstream.h" 2 17 #include "vector_int.h" … … 5 20 6 21 int main() { 7 ofstream *sout = ofstream_stdout();8 ifstream *sin = ifstream_stdin();9 vector_int vec = vector_int_allocate();22 ofstream *sout = ofstream_stdout(); 23 ifstream *sin = ifstream_stdin(); 24 vector_int vec = vector_int_allocate(); 10 25 11 // read in numbers until EOF or error12 int num;26 // read in numbers until EOF or error 27 int num; 13 28 14 sout << "enter N elements and C-d on a separate line:\n";15 for ( ;; ) {29 sout << "enter N elements and C-d on a separate line:\n"; 30 for ( ;; ) { 16 31 sin >> # 17 if ( fail( sin ) || eof( sin ) ) break;32 if ( fail( sin ) || eof( sin ) ) break; 18 33 append( &vec, num ); 19 }20 // write out the numbers34 } 35 // write out the numbers 21 36 22 sout << "Array elements:\n";23 // write_all( begin( vec ), end( vec ), sout );24 // sout << "\n";25 for ( int index = 0; index <= last( vec ); index += 1 ) {37 sout << "Array elements:\n"; 38 // write_all( begin( vec ), end( vec ), sout ); 39 // sout << "\n"; 40 for ( int index = 0; index <= last( vec ); index += 1 ) { 26 41 sout << vec[ index ] << " "; 27 }28 sout << "\n";42 } 43 sout << "\n"; 29 44 #if 1 30 sout << "Array elements reversed:\n";31 write_reverse( begin( vec ), end( vec ), sout );32 sout << "\n";45 sout << "Array elements reversed:\n"; 46 write_reverse( begin( vec ), end( vec ), sout ); 47 sout << "\n"; 33 48 #endif 34 49 } 35 50 36 51 // ../bin/cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o 52 53 // Local Variables: // 54 // tab-width: 4 // 55 // compile-command: "cfa vector_test.c fstream.o iostream.o vector_int.o iterator.o array.o" // 56 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.