[Commit] nickle ChangeLog,1.93,1.94 string.5c,1.10,1.11
Bart Massey
commit at keithp.com
Sun Nov 7 22:28:41 PST 2004
Committed by: bart
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv4879
Modified Files:
ChangeLog string.5c
Log Message:
* string.5c:
Add shiftn(), shift(), chump() functions.
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- ChangeLog 8 Nov 2004 06:06:44 -0000 1.93
+++ ChangeLog 8 Nov 2004 06:28:38 -0000 1.94
@@ -1,6 +1,11 @@
2004-11-7 Bart Massey <bart at cs.pdx.edu>
* string.5c:
+ Add shiftn(), shift(), chump() functions.
+
+2004-11-7 Bart Massey <bart at cs.pdx.edu>
+
+ * string.5c:
Add wordsplit() function.
2004-10-19 Keith Packard <keithp at keithp.com>
Index: string.5c
===================================================================
RCS file: /local/src/CVS/nickle/string.5c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- string.5c 8 Nov 2004 06:06:44 -0000 1.10
+++ string.5c 8 Nov 2004 06:28:38 -0000 1.11
@@ -52,7 +52,39 @@
}
+ void shiftn(&(poly[...]) array, int n)
+ /*
+ * Shift a growable array n elements: left is positive
+ */
+ {
+ int f = dim(array);
+ for (int i = 0; i < f - n; i++)
+ array[i] = array[i + n];
+ if (n < 0)
+ for (int i = 0; i < -n; i++)
+ make_uninit(&array[i]);
+ if (n > 0)
+ setdim(array, f - n);
+ }
+
+ void shift(&(poly[...]) array)
+ /*
+ * Shift a growable array one element to the left
+ */
+ {
+ shiftn(&array, 1);
+ }
+ string chump(string s)
+ /*
+ * Return s with any trailing newlines removed
+ */
+ {
+ int n = length(s);
+ while(n > 0 && s[n - 1] == '\n')
+ --n;
+ return substr(s, 0, n);
+ }
public string chomp(string s)
/*
More information about the Commit
mailing list