PERFORCE change 143415 for review
Konrad Jankowski
konrad at FreeBSD.org
Fri Jun 13 11:24:41 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143415
Change 143415 by konrad at vspredator on 2008/06/13 11:24:32
Batch generation script.
Quieten the output of posix.sh a little.
Add a 'verbose flag to colldef.c.
Affected files ...
.. //depot/projects/soc2008/konrad_collation/colldef/colldef.c#2 edit
.. //depot/projects/soc2008/konrad_collation/scripts/generate.sh#1 add
.. //depot/projects/soc2008/konrad_collation/scripts/posix.sh#3 edit
Differences ...
==== //depot/projects/soc2008/konrad_collation/colldef/colldef.c#2 (text+ko) ====
@@ -66,6 +66,8 @@
char used;
} weights_uncompressed[WEIGHT_TABLE_SIZE];
+int verbose = 0;
+
void usage(char *name);
void assign_weights(int codepoint, char *weights);
@@ -293,6 +295,10 @@
printf("\n");
}
+/*
+ * Find sparse places between neighbouring weights
+ * and eliminate them.
+ */
void
compress_weights(void)
{
@@ -315,24 +321,16 @@
printf("min = %d min2 = %d\n", min,
min2);
#endif
- reduce(min2, min + 1);
+ reduce(min2, start);
}
-}
-
-void
-compress_weights2(void)
-{
- int i;
-
- for (i = 0; i < WEIGHT_TABLE_SIZE; i++) {
-
- }
+ if (verbose)
+ printf("maximal weight: %d\n", start - 1);
}
void
binary_output(char *out_file)
{
- int i;
+ int i, j;
int out;
/*
@@ -341,12 +339,9 @@
*/
if ((out = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
err(1, "open(%s)", out_file);
- for (i = 0; i < WEIGHT_TABLE_SIZE; i++) {
- weight_table[i][0] = weights_uncompressed[i].w[0];
- weight_table[i][1] = weights_uncompressed[i].w[1];
- weight_table[i][2] = weights_uncompressed[i].w[2];
- weight_table[i][3] = weights_uncompressed[i].w[3];
- }
+ for (i = 0; i < WEIGHT_TABLE_SIZE; i++)
+ for (j = 0; j < NWEIGHTS; j++)
+ weight_table[i][j] = weights_uncompressed[i].w[j];
if (write(out, weight_table, sizeof(weight_table)) !=
sizeof(weight_table))
errx(1, "not full write");
@@ -365,7 +360,7 @@
char *in_file = DEFAULT_IN_FILE;
char *out_file = DEFAULT_OUT_FILE;
- while ((ch = getopt(argc, argv, "hf:o:")) != -1) {
+ while ((ch = getopt(argc, argv, "hf:o:v")) != -1) {
switch (ch) {
case 'f':
in_file = optarg;
@@ -373,6 +368,9 @@
case 'o':
out_file = optarg;
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
usage(argv[0]);
}
==== //depot/projects/soc2008/konrad_collation/scripts/posix.sh#3 (text+ko) ====
@@ -31,8 +31,9 @@
# This one is a cpu-killer -
# sed needs to process more substitutions, than the input file length.
-echo "running sed"
-time sed -f sed_cmd -i '' $OUTFILE
+#echo "running sed"
+#time \
+ sed -f sed_cmd -i '' $OUTFILE
# We now get rid of the more advanced lines - those that specify
# expansions.
# Deleting them will be disabled once support in the colldef.c comes up.
More information about the p4-projects
mailing list