# Implementation eines Zugriffzählers # Version 0.2 - 1998-11-17 # Gerhard Eichelsdörfer # Festlegung der Abmessungen eines Ziffernbildes $width = 8; $height = 10; # Grafikdaten der Ziffern @digit = ("3c","66","66","66","66","66","66","66","66","3c", # 0 "30","38","30","30","30","30","30","30","30","30", # 1 "3c","66","60","60","30","18","0c","06","06","7e", # 2 "3c","66","60","60","38","60","60","60","66","3c", # 3 "30","30","38","38","34","34","32","7e","30","78", # 4 "7e","06","06","06","3e","60","60","60","66","3c", # 5 "38","0c","06","06","3e","66","66","66","66","3c", # 6 "7e","66","60","60","30","30","18","18","0c","0c", # 7 "3c","66","66","66","3c","66","66","66","66","3c", # 8 "3c","66","66","66","66","7c","60","60","30","1c" # 9 ); # Zählerdatei zum Lesen öffnen open COUNT, '< count' or die "Zählerdatei nicht auffindbar"; $counter = <COUNT>; # Zählerstand lesen close COUNT; # Datei schließen $counter++; # Zählerstand aktualisieren $digits = length($counter); $wholewidth = $digits * $width; # Zählerdatei zum Schreiben öffnen open COUNT, '> count' or die "Kein Schreibzugriff auf Zählerdatei"; print COUNT $counter; # aktuellen Zählerstand in Datei schreiben close COUNT; # Anzahl in Ziffernfolge konvertieren und im Array @ca ablegen for ($i=$digits-1; $i>=0; $i--) { $ca[$i] = $counter % 10; $counter /= 10; } # Header ausgeben print <<EOH; Content-type: image/x-xbitmap #define count_width $wholewidth #define count_height $height static char count_bits[] = { EOH # Grafikdaten ausgeben for ($x=0; $x<$height; $x++) { for ($y=0; $y<$digits; $y++) { print "0x$digit[$ca[$y]*$height + $x]"; print ', ' if $y<$digits-1; } if ($x==$height-1) {print '};';} else {print ",\n";} } print "\n"; exit; |