huffman progress, scripting
This commit is contained in:
parent
baea9ae9be
commit
96d374eeb7
|
@ -3,7 +3,9 @@ returnCode=0
|
|||
echo -e "compiling all files in working directory $(pwd)\n"
|
||||
for file in $(/bin/ls *.c);
|
||||
do
|
||||
./compile.sh $file;
|
||||
echo "compiling $file ..."
|
||||
noext=$(echo "$file" | cut -f 1 -d '.')
|
||||
gcc $file -o bin/$noext -lm
|
||||
if [ "$?" -ne 0 ]
|
||||
then
|
||||
echo -e "\nERROR: could not compile $file !\n";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
noext=$(echo "$1" | cut -f 1 -d '.')
|
||||
./compile.sh $1
|
||||
echo "compiling $1 ..."
|
||||
noext=$(echo "$1" | cut -f 1 -d '.')
|
||||
gcc $1 -o bin/$noext -lm
|
||||
./bin/$noext $2 $3 $4 $5 $6 $7 $8 $9
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
#!/bin/bash
|
||||
echo "compiling $1 ..."
|
||||
noext=$(echo "$1" | cut -f 1 -d '.')
|
||||
|
||||
# to treat warnings as errors, use the following line
|
||||
#gcc $1 -o bin/$noext -lm -Werror=format
|
||||
#
|
||||
gcc $1 -o bin/$noext -lm
|
||||
|
|
Binary file not shown.
|
@ -151,7 +151,6 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
*/
|
||||
// backup
|
||||
/*
|
||||
while(1){
|
||||
fseek(fptrR, 512, SEEK_CUR); // this line seems the be making the most problems
|
||||
|
||||
|
@ -163,9 +162,9 @@ int main(int argc, char *argv[]) {
|
|||
// FIXME )This is a buggy mess
|
||||
if(512 == fread(buf, 1, 512, fptrR)){
|
||||
for(int i=0;i<512;i++){
|
||||
occurences[buf[i]]++;)
|
||||
occurences[buf[i]]++;
|
||||
}
|
||||
}
|
||||
})
|
||||
else if(0 == fread(buf, 1, 512, fptrR)){
|
||||
if(debug)
|
||||
printf("[DEBUG]fread returned 0! ftell for current position is %lu\n", ftell(fptrR));
|
||||
|
@ -181,28 +180,27 @@ int main(int argc, char *argv[]) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
*/
|
||||
// ALMOST WORKS! ~200 bytes lost for a 10M file!!!
|
||||
uint8_t bufMini[1];
|
||||
while(1){
|
||||
if(fread(bufMini, 1, 1, fptrR)){
|
||||
occurences[buf[0]]++;
|
||||
}
|
||||
else{
|
||||
if(ferror(fptrR)){
|
||||
fprintf(stderr, "encountered error when reading file.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
fseek(fptrR, 1, SEEK_SET);
|
||||
if(ferror(fptrR)){
|
||||
fprintf(stderr, "encountered error when reading file.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else if(feof(fptrR)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// while(1){
|
||||
// if(fread(bufMini, 1, 1, fptrR)){
|
||||
// occurences[buf[0]]++;
|
||||
// }
|
||||
// else{
|
||||
// if(ferror(fptrR)){
|
||||
// fprintf(stderr, "encountered error when reading file.\n");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
// }
|
||||
// fseek(fptrR, 1, SEEK_SET);
|
||||
// if(ferror(fptrR)){
|
||||
// fprintf(stderr, "encountered error when reading file.\n");
|
||||
// exit(EXIT_FAILURE);
|
||||
// }
|
||||
// else if(feof(fptrR)){
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if(debug){
|
||||
printf("Occurences (Hex):\n");
|
||||
for(int i=0;i<256;i++){
|
||||
|
|
Loading…
Reference in New Issue