home *** CD-ROM | disk | FTP | other *** search
- // Code 128
- Unit KodA;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls,
- U;
-
- procedure HCA(var Co:TMemo);
- procedure S2LA(Co:String; StartStop:Boolean; Crc:Boolean ; var Raw:String; var RawS:String; var Bits:String);
-
-
- implementation
-
- const MaxKod=106;
- var Kody:Array[0..106]of record
- Asc,Asc2,Asc3:String;
- Kod:Byte;
- Line:String;
- end;
-
- procedure HCA(var Co:TMemo);
- var I:Word;
- begin
- Co.Clear;
- for I:=0 to MaxKod do
- with Kody[I] do
- begin
- Co.Lines.Add(Hex(Kod)+' '+Asc+' / '+Asc2+' / '+Asc3+' ('+Line+')');
- end;
- end;
-
- procedure S2LA(Co:String; StartStop:Boolean; Crc:Boolean ; var Raw:String; var RawS:String; var Bits:String);
- var I,J,K:Integer;
- Pom,Pom2:String;
- PomC:Byte;
- E:Integer;
- Ch:Byte;
- begin
- Raw:='';
- RawS:='';
- Bits:='';
- if Length(Co)=0 then Exit;
- //// Vy°a∩ neplatnΘ a zkonvertuj HEX verze
- I:=1;
- while I<=Length(Co) do
- begin
- //// Je to $ ?
- if Co[I]='$' then // Je to HEX
- begin
- Pom:='';
- repeat
- Pom:=Pom+Co[I];
- I:=I+1; // Posu≥ o dalÜφ znak
- until (length(Pom)=3) or (I>Length(Co));
- if I<=Length(Co) then I:=I-1;
- Val(Pom,PomC,E);
- if (E=0)and(PomC<=MaxKod) then
- begin
- Raw:=Raw+Chr(PomC);
- end;
- end else
- begin // Nenφ to HEX
- for J:=0 to MaxKod do
- if Co[I]=Kody[J].Asc2 then Raw:=Raw+Chr(Kody[J].Kod);
- end;
- I:=I+1;
- end;
- //// Crc a Start/Stop
- if Crc then
- begin
- J:=0;
- for I:=1 to Length(Raw) do
- begin
- J:=J+Ord(Raw[I]);
- end;
- Raw:=Raw+Chr(J mod 103);
- end;
-
- if StartStop then Raw:=#104+Raw+#106;
- //// Na zobrazitelne
- //// +Na bity
- for I:=1 to Length(Raw) do
- begin
- RawS:=RawS+Kody[Ord(Raw[I])].Asc2;
- Pom2:=Kody[Ord(Raw[I])].Line;
- Pom:='';
- Ch:=$31; // ZaΦφnßme jedniΦkou
- for J:=1 to Length(Pom2) do
- begin
- for K:=1 to (Ord(Pom2[J])-$30) do // Pozor na 0-x a 1-x v tabulce bit∙ !!!
- begin
- Pom:=Pom+Chr(Ch);
- end;
- Ch:=Ch xor 1;
- end;
- Bits:=Bits+Pom;
- end;
- end;
-
- begin
- with Kody[000]do begin Asc:=' ';Asc2:=' ';Asc3:='00';Kod:=0;Line:='212222';end;
- with Kody[001]do begin Asc:='!';Asc2:='!';Asc3:='01';Kod:=1;Line:='222122';end;
- with Kody[002]do begin Asc:='"';Asc2:='"';Asc3:='02';Kod:=2;Line:='222221';end;
- with Kody[003]do begin Asc:='#';Asc2:='#';Asc3:='03';Kod:=3;Line:='121223';end;
- with Kody[004]do begin Asc:='$';Asc2:='$';Asc3:='04';Kod:=4;Line:='121322';end;
- with Kody[005]do begin Asc:='%';Asc2:='%';Asc3:='05';Kod:=5;Line:='131222';end;
- with Kody[006]do begin Asc:='&';Asc2:='&';Asc3:='06';Kod:=6;Line:='122213';end;
- with Kody[007]do begin Asc:=''';Asc2:=''';Asc3:='07';Kod:=7;Line:='122312';end;
- with Kody[008]do begin Asc:='(';Asc2:='(';Asc3:='08';Kod:=8;Line:='132212';end;
- with Kody[009]do begin Asc:=')';Asc2:=')';Asc3:='09';Kod:=9;Line:='221213';end;
-
- with Kody[010]do begin Asc:='*';Asc2:='*';Asc3:='10';Kod:=10;Line:='221312';end;
- with Kody[011]do begin Asc:='+';Asc2:='+';Asc3:='11';Kod:=11;Line:='231212';end;
- with Kody[012]do begin Asc:=',';Asc2:=',';Asc3:='12';Kod:=12;Line:='112232';end;
- with Kody[013]do begin Asc:='-';Asc2:='-';Asc3:='13';Kod:=13;Line:='122132';end;
- with Kody[014]do begin Asc:='.';Asc2:='.';Asc3:='14';Kod:=14;Line:='122231';end;
- with Kody[015]do begin Asc:='/';Asc2:='/';Asc3:='15';Kod:=15;Line:='113222';end;
- with Kody[016]do begin Asc:='0';Asc2:='0';Asc3:='16';Kod:=16;Line:='123122';end;
- with Kody[017]do begin Asc:='1';Asc2:='1';Asc3:='17';Kod:=17;Line:='123221';end;
- with Kody[018]do begin Asc:='2';Asc2:='2';Asc3:='18';Kod:=18;Line:='223211';end;
- with Kody[019]do begin Asc:='3';Asc2:='3';Asc3:='19';Kod:=19;Line:='221132';end;
-
- with Kody[020]do begin Asc:='4';Asc2:='4';Asc3:='20';Kod:=20;Line:='221231';end;
- with Kody[021]do begin Asc:='5';Asc2:='5';Asc3:='21';Kod:=21;Line:='213212';end;
- with Kody[022]do begin Asc:='6';Asc2:='6';Asc3:='22';Kod:=22;Line:='223112';end;
- with Kody[023]do begin Asc:='7';Asc2:='7';Asc3:='23';Kod:=23;Line:='312131';end;
- with Kody[024]do begin Asc:='8';Asc2:='8';Asc3:='24';Kod:=24;Line:='311222';end;
- with Kody[025]do begin Asc:='9';Asc2:='9';Asc3:='25';Kod:=25;Line:='321122';end;
- with Kody[026]do begin Asc:=':';Asc2:=':';Asc3:='26';Kod:=26;Line:='321221';end;
- with Kody[027]do begin Asc:=';';Asc2:=';';Asc3:='27';Kod:=27;Line:='312212';end;
- with Kody[028]do begin Asc:='<';Asc2:='<';Asc3:='28';Kod:=28;Line:='322112';end;
- with Kody[029]do begin Asc:='=';Asc2:='=';Asc3:='29';Kod:=29;Line:='322211';end;
-
- with Kody[030]do begin Asc:='>';Asc2:='>';Asc3:='30';Kod:=30;Line:='212123';end;
- with Kody[031]do begin Asc:='?';Asc2:='?';Asc3:='31';Kod:=31;Line:='212321';end;
- with Kody[032]do begin Asc:='@';Asc2:='@';Asc3:='32';Kod:=32;Line:='232121';end;
- with Kody[033]do begin Asc:='A';Asc2:='A';Asc3:='33';Kod:=33;Line:='111323';end;
- with Kody[034]do begin Asc:='B';Asc2:='B';Asc3:='34';Kod:=34;Line:='131123';end;
- with Kody[035]do begin Asc:='C';Asc2:='C';Asc3:='35';Kod:=35;Line:='131321';end;
- with Kody[036]do begin Asc:='D';Asc2:='D';Asc3:='36';Kod:=36;Line:='112313';end;
- with Kody[037]do begin Asc:='E';Asc2:='E';Asc3:='37';Kod:=37;Line:='132113';end;
- with Kody[038]do begin Asc:='F';Asc2:='F';Asc3:='38';Kod:=38;Line:='132311';end;
- with Kody[039]do begin Asc:='G';Asc2:='G';Asc3:='39';Kod:=39;Line:='211313';end;
-
- with Kody[040]do begin Asc:='H';Asc2:='H';Asc3:='40';Kod:=40;Line:='231113';end;
- with Kody[041]do begin Asc:='I';Asc2:='I';Asc3:='41';Kod:=41;Line:='231311';end;
- with Kody[042]do begin Asc:='J';Asc2:='J';Asc3:='42';Kod:=42;Line:='112133';end;
- with Kody[043]do begin Asc:='K';Asc2:='K';Asc3:='43';Kod:=43;Line:='112331';end;
- with Kody[044]do begin Asc:='L';Asc2:='L';Asc3:='44';Kod:=44;Line:='132131';end;
- with Kody[045]do begin Asc:='M';Asc2:='M';Asc3:='45';Kod:=45;Line:='113123';end;
- with Kody[046]do begin Asc:='N';Asc2:='N';Asc3:='46';Kod:=46;Line:='113321';end;
- with Kody[047]do begin Asc:='O';Asc2:='O';Asc3:='47';Kod:=47;Line:='133121';end;
- with Kody[048]do begin Asc:='P';Asc2:='P';Asc3:='48';Kod:=48;Line:='313121';end;
- with Kody[049]do begin Asc:='Q';Asc2:='Q';Asc3:='49';Kod:=49;Line:='211331';end;
-
- with Kody[050]do begin Asc:='R';Asc2:='R';Asc3:='50';Kod:=50;Line:='231131';end;
- with Kody[051]do begin Asc:='S';Asc2:='S';Asc3:='51';Kod:=51;Line:='213113';end;
- with Kody[052]do begin Asc:='T';Asc2:='T';Asc3:='52';Kod:=52;Line:='213311';end;
- with Kody[053]do begin Asc:='U';Asc2:='U';Asc3:='53';Kod:=53;Line:='213131';end;
- with Kody[054]do begin Asc:='V';Asc2:='V';Asc3:='54';Kod:=54;Line:='311123';end;
- with Kody[055]do begin Asc:='W';Asc2:='W';Asc3:='55';Kod:=55;Line:='311321';end;
- with Kody[056]do begin Asc:='X';Asc2:='X';Asc3:='56';Kod:=56;Line:='331121';end;
- with Kody[057]do begin Asc:='Y';Asc2:='Y';Asc3:='57';Kod:=57;Line:='312113';end;
- with Kody[058]do begin Asc:='Z';Asc2:='Z';Asc3:='58';Kod:=58;Line:='312311';end;
- with Kody[059]do begin Asc:='[';Asc2:='[';Asc3:='59';Kod:=59;Line:='332111';end;
-
- with Kody[060]do begin Asc:='\';Asc2:='\';Asc3:='60';Kod:=60;Line:='314111';end;
- with Kody[061]do begin Asc:=']';Asc2:=']';Asc3:='61';Kod:=61;Line:='221411';end;
- with Kody[062]do begin Asc:='^';Asc2:='^';Asc3:='62';Kod:=62;Line:='431111';end;
- with Kody[063]do begin Asc:='_';Asc2:='_';Asc3:='63';Kod:=63;Line:='111224';end;
- with Kody[064]do begin Asc:='{NUL}';Asc2:='`';Asc3:='64';Kod:=64;Line:='111422';end;
- with Kody[065]do begin Asc:='{SOH}';Asc2:='a';Asc3:='65';Kod:=65;Line:='121124';end;
- with Kody[066]do begin Asc:='{STX}';Asc2:='b';Asc3:='66';Kod:=66;Line:='121421';end;
- with Kody[067]do begin Asc:='{ETX}';Asc2:='c';Asc3:='67';Kod:=67;Line:='141122';end;
- with Kody[068]do begin Asc:='{EOT}';Asc2:='d';Asc3:='68';Kod:=68;Line:='141221';end;
- with Kody[069]do begin Asc:='{ENQ}';Asc2:='e';Asc3:='69';Kod:=69;Line:='112214';end;
-
- with Kody[070]do begin Asc:='{ACK}';Asc2:='f';Asc3:='70';Kod:=70;Line:='112412';end;
- with Kody[071]do begin Asc:='{BEL}';Asc2:='g';Asc3:='71';Kod:=71;Line:='122114';end;
- with Kody[072]do begin Asc:='{BS}';Asc2:='h';Asc3:='72';Kod:=72;Line:='122411';end;
- with Kody[073]do begin Asc:='{HT}';Asc2:='i';Asc3:='73';Kod:=73;Line:='142112';end;
- with Kody[074]do begin Asc:='{LF}';Asc2:='j';Asc3:='74';Kod:=74;Line:='142211';end;
- with Kody[075]do begin Asc:='{VT}';Asc2:='k';Asc3:='75';Kod:=75;Line:='241211';end;
- with Kody[076]do begin Asc:='{FF}';Asc2:='l';Asc3:='76';Kod:=76;Line:='221114';end;
- with Kody[077]do begin Asc:='{CR}';Asc2:='m';Asc3:='77';Kod:=77;Line:='413111';end;
- with Kody[078]do begin Asc:='{SO}';Asc2:='n';Asc3:='78';Kod:=78;Line:='241112';end;
- with Kody[079]do begin Asc:='{SI}';Asc2:='o';Asc3:='79';Kod:=79;Line:='134111';end;
-
- with Kody[080]do begin Asc:='{DLE}';Asc2:='p';Asc3:='80';Kod:=80;Line:='111242';end;
- with Kody[081]do begin Asc:='{DC1}';Asc2:='q';Asc3:='81';Kod:=81;Line:='121142';end;
- with Kody[082]do begin Asc:='{DC2}';Asc2:='r';Asc3:='82';Kod:=82;Line:='121241';end;
- with Kody[083]do begin Asc:='{DC3}';Asc2:='s';Asc3:='83';Kod:=83;Line:='114212';end;
- with Kody[084]do begin Asc:='{DC4}';Asc2:='t';Asc3:='84';Kod:=84;Line:='124112';end;
- with Kody[085]do begin Asc:='{NAK}';Asc2:='u';Asc3:='85';Kod:=85;Line:='124211';end;
- with Kody[086]do begin Asc:='{SYN}';Asc2:='v';Asc3:='86';Kod:=86;Line:='411212';end;
- with Kody[087]do begin Asc:='{ETB}';Asc2:='w';Asc3:='87';Kod:=87;Line:='421112';end;
- with Kody[088]do begin Asc:='{CAN}';Asc2:='x';Asc3:='88';Kod:=88;Line:='421211';end;
- with Kody[089]do begin Asc:='{EM}';Asc2:='y';Asc3:='89';Kod:=89;Line:='212141';end;
-
- with Kody[090]do begin Asc:='{SUB}';Asc2:='z';Asc3:='90';Kod:=90;Line:='214121';end;
- with Kody[091]do begin Asc:='{ESC}';Asc2:='{';Asc3:='91';Kod:=91;Line:='412121';end;
- with Kody[092]do begin Asc:='{FS}';Asc2:='|';Asc3:='92';Kod:=92;Line:='111143';end;
- with Kody[093]do begin Asc:='{GS}';Asc2:='}';Asc3:='93';Kod:=93;Line:='111341';end;
- with Kody[094]do begin Asc:='{RS}';Asc2:='~';Asc3:='94';Kod:=94;Line:='131141';end;
- with Kody[095]do begin Asc:='{US}';Asc2:='{DEL}';Asc3:='95';Kod:=95;Line:='114113';end;
- with Kody[096]do begin Asc:='{FNC3}';Asc2:='{FNC3}';Asc3:='96';Kod:=96;Line:='113311';end;
- with Kody[097]do begin Asc:='{FNC2}';Asc2:='{FNC2}';Asc3:='97';Kod:=97;Line:='411113';end;
- with Kody[098]do begin Asc:='{ SHIFT }';Asc2:='{ SHIFT }';Asc3:='98';Kod:=98;Line:='411311';end;
- with Kody[099]do begin Asc:='{ CODE C }';Asc2:='{ CODE C }';Asc3:='99';Kod:=99;Line:='113141';end;
-
- with Kody[100]do begin Asc:='{ CODE B }';Asc2:='{FNC4}';Asc3:='{ CODE B }';Kod:=100;Line:='114131';end;
- with Kody[101]do begin Asc:='{FNC4}';Asc2:='{ CODE A }';Asc3:='{ CODE A }';Kod:=101;Line:='311141';end;
- with Kody[102]do begin Asc:='{FNC1}';Asc2:='{FNC1}';Asc3:='{FNC1}';Kod:=102;Line:='411131';end;
-
- with Kody[103]do begin Asc:='{ START A }';Asc2:=Asc;Asc3:=Asc;Kod:=103;Line:='211412';end;
- with Kody[104]do begin Asc:='{ START B }';Asc2:=Asc;Asc3:=Asc;Kod:=104;Line:='211214';end;
- with Kody[105]do begin Asc:='{ START C }';Asc2:=Asc;Asc3:=Asc;Kod:=105;Line:='211232';end;
-
- with Kody[106]do begin Asc:='{ STOP }';Asc2:=Asc;Asc3:=Asc;Kod:=106;Line:='2331112';end;
- end.
-