changeset 82:94b746f24b50

added ?DSTRESS_FLAGS? support
author thomask
date Fri, 29 Oct 2004 21:00:56 +0000
parents 257449adcae3
children 6a56a7866943
files extract__.c ifeq__.c readme.txt return__.c todo.txt
diffstat 5 files changed, 102 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extract__.c	Fri Oct 29 21:00:56 2004 +0000
@@ -0,0 +1,58 @@
+/* svn://svn.kuehne.cn/dstress/extract__.c
+ *
+ * extract compiler flags for DStress test cases
+ *
+ * Copyright (C) 2004 Thomas Kuehne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */                                             
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+// @WARNING@ works only with ASCII / UTF-8 source files
+int main(int argc, char* argv[]){
+	if(argc!=2){
+		printf("this stdin will be queried for the patter given as first argument\n");
+		return -1;
+	}
+	
+	// the longest source line in the test is a bit over 1<<16 bytes long
+	size_t length = 1 << 17;
+	char* line = malloc(length);
+	char* buffer;
+	char* found;
+	char* pattern=argv[1];
+	size_t pattern_length=strlen(pattern);
+
+	errno=0;	
+	while(buffer=fgets(line, length, stdin)){
+		found = strstr(buffer, pattern);
+		
+		if(errno!=0){
+			break;
+		}else if(found!=NULL){
+			found+=pattern_length;
+			printf("%s", found);
+			break;
+		}
+	}
+	
+	free(line);
+	
+	return 0;
+}
--- a/ifeq__.c	Fri Oct 29 05:50:46 2004 +0000
+++ b/ifeq__.c	Fri Oct 29 21:00:56 2004 +0000
@@ -1,3 +1,24 @@
+/* svn://svn.kuehne.cn/dstress/ifeq__.c
+ *
+ * compare the 2 input arguments (shell & OS independent)
+ *
+ * Copyright (C) 2004 Thomas Kuehne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */                                             
+
 #include <string.h>
 
 int main(int argc, char *argv[]){
--- a/readme.txt	Fri Oct 29 05:50:46 2004 +0000
+++ b/readme.txt	Fri Oct 29 21:00:56 2004 +0000
@@ -31,4 +31,4 @@
 	@uri@		message id
 	@url@		message xRef
 	@WARNING@	external dependencies (e.g. Phobos)
-
+	§DSTRESS_FLAGS§	everything following in the same line will be interpreted as _additional_ compiler flags
--- a/return__.c	Fri Oct 29 05:50:46 2004 +0000
+++ b/return__.c	Fri Oct 29 21:00:56 2004 +0000
@@ -1,3 +1,24 @@
+/* svn://svn.kuehne.cn/dstress/return__.c
+ *
+ * execute the first argument and print the return code
+ *
+ * Copyright (C) 2004 Thomas Kuehne
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */                                             
+
 #include <stdio.h>
 #include <stdlib.h>
 
--- a/todo.txt	Fri Oct 29 05:50:46 2004 +0000
+++ b/todo.txt	Fri Oct 29 21:00:56 2004 +0000
@@ -37,7 +37,7 @@
 
 * extend tests for design by contract
 
-* extend tests for inner functions
+* extend tests for inner functions and closures
 
 * operators