mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Added new tool 'cdmake'.
svn path=/trunk/; revision=4513
This commit is contained in:
parent
4aa447d8d2
commit
e81de9962d
6 changed files with 1347 additions and 1 deletions
|
@ -13,7 +13,7 @@ TOOLS = \
|
|||
|
||||
CLEAN_FILES = $(TOOLS)
|
||||
|
||||
all: $(TOOLS) wmc_directory_target
|
||||
all: $(TOOLS) wmc_directory_target cdmake_directory_target
|
||||
|
||||
buildno$(EXE_POSTFIX): buildno.c ../include/reactos/version.h
|
||||
$(HOST_CC) $(CFLAGS) -o buildno$(EXE_POSTFIX) buildno.c
|
||||
|
@ -83,14 +83,19 @@ endif
|
|||
wmc_directory_target:
|
||||
$(MAKE) -C wmc wmc$(EXE_POSTFIX)
|
||||
|
||||
cdmake_directory_target:
|
||||
$(MAKE) -C cdmake cdmake$(EXE_POSTFIX)
|
||||
|
||||
ifeq ($(HOST),mingw32-linux)
|
||||
clean:
|
||||
$(MAKE) -C cdmake clean
|
||||
$(MAKE) -C wmc clean
|
||||
rm mkconfig
|
||||
rm $(TOOLS)
|
||||
endif
|
||||
ifeq ($(HOST),mingw32-windows)
|
||||
clean:
|
||||
$(MAKE) -C cdmake clean
|
||||
$(MAKE) -C wmc clean
|
||||
del *$(EXE_POSTFIX)
|
||||
endif
|
||||
|
|
10
reactos/tools/cdmake/.cvsignore
Normal file
10
reactos/tools/cdmake/.cvsignore
Normal file
|
@ -0,0 +1,10 @@
|
|||
cdmake
|
||||
*.coff
|
||||
*.d
|
||||
*.exe
|
||||
*.o
|
||||
*.sym
|
||||
*.dsp
|
||||
*.dsw
|
||||
*.ncb
|
||||
*.opt
|
37
reactos/tools/cdmake/Makefile
Normal file
37
reactos/tools/cdmake/Makefile
Normal file
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# CD-Maker
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=cdmake$(EXE_POSTFIX)
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
OBJECTS = cdmake.o llmosrt.o
|
||||
|
||||
CLEAN_FILES = *.o cdmake$(EXE_POSTFIX)
|
||||
|
||||
cdmake$(EXE_POSTFIX): $(OBJECTS)
|
||||
$(HOST_CC) $(OBJECTS) -o cdmake$(EXE_POSTFIX)
|
||||
|
||||
HOST_CFLAGS = -I.
|
||||
|
||||
#create_nls.o: create_nls.c
|
||||
# $(HOST_CC) $(HOST_CFLAGS) -c create_nls.c -o create_nls.o
|
||||
|
||||
ifeq ($(HOST),mingw32-linux)
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f cdmake$(EXE_POSTFIX)
|
||||
endif
|
||||
ifeq ($(HOST),mingw32-windows)
|
||||
clean:
|
||||
del *.o
|
||||
del cdmake$(EXE_POSTFIX)
|
||||
endif
|
||||
|
||||
.phony: clean
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
# EOF
|
1094
reactos/tools/cdmake/cdmake.c
Normal file
1094
reactos/tools/cdmake/cdmake.c
Normal file
File diff suppressed because it is too large
Load diff
106
reactos/tools/cdmake/llmosrt.c
Normal file
106
reactos/tools/cdmake/llmosrt.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* $Id: llmosrt.c,v 1.1 2003/04/07 18:15:20 ekohl Exp $ */
|
||||
/* A Linked-List Memory Sort
|
||||
by Philip J. Erdelsky
|
||||
pje@acm.org
|
||||
http://www.alumni.caltech.edu/~pje/
|
||||
*/
|
||||
|
||||
/* According to his website, this file was released into the public domain by Phillip J. Erdelsky */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void *sort_linked_list(void *p, unsigned index, int (*compare)(void *, void *))
|
||||
{
|
||||
unsigned base;
|
||||
unsigned long block_size;
|
||||
|
||||
struct record
|
||||
{
|
||||
struct record *next[1];
|
||||
/* other members not directly accessed by this function */
|
||||
};
|
||||
|
||||
struct tape
|
||||
{
|
||||
struct record *first, *last;
|
||||
unsigned long count;
|
||||
} tape[4];
|
||||
|
||||
/* Distribute the records alternately to tape[0] and tape[1]. */
|
||||
|
||||
tape[0].count = tape[1].count = 0L;
|
||||
tape[0].first = NULL;
|
||||
base = 0;
|
||||
while (p != NULL)
|
||||
{
|
||||
struct record *next = ((struct record *)p)->next[index];
|
||||
((struct record *)p)->next[index] = tape[base].first;
|
||||
tape[base].first = ((struct record *)p);
|
||||
tape[base].count++;
|
||||
p = next;
|
||||
base ^= 1;
|
||||
}
|
||||
|
||||
/* If the list is empty or contains only a single record, then */
|
||||
/* tape[1].count == 0L and this part is vacuous. */
|
||||
|
||||
for (base = 0, block_size = 1L; tape[base+1].count != 0L;
|
||||
base ^= 2, block_size <<= 1)
|
||||
{
|
||||
int dest;
|
||||
struct tape *tape0, *tape1;
|
||||
tape0 = tape + base;
|
||||
tape1 = tape + base + 1;
|
||||
dest = base ^ 2;
|
||||
tape[dest].count = tape[dest+1].count = 0;
|
||||
for (; tape0->count != 0; dest ^= 1)
|
||||
{
|
||||
unsigned long n0, n1;
|
||||
struct tape *output_tape = tape + dest;
|
||||
n0 = n1 = block_size;
|
||||
while (1)
|
||||
{
|
||||
struct record *chosen_record;
|
||||
struct tape *chosen_tape;
|
||||
if (n0 == 0 || tape0->count == 0)
|
||||
{
|
||||
if (n1 == 0 || tape1->count == 0)
|
||||
break;
|
||||
chosen_tape = tape1;
|
||||
n1--;
|
||||
}
|
||||
else if (n1 == 0 || tape1->count == 0)
|
||||
{
|
||||
chosen_tape = tape0;
|
||||
n0--;
|
||||
}
|
||||
else if ((*compare)(tape0->first, tape1->first) > 0)
|
||||
{
|
||||
chosen_tape = tape1;
|
||||
n1--;
|
||||
}
|
||||
else
|
||||
{
|
||||
chosen_tape = tape0;
|
||||
n0--;
|
||||
}
|
||||
chosen_tape->count--;
|
||||
chosen_record = chosen_tape->first;
|
||||
chosen_tape->first = chosen_record->next[index];
|
||||
if (output_tape->count == 0)
|
||||
output_tape->first = chosen_record;
|
||||
else
|
||||
output_tape->last->next[index] = chosen_record;
|
||||
output_tape->last = chosen_record;
|
||||
output_tape->count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tape[base].count > 1L)
|
||||
tape[base].last->next[index] = NULL;
|
||||
return tape[base].first;
|
||||
}
|
||||
|
||||
/* EOF */
|
94
reactos/tools/cdmake/readme.txt
Normal file
94
reactos/tools/cdmake/readme.txt
Normal file
|
@ -0,0 +1,94 @@
|
|||
CD-ROM Maker
|
||||
Philip J. Erdelsky
|
||||
|
||||
The CDMAKE utility converts files from DOS/Windows format to ISO9660
|
||||
(CD-ROM) format.
|
||||
|
||||
First, gather all the files to be converted and put them into a single
|
||||
base directory and its subdirectories, arranged just the way you want
|
||||
them on the CD-ROM. Remember that ISO9660 allows subdirectories to be
|
||||
nested only eight levels deep. Therefore, if the base directory is
|
||||
C:\CDROM,
|
||||
|
||||
C:\CDROM\D2\D3\D4\D5\D6\D7\D8\FOO.TXT is permitted, but
|
||||
|
||||
C:\CDROM\D2\D3\D4\D5\D6\D7\D8\D9\FOO.TXT is forbidden.
|
||||
|
||||
Also, ISO9660 does not allow directories to have extensions, although
|
||||
DOS does.
|
||||
|
||||
Finally, the characters in file and directory names and file extensions
|
||||
must be letters, digits or underscores. Other punctuation marks
|
||||
permitted by DOS/Windows are forbidden by ISO9660. You can use the -c
|
||||
option to override this restriction, but the resulting CD-ROM may not be
|
||||
readable on systems other than DOS/Windows.
|
||||
|
||||
Files in the base directory will be written to the root directory of the
|
||||
CD-ROM image. All subdirectories of the base directory will appear as
|
||||
subdirectories of the root directory of the CD-ROM image. Their
|
||||
contents, and the contents of their subdirectories, down to the eighth
|
||||
level, will be faithfully copied to the CD-ROM image.
|
||||
|
||||
System files will not be written to the CD-ROM image. Hidden files will
|
||||
be written to the CD-ROM image, and will retain their hidden attributes.
|
||||
Read-only files will be written, and will remain read-only on the
|
||||
CD-ROM, but this does not distinguish them in any way, because on a
|
||||
CD-ROM all files are read-only. The archive attribute will be lost.
|
||||
|
||||
File and directory date and time stamps will be preserved in the CD-ROM
|
||||
image.
|
||||
|
||||
The utility is called up by a command line of the following form:
|
||||
|
||||
CDMAKE [-q] [-v] [-p] [-s N] [-m] [-b bootimage] source volume image
|
||||
|
||||
source specifications of base directory containing all files to
|
||||
be written to CD-ROM image
|
||||
|
||||
volume volume label
|
||||
|
||||
image image file or device
|
||||
|
||||
-q quiet mode - display nothing but error messages
|
||||
|
||||
-v verbose mode - display file information as files are
|
||||
scanned and written - overrides -p option
|
||||
|
||||
-p show progress while writing
|
||||
|
||||
-s N abort operation before beginning write if image will be
|
||||
larger than N megabytes (i.e. 1024*1024*N bytes)
|
||||
|
||||
-m accept punctuation marks other than underscores in
|
||||
names and extensions
|
||||
|
||||
-b bootimage create bootable ElTorito CD-ROM using 'no emulation' mode
|
||||
|
||||
|
||||
The utility makes three passes over the source files:
|
||||
|
||||
(1) The scanning pass, in which the names and extensions are
|
||||
checked for validity, and the names, extensions, sizes, dates,
|
||||
times and attributes are recorded internally. The files are not
|
||||
actually read during this pass.
|
||||
|
||||
(2) The layout pass, in which the sizes and positions of
|
||||
directories, files and other items in the CD-ROM image are
|
||||
determined.
|
||||
|
||||
(3) The writing pass, in which the files are actually read and the
|
||||
CD-ROM image is actually written to the specified file or
|
||||
device. The image is always written sequentially.
|
||||
|
||||
If neither the -q nor the -v option is used, CDMAKE will display the
|
||||
volume label, size, number of files and directories and the total bytes
|
||||
in each at the end of the layout pass.
|
||||
|
||||
If the -p option is used, and is not overridden by the -v option, then
|
||||
during the writing pass, CDMAKE will display the number of bytes still
|
||||
to be written to the CD-ROM image, updating it frequently. The number
|
||||
will decrease as the operation progresses, and will reach zero when the
|
||||
operation is complete.
|
||||
|
||||
The operation of CDMAKE can be aborted by typing Ctrl-C when the utility
|
||||
is displaying text of any kind.
|
Loading…
Reference in a new issue