From: Dobrica Pavlinusic Date: Thu, 2 Feb 2012 18:22:02 +0000 (+0100) Subject: show all ZPL command names and params X-Git-Url: http://git.rot13.org/?p=Printer-Zebra.git;a=commitdiff_plain;h=b840570849c70a476c643bfa7d21150535944ae8 show all ZPL command names and params --- diff --git a/ZPL2pbm.pl b/ZPL2pbm.pl index 0a3af92..818198d 100755 --- a/ZPL2pbm.pl +++ b/ZPL2pbm.pl @@ -6,14 +6,26 @@ use Data::Dump qw(dump); # convert Zebra label printer ZPL to pbm image +my $command; +while() { + chomp; + my ( $cmd, $desc ) = split(/\s/,$_,2); + $command->{$cmd} = $desc; +} + my $file = shift @ARGV || die "usage: $0 dump.zpl > dump.pbm"; open(my $in, '<', $file); -my $line = <$in>; + +our $line = ''; +sub slurp_line { + $line .= <$in> unless length $line > 3; +} +slurp_line; while( $line ) { - $line =~ s/[\r\n]+$//; - warn "# line ",dump($line); + $line =~ s/[\r\n]+$// && warn "## removed CR/LF\n"; + warn "# line ",dump($line),$/; if ( $line =~ s/~DG(\w+:)?(.+)// ) { my ( $name, $t,$w ) = split(/,/,$2,4); @@ -53,6 +65,7 @@ while( $line ) { } else { warn "ABORT: offset $p data [$c]"; $line = $c . substr($data,$p); + slurp_line; last; } @@ -65,9 +78,191 @@ while( $line ) { my $ph = int(length($bitmap) / $w); print "P4\n$pw $ph\n", substr($bitmap,0,$ph*$w); - } elsif ( $line =~ s/^([~\^][^~\^]*)// ) { - warn "ZPL: $1\n"; + } elsif ( $line =~ s/^([~\^][^~\^\r\n]*)// ) { + my $cmd = substr($1,0,3); + if ( my $desc = $command->{$cmd} ) { + warn "ZPL: $1\t$desc\n"; + } else { + warn "UNKNOWN: ",dump($1),$/; + } + $line =~ s/^[\r\n]+// && warn "## removed CR/LF\n"; } - $line = <$in> unless length $line > 0; + slurp_line; } + +__DATA__ +^A Scalable/Bitmapped Font +^A@ Use Font Name to Call Font +^B1 Code 11 Bar Code +^B2 Interleaved 2 of 5 Bar Code +^B3 Code 39 Bar Code +^B4 Code 49 Bar Code +^B5 Planet Code bar code +^B7 PDF417 Bar Code +^B8 EAN-8 Bar Code +^B9 UPC-E Bar Code +^BA Code 93 Bar Code +^BB CODABLOCK Bar Code +^BC Code 128 Bar Code (Subsets A, B, and C) +^BD UPS MaxiCode Bar Code +^BE EAN-13 Bar Code +^BF Micro-PDF417 Bar Code +^BI Industrial 2 of 5 Bar Codes +^BJ Standard 2 of 5 Bar Code +^BK ANSI Codabar Bar Code +^BL LOGMARS Bar Code +^BM MSI Bar Code +^BO Aztec Bar Code Parameters +^BP Plessey Bar Code +^BQ QR Code Bar Code +^BR RSS (Reduced Space Symbology) Bar Code +^BS UPC/EAN Extensions +^BT TLC39 bar code +^BU UPC-A Bar Code +^BX Data Matrix Bar Code +^BY Bar Code Field Default +^BZ POSTNET Bar Code +^CC Change Carets +~CC Change Carets +^CD Change Delimiter +~CD Change Delimiter +^CF Change Alphanumeric Default Font +^CI Change International Font +^CM Change Memory Letter Designation +^CO Cache On +^CT Change Tilde +~CT Change Tilde +^CV Code Validation +^CW Font Identifier +~DB Download Bitmap Font +~DE Download Encoding +^DF Download Format +~DG Download Graphics +~DN Abort Download Graphic +~DS Download Scalable Font +~DT Download TrueType Font +~DU Download Unbounded TrueType Font +~DY Download Graphics +~EG Erase Download Graphics +^FB Field Block +^FC Field Clock (for Real-Time Clock) +^FD Field Data +^FH Field Hexadecimal Indicator +^FM Multiple Field Origin Locations +^FN Field Number +^FO Field Origin +^FP Field Parameter +^FR Field Reverse Print +^FS Field Separator +^FT Field Typeset +^FV Field Variable +^FW Field Orientation +^FX Comment +^GB Graphic Box +^GC Graphic Circle +^GD Graphic Diagonal Line +^GE Graphic Ellipse +^GF Graphic Field +^GS Graphic Symbol +~HB Battery Status +~HD Head Temperature Information +^HF Graphic Symbol +^HG Host Graphic +^HH Configuration Label Return +~HI Host Identification +~HM Host RAM Status +~HS Host Status Return +~HU Return ZebraNet Alert Configuration +^HV Host Verification +^HW Host Directory List +^HY Upload Graphics +^HZ Display Description Information +^ID Object Delete +^IL Image Load +^IM Image Move +^IS Image Save +~JA Cancel All +^JB Initialize Flash Memory +~JB Reset Optional Memory +~JC Set Media Sensor Calibration +~JD Enable Communications Diagnostics +~JE Disable Diagnostics +~JF Set Battery Condition +~JG Graphing Sensor Calibration +^JJ Set Auxiliary Port +~JL Set Label Length +^JM Set Dots per Millimeter +~JN Head Test Fatal +~JO Head Test Non fatal +~JP Pause and Cancel Format +~JR Power On Reset +^JS Sensor Select +~JS Change Backfeed Sequence +^JT Head Test Interval +^JU Configuration Update +^JW Set Ribbon Tension +~JX Cancel Current Partially Input Format +^JZ Reprint After Error +~KB Kill Battery (Battery Discharge Mode) +^KD Select Date and Time Format (for Real Time Clock) +^KL Define Language +^KN Define Printer Name +^KP Define Password +^LH Label Home +^LL Label Length +^LR Label Reverse Print +^LS Label Shift +^LT Label Top +^MC Map Clear +^MD Media Darkness +^MF Media Feed +^ML Maximum Label Length +^MM Print Mode +^MN Media Tracking +^MP Mode Protection +^MT Media Type +^MU Set Units of Measurement +^MW Modify Head Cold Warning +~NC Network Connect +^NI Network ID Number +~NR Set All Network Printers Transparent +^NS Change Networking Settings +~NT Set Currently Connected Printer Transparent +^PF Slew Given Number of Dot Rows +^PH Slew to Home Position +~PH Slew to Home Position +^PM Printing Mirror Image of Label +^PO Print Orientation +^PP Programmable Pause +~PP Programmable Pause +^PQ Print Quantity +^PR Print Rate +~PR Applicator Reprint +~PS Print Start +^PW Print Width +~RO Reset Advanced Counter +^SC Set Serial Communications +~SD Set Darkness +^SE Select Encoding +^SF Serialization Field (with a Standard ^FD String) +^SL Set Mode and Language (for Real-Time Clock) +^SN Serialization Data +^SO Set Offset (for Real-Time Clock) +^SP Start Print +^SQ Halt ZebraNet Alert +^SR Set Printhead Resistance +^SS Set Media Sensors +^ST Set Date and Time (for Real-Time Clock) +^SX Set ZebraNet Alert +^SZ Set ZPL +~TA Tear-off Adjust Position +^TO Transfer Object +~WC Print Configuration Label +^WD Print Directory Label +^XA Start Format +^XB Suppress Backfeed +^XF Recall Format +^XG Recall Graphic +^XZ End Format +^ZZ Printer Sleep