Revision: 14354 Author: adrian.chadd Date: Tue Nov 3 01:53:33 2009 Log: Add a simple script to generate a lookup map from a hex list
http://code.google.com/p/lusca-cache/source/detail?r=14354 Added: /branches/LUSCA_HEAD/contrib/make_filter_map.pl ======================================= --- /dev/null +++ /branches/LUSCA_HEAD/contrib/make_filter_map.pl Tue Nov 3 01:53:33 2009 @@ -0,0 +1,29 @@ +#!/usr/bin/perl -w + +# This evil hacky script takes in a file with one hex number +# per line and outputs a lookup map. + +# Adrian Chadd <[email protected]> + +use strict; + +my (@ar); + +for (my $i = 0; $i < 256; $i++) { + if ($i < 32 || $i > 127) { + $ar[$i] = 1; + } else { + $ar[$i] = 0; + } +} + +while (<>) { + chomp; + $ar[hex($_)] = 1; +}; + +for (my $i = 0; $i < 256; $i++) { + printf "%s, ", $ar[$i]; + if ($i > 0 && ($i % 16 == 15)) { print "\n"; } +} +print "\n"; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "lusca-commit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/lusca-commit?hl=en -~----------~----~----~----~------~----~------~--~---
