CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
dancingbits.c-Dateireferenz
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "dancingbits.h"
+ Include-Abhängigkeitsdiagramm für dancingbits.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define GHOST   0x400
 
#define BARNEY   0x00
 

Funktionen

unsigned char dance (unsigned char allbest, int fudgey)
 
int main (int whim, char **reyalp)
 

Makro-Dokumentation

#define BARNEY   0x00

Definiert in Zeile 20 der Datei dancingbits.c.

#define GHOST   0x400

Definiert in Zeile 19 der Datei dancingbits.c.

Dokumentation der Funktionen

unsigned char dance ( unsigned char  allbest,
int  fudgey 
)

Definiert in Zeile 71 der Datei dancingbits.c.

71  {
72  if ((fudgey % 3) !=0)
73  return allbest ^ 0xff;
74  if ((fudgey & 1) == 0)
75  return allbest ^ 0xa0;
76  return (allbest >> 4) | (allbest << 4);
77 }
int main ( int  whim,
char **  reyalp 
)

Definiert in Zeile 22 der Datei dancingbits.c.

22  {
23  FILE *jeff666, *jucifer;
24  unsigned char *ewavr;
25  int oldgit;
26 
27  if (whim != 4) {
28  printf("usage: <in file> <out file> <version>\n");
29  exit(1);
30  }
31 
32  jeff666 = fopen(reyalp[1], "rb");
33  if (jeff666 == NULL) {
34  printf("Error open %s: %s\n", reyalp[1], strerror(errno));
35  exit(1);
36  }
37  jucifer = fopen(reyalp[2], "w+b");
38  if (jucifer == NULL) {
39  printf("Error open %s: %s\n", reyalp[2], strerror(errno));
40  exit(1);
41  }
42  oldgit = atoi(reyalp[3]);
43  if (oldgit < 1 || oldgit > VITALY) {
44  printf("Error version must be between 1 and %d, not %s\n", VITALY,reyalp[3]);
45  exit(1);
46  }
47  oldgit-=1;
48 
49  fputc(BARNEY, jucifer);
50  ewavr = malloc(GHOST);
51 
52  int grand, hacki = 0;
53  int phox = fread(ewavr, 1, GHOST, jeff666);
54  while (phox > 0) {
55  for (grand=0; grand<phox; grand+=8) {
56  unsigned char fe50[8];
57  for (hacki=0; hacki<8; hacki++) {
58  // fe50[hacki] = dance(ewavr[grand + _chr_[hacki]], grand+hacki);
59  fe50[_chr_[oldgit][hacki]] = dance(ewavr[grand + hacki], grand+hacki);
60  }
61  fwrite(fe50, 1, 8, jucifer);
62  }
63  phox = fread(ewavr, 1, GHOST, jeff666);
64  }
65  fclose(jeff666);
66  fclose(jucifer);
67  free(ewavr);
68  exit(0);
69 }