📜 ⬆️ ⬇️

Documentation generator using built-in 1C: Enterprise 8.3.10 language

Good afternoon! A couple of weeks ago, I read forums and prepared universal processing in the embedded language 1C that analyzes the source code of any reports and processing "1C: Enterprise 8". The source code analysis was caused by the appearance of sales on my homepage. Attempts to write manual documentation for several thousand files were not successful.
Step one:

- Create tables for analyzing the source code of a single module (for debugging a template):

image

- Create a layout for outputting the source code of a single module to the documentation:

image

- Create procedures for analyzing the source code of a single module:

&  () (""); = ; .(); .();  =1  .()  =.(); =.(); .=; .=; ;  &  ()  ; .();        (.,"")<>0   .=.-4;  ; =.(); =(.,"("); 1=(.(0)," "); .=1.(1); .=.; ;  (.,"")<>0   .=.-4;  ; =.(); =(.,"("); 1=(.(0)," "); .=1.(1); .=.; ; ; .=.()-2;  &  ()        =.  .  =.(); =..(); .=.; .=.;  (.,"")<>0   (.,"")<>0  =(.,".");  =0  .()-1   +1<.()   (.(+1),5)=""  =..( ("",.()));  .()=0  =..(); .=.(); .=.; .=" "+.(); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; ; ; ; 1=(.,"()");  1.()<=5   (.,"")=0   (.,"")<>0   (1.(1),"")<>0  =..( ("","="+1.(2)));  .()=0  =..(); .="="+1.(2); .=.; ;  =..( ("","="+1.(1)));  .()=0  =..(); .="="+1.(1); .=.; ; ;  =..( ("","="+1.(1)));  .()=0  =..(); .="="+1.(1); .=.; ; ;   (.,"")<>0  =..( ("","="+1.(2)));  .()=0  =..(); .="="+1.(2); .=.; ;  =..( ("","="+1.(2)));  .()=0  =..(); .="="+1.(2); .=.; ; ; ;   (.,"")<>0  =..( ("","="+1.(1.()-3)));  .()=0  =..(); .="="+1.(1.()-3); .=.; ;  =..( ("","="+1.(1.()-3)));  .()=0  =..(); .="="+1.(1.()-3); .=.; ; ; ; ;  (.,"|")<>0  =(.,".");  (.(.()-1),"  ")<>0  =..( ("",(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4)));  .()=0  =..(); .=(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); .=.; .=" "+(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); 1=(.(.()-1),"  "); .=1.(1.()-1); ;  =..( ("",.(.()-1)));  .()=0  =..(); .=.(.()-1); .=.; .=" "+.(.()-1); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; ; ;  (.,"Object")<>0  =(.,(34)); 1=(.(1),"."); =..( ("",1.(1)));  .()=0  =..(); .=1.(1); .=.; .="    "+1.(1); 2=(.,"=");  (2.(0),".")=0  .=(2.(0)); ; ; ; ;  (.,".")<>0   (.,"")<>0  =(.,"."); =..( ("",.(1)));  .()=0  =..(); .=.(1); .=.; .=" "+.(1); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; 1=(.,"()"); 2=(1.(1),","); =..( ("","="+2.(0)));  .()=0  =..(); .="="+2.(0); .=.; ; =..( ("","="+2.(1)));  .()=0  =..(); .="="+2.(1); .=.; ; ;  (.,"|")<>0  =(.,".");  (.(.()-1),"  ")<>0  =..( ("",(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4)));  .()=0  =..(); .=(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); .=.; .=" "+(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ;  =..( ("",.(.()-1)));  .()=0  =..(); .=.(.()-1); .=.; .=" "+.(.()-1); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; ; ;  (.,"Object")<>0  =(.,(34)); 1=(.(1),"."); =..( ("",1.(1)));  .()=0  =..(); .=1.(1); .=.; .="    "+1.(1); 2=(.,"=");  (2.(0),".")=0  .=(2.(0)); ; ; ; ;  (.,"")<>0   (.,"")<>0  =(.,"."); =..( ("",.(1)));  .()=0  =..(); .=.(1); .=.; .=" "+.(1); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; ;  (.,"|")<>0  =(.,".");  (.(.()-1),"  ")<>0  =..( ("",(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4)));  .()=0  =..(); .=(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); .=.; .=" "+(.(.()-1),1,(.(.()-1))-(.(.()-1),"  ")-4); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ;  =..( ("",.(.()-1)));  .()=0  =..(); .=.(.()-1); .=.; .=" "+.(.()-1); 1=(.,"=");  (1.(0),".")=0  .=(1.(0)); ; ; ; ;  (.,"Object")<>0  =(.,(34)); 1=(.(1),"."); =..( ("",1.(1)));  .()=0  =..(); .=1.(1); .=.; .="    "+1.(1); 2=(.,"=");  (2.(0),".")=0  .=(2.(0)); ; ; ; ; ; ;  &  ()           .   (.)<>""   =.  .  =.();  (.,(.)+".")<>0  =(.,"."); 1=(.(1),"=");  (1.(0),"(")=0   (1.(0),(34))=0   (1.(0),"")=0   (1.(0),")")=0   (1.(0),(.))=0  =..( ("",((1.(0)," ",""),";","")));  .()=0  =..(); .=((1.(0)," ",""),";",""); .=.; ; ; ; ; ; ; ; ; ; ; ;  &  ()           .   (.)<>""   =.  .  =.();  (.,(.)+".")<>0  .=; ; ; ; ; ;  &  ()  =  ;  = ("").("");  = .(""); .();  = .(""); .(); = ; ..("");           .  =.( ("",.));  .()=0  =.(); .=.; ; ; ; .(" "); =0;       =+1;  = .(""); .. = ; .. = .; .(); ;  = .(""); .(); = ; ..("");           .      .  =.( ("",.+"."+.));  .()=0  =.(); .=.+"."+.; ; ; ; ; .(" "); =0;       =+1;  = .(""); .. = ; .. = .; .(); ;  = .(""); .(); = ; ..("");           .      .  =.( ("",.+"."+.));  .()=0  =.(); .=.+"."+.; ; ; ; ; .(" "); =0;       =+1;  = .(""); .. = ; .. = .; .(); ;  = .(""); .(); = ; ..("");           .   .=  =.( ("",.));  .()=0  =.(); .=.; ; ; ; ; .(" "); =0;       =+1;  = .(""); .. = ; .. = .; .(); ; . = ; . = ;  
Step two:

- Enumeration of all files of reports and processings for unpacking and analysis:

 &  (,,)  = (+"\"+, "*.*",);  =0  .()-1  =.();  .()=   (.,5+())="8.3\"++"\"  1 = (+"\"++"\"+., "*.epf",);  1.()<>0  =.(); .=; .=; .=.;  1=0  1.()-1  1=1.(1);  1.()=   (1.,(1.)-2)<>"(1)"  =..(); .=1.; 4 = (+"\8.3\"++"\"+.+"\"+1., "*.*",);  4.()=0   =  (+"\8.3\"++"\"+.+"\"+1.); ; ; 2 = (+"\8.3\"++"\"+.+"\"+1., "*.*",);  2.()=0   =  (+"\8.3\"++"\"+.+"\"+1.); =+"\8.3\"++"\"+.+"\"+1.; =+"\"++"\"+.+"\"+1.; ("UnpackV8.exe -parse "+(34)++(34)+" "+(34)++(34)); ; ; 2 = (+"\8.3\"++"\"+.+"\"+1., "*.0",);  2.()<>0   2=0  2.()-1  2=2.(2);  2.()=  3 = (+"\8.3\"++"\"+.+"\"+1.+"\"+2., "*.*",);  3.()<>0   3=0  3.()-1  3=3.(3);  3.()=  =..(); .=3.; ; ; ;  =..(); .=2.; ; ; ; ; ; ; ; ; ; ;  &  (,,)  = (+"\"+, "*.*",);  =0  .()-1  =.();  .()=   (.,5+())="8.3\"++"\"  1 = (+"\"++"\"+., "*.erf",);  1.()<>0  =.(); .=; .=; .=.;  1=0  1.()-1  1=1.(1);  1.()=   (1.,(1.)-2)<>"(1)"  =..(); .=1.; 4 = (+"\8.3\"++"\"+.+"\"+1., "*.*",);  4.()=0   =  (+"\8.3\"++"\"+.+"\"+1.); ; ; 2 = (+"\8.3\"++"\"+.+"\"+1., "*.*",);  2.()=0   =  (+"\8.3\"++"\"+.+"\"+1.); =+"\8.3\"++"\"+.+"\"+1.; =+"\"++"\"+.+"\"+1.; ("UnpackV8.exe -parse "+(34)++(34)+" "+(34)++(34)); ; ; 2 = (+"\8.3\"++"\"+.+"\"+1., "*.0",);  2.()<>0   2=0  2.()-1  2=2.(2);  2.()=  =..(); .=2.; ; ; ; ; ; ; ; ; ; ;  

- Writing documentation to the DBMS:

 &  (,,,,) =0; =0; =0;        ..()<>0  =..();     .   .=  =+1; ;  ..()<>0  =..(); ; ; ; ;  <>0  = ;  =  .(+"\8.3\"++"\"+()+".sql",.UTF8);  .(+"\8.3\"++"\"+()+".sql",.UTF8); ; ="INSERT INTO u8051_4.apps (`idr`,`name`,`text`,`img`,`url`,`data`,`status`,`idu`,`pop`,`price`) VALUES ("++",'"++"','"; =+"<h1>      ("++")<br></h1>"; =+"<h1>    <a href=http://icanmakeit.ru/index.php?pg=magazin&d="++">"+(,"\"," ( ")+")</a>.<br></h1>"; =+"<br>"; =+"<h4>   :<br></h4>"; .();           .  =.( ("",.));  .()=0  =.(); .=.; ; ; ; .(" "); =0;       =+1; =+()+" "+.+"<br>"; ;  <>0  =+"<br>"; =+"<h4>    :<br></h4>"; .();           .      .  =.( ("",.+"."+.));  .()=0  =.(); .=.+"."+.; ; ; ; ; .(" "); =0;       =+1; =+()+" "+.+"<br>"; ; ; =+"<br>"; =+"<h4>  :<br></h4>"; .();           .      .  =.( ("",.+"."+.));  .()=0  =.(); .=.+"."+.; ; ; ; ; .(" "); =0;       =+1; =+()+" "+.+"<br>"; ;  <>0  =+"<br>"; =+"<h4>      ()   :<br></h4>"; .();           .   .=  =.( ("",.));  .()=0  =.(); .=.; ; ; ; ; .(" "); =0;       =+1; =+()+" "+.+"<br>"; ; ; .();  =  .(+"\8.3\"++"\"+()+".sql",.UTF8);  .(+"\8.3\"++"\"+()+".sql",.UTF8); ; ;  &  () =1; =0;  .()<>0  =.(0);  ..()<>0  =..(0); =+1; .(); .();     .  =.; (); (); (); (); (); ; (.); (.,.,.,.,); ..(0);  =10  =+1; = ;  =  .(+"\8.3\"++"\"+()+".sql",.UTF8);  .(+"\8.3\"++"\"+()+".sql",.UTF8); ; ; ; ;  ..()=0  ("move "+(34)++"\8.3\"++"\"+.+(34)+" "+(34)++"\8.3\OLD\"++"\"+.+(34)); .(0); ;  =10  =0; ; ;  
Step Three:

- Enumeration of all files of reports and treatments for creating screenshots:

 &  ()  =   = .();  = .();   = .();  = .(); ;   (",", , .);  &  (,,,)  = "";   = (, , , );  = ();  =  =("."+ . +".");  =("."+ . +"."); ; .();  = +"\"++"\"++"\"++".jpg"; Shell =  COM("WScript.Shell");  = """& {[void][Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');" + "$size = [Windows.Forms.SystemInformation]::VirtualScreen;" + "$bitmap = new-object Drawing.Bitmap $size.width, $size.height;" + "$graphics = [Drawing.Graphics]::FromImage($bitmap);" + "$graphics.CopyFromScreen($size.location,[Drawing.Point]::Empty, $size.size);" + "$graphics.Dispose();" + "$bitmap.Save('"++"');" + "$bitmap.Dispose()}"""; WshExec = Shell.Run("PowerShell -Command "+, 0, "True");//0 -   , "True" -        .();  ;  &  ()  = (+"\"+, "*.*",);  =0  .()-1  =.();  .()=   (.,1+())=+"\"  1 = (+"\"++"\"+., "*.*",);  1.()<>0   1=0  1.()-1  1=1.(1); 2 = (+"\"++"\"+., 1.+".jpg",);  2.()=0  (+"\"++"\"+.+"\"+1.+".epf",,.,1.); ; ; ; ; ;  &  ()  = (+"\"+, "*.*",);  =0  .()-1  =.();  .()=   (.,1+())=+"\"  1 = (+"\"++"\"+., "*.*",);  1.()<>0   1=0  1.()-1  1=1.(1); 2 = (+"\"++"\"+., 1.+".jpg",);  2.()=0  (+"\"++"\"+.+"\"+1.+".erf",,.,1.); ; ; ; ; ;  

You ask how I got to "this"?

The answer comes (if I dig a little in my memory with a psychologist): - 17 years ago I “worked” in a friendly team of Distar Electronics (Perm) as a programmer. I can’t call it work at all (first experience as a programmer). I remember all the guys and remember with tears how I miss them. Unfortunately, there’s no way to find the coordinates of the developer of the 1C: Enterprise 7.7 program (it was he who let me read the source code of one of the DLLs - the forbidden fruit). With respect

')

Source: https://habr.com/ru/post/357698/


All Articles