Check-in [36d0805e0e]
Overview
Comment:Made Tcl and C version of "xvfs-create" more similar by re-ordering output
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | pure-c
Files: files | file ages | folders
SHA3-256: 36d0805e0eae0bdf2fb2941ed6e6e209caa1d2a2e91938deda630a579f29b051
User & Date: rkeene on 2019-12-03 17:59:44
Other Links: branch diff | manifest | tags
Context
2019-12-06
14:17
Updated ignores Closed-Leaf check-in: a01594ff30 user: rkeene tags: pure-c
2019-12-03
17:59
Made Tcl and C version of "xvfs-create" more similar by re-ordering output check-in: 36d0805e0e user: rkeene tags: pure-c
2019-12-02
03:09
Updated to use string for minirivet parsing check-in: 2d9592486f user: rkeene tags: pure-c
Changes

Modified Makefile from [86178e5802] to [0296cd0ad4].

11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25







-
+








all: example-standalone$(LIB_SUFFIX) example-client$(LIB_SUFFIX) example-flexible$(LIB_SUFFIX) xvfs$(LIB_SUFFIX)

example.c: $(shell find example -type f) $(shell find lib -type f) lib/xvfs/xvfs.c.rvt xvfs-create-c xvfs-create Makefile
	rm -f example.c.new.1 example.c.new.2
	./xvfs-create-c --directory example --name example > example.c.new.1
	./xvfs-create --directory example --name example > example.c.new.2
	#diff -u example.c.new.1 example.c.new.2
	bash -c "diff -u <(grep -v '^ *$$' example.c.new.1) <(grep -v '^ *$$' example.c.new.2)" || :
	rm -f example.c.new.2
	mv example.c.new.1 example.c

example-standalone.o: example.c xvfs-core.h xvfs-core.c Makefile
	$(CC) $(CPPFLAGS) -DXVFS_MODE_STANDALONE $(CFLAGS) -o example-standalone.o -c example.c

example-standalone$(LIB_SUFFIX): example-standalone.o Makefile

Modified lib/xvfs/xvfs.tcl from [6afa223420] to [832d8bb370].

123
124
125
126
127
128
129
130
131
132
133

134
135
136

137
138

139
140
141
142
143
144
145
123
124
125
126
127
128
129

130
131

132
133
134

135
136
137
138
139
140
141
142
143
144
145







-


-
+


-
+


+







			return -code error "Unable to process $inputFile, unknown type: $fileInfo(type)"
		}
	}

	::xvfs::_emitLine "\t\{"
	::xvfs::_emitLine "\t\t.name = \"[sanitizeCString $outputFile]\","
	::xvfs::_emitLine "\t\t.type = $type,"
	::xvfs::_emitLine "\t\t.size = $size,"
	switch -exact -- $fileInfo(type) {
		"file" {
			::xvfs::_emitLine "\t\t.data.fileContents = (const unsigned char *) $data"
			::xvfs::_emitLine "\t\t.data.fileContents = (const unsigned char *) $data,"
		}
		"directory" {
			::xvfs::_emitLine "\t\t.data.dirChildren  = $children"
			::xvfs::_emitLine "\t\t.data.dirChildren  = $children,"
		}
	}
	::xvfs::_emitLine "\t\t.size = $size"
	::xvfs::_emitLine "\t\},"
}

proc ::xvfs::processDirectory {fsName directory {subDirectory ""}} {
	set subDirectories [list]
	set outputFiles [list]
	set workingDirectory [file join $directory $subDirectory]

Modified xvfs-create-c.c from [6584aa9678] to [8abf7d803b].

184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202


203
204
205
206
207
208
209
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200

201
202
203
204
205
206
207
208
209







-










-
+
+







	free(rel_path_buf);

	child_count = child_idx;

	fprintf(outfp, "\t{\n");
	fprintf(outfp, "\t\t.name = \"%s\",\n", prefix);
	fprintf(outfp, "\t\t.type = XVFS_FILE_TYPE_DIR,\n");
	fprintf(outfp, "\t\t.size = %lu,\n", child_count);
	fprintf(outfp, "\t\t.data.dirChildren  = (const char *[]) {");
	for (child_idx = 0; child_idx < child_count; child_idx++) {
		if (child_idx != 0) {
			fprintf(outfp, ", ");
		}

		fprintf(outfp, "\"%s\"", children[child_idx]);

		free(children[child_idx]);
	}
	fprintf(outfp, "}\n");
	fprintf(outfp, "},\n");
	fprintf(outfp, "\t\t.size = %lu\n", child_count);

	free(children);

	fprintf(outfp, "\t},\n");

	xvfs_state->children[xvfs_state->child_count] = strdup(prefix);
	xvfs_state->child_count++;