<?xml version="1.0" encoding="windows-1251"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://vanguger.mybb.ru/export.php?type=rss" rel="self" type="application/rss+xml" />
		<title>Тестовый</title>
		<link>https://vanguger.mybb.ru/</link>
		<description>Тестовый</description>
		<language>ru-ru</language>
		<lastBuildDate>Mon, 06 Mar 2023 02:30:17 +0300</lastBuildDate>
		<generator>MyBB/mybb.ru</generator>
		<item>
			<title>Тестовое сообщение</title>
			<link>https://vanguger.mybb.ru/viewtopic.php?pid=1#p1</link>
			<description>&lt;p&gt;Тест автоматической подсветки кода, для разных тем.&lt;/p&gt;&lt;div class=&quot;code-box&quot;&gt;&lt;strong class=&quot;legend&quot;&gt;Код:&lt;/strong&gt;&lt;div class=&quot;blockcode&quot;&gt;&lt;div class=&quot;scrollbox&quot; style=&quot;height: 35em&quot;&gt;&lt;pre&gt;
;.  ________           _____    _________     _________     
;.  ___  __/_____________  /_   __  ____/___________  /____ 
;.  __  /  _  _ \_  ___/  __/   _  /    _  __ \  __  /_  _ \
;.  _  /   /  __/(__  )/ /_     / /___  / /_/ / /_/ / /  __/
;.  /_/    \___//____/ \__/     \____/  \____/\__,_/  \___/ 

; © Webarion
; Version 0.1a

EnableExplicit

DeclareModule Settings
  
  EnableExplicit
  
  XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Config.pb&amp;quot; ; подключение конфигурации
  
  Macro Change_MapElement_Settings(MyMap, MapElement)
    FindMapElement( MyMap, PeekS( PeekI( MapElement - SizeOf(Integer) ) ) )
  EndMacro
  
  ;- ОБЪЯВЛЕНИЕ РЕГУЛЯРНЫХ ВЫРАЖЕНИЙ
  Enumeration REGEXP
    #REGEX_Get_Comment_Or_Space
    #REGEX_Split_Link_Line
    #REGEX_Get_Link
    #REGEX_Name_Section_Line
    #REGEX_Item_Line
    #REGEX_Parameter
  EndEnumeration
  
  ;- ОБЪЯВЛЕНИЕ ПОЛЬЗОВАТЕЛЬСКИХ ПРОЦЕДУР                                                                                                
  
  ; Container
  Declare   Set_Container( Container$ )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  Declare.a Examine_Containers()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  Declare   Next_Container()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  Declare.s Get_Current_Container_Name()  
  
  ; Section
  Declare   Set_Section( Container$, Section$, Comment$ = &amp;quot;&amp;quot;, CommentPos.a = 1 )     
  Declare.a Examine_Sections( Container$ )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  Declare   Next_Section()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  Declare.s Get_Current_Section_Name()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
  
  ; Item
  Declare   Examine_Items( Container$, Section$ )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  Declare   Next_Item()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  Declare.s Get_Current_Item_Name()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  Declare.s Get_Current_Item_Value()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  Declare.a Set_Item_String( Container$, Section$, Item$, Value$, Comment$ = &amp;quot;&amp;quot;, CommentPos.a = 1 )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  Declare.s Get_Item_String( Container$, Section$, Item$, Default_Value$ = &amp;quot;&amp;quot; )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  Declare.s Get_Item_Template_String( Container$, Section$, Item$, Default_Value$ = &amp;quot;&amp;quot; )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  Declare   Set_Item_Integer( Container$, Section$, Item$, Value, Comment$ = &amp;quot;&amp;quot;, CommentPos.a = 1 )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  Declare   Get_Item_Integer( Container$, Section$, Item$, Default_Value = 0 )
  
  ; Param
  Declare   Examine_Params( Container$, Section$, Item$ )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  Declare   Next_Param()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  Declare.s Get_Current_Param_Name()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
  Declare.s Get_Current_Param_Value()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  Declare   Set_Param_String( Container$, Section$, Item$, Param$, Value$ )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  Declare.s Get_Param_String( Container$, Section$, Item$, Param$, Default_Value$ = &amp;quot;&amp;quot; )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  Declare   Set_Param_Integer( Container$, Section$, Item$, Param$, Value )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  Declare   Get_Param_Integer( Container$, Section$, Item$, Param$, Default_Value = 0 )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
  Declare   Set_Parameters_String( Container$, Section$, Item$, Param1.s, Value1.s, Param2.s = &amp;quot;&amp;quot;, Value2.s = &amp;quot;&amp;quot;, Param3.s = &amp;quot;&amp;quot;, Value3.s = &amp;quot;&amp;quot;, Param4.s = &amp;quot;&amp;quot;, Value4.s = &amp;quot;&amp;quot;, Param5.s = &amp;quot;&amp;quot;, Value5.s = &amp;quot;&amp;quot;, Param6.s = &amp;quot;&amp;quot;, Value6.s = &amp;quot;&amp;quot;, Param7.s = &amp;quot;&amp;quot;, Value7.s = &amp;quot;&amp;quot;, Param8.s = &amp;quot;&amp;quot;, Value8.s = &amp;quot;&amp;quot;, Param9.s = &amp;quot;&amp;quot;, Value9.s = &amp;quot;&amp;quot;, Param10.s = &amp;quot;&amp;quot;, Value10.s = &amp;quot;&amp;quot;, Param11.s = &amp;quot;&amp;quot;, Value11.s = &amp;quot;&amp;quot;, Param12.s = &amp;quot;&amp;quot;, Value12.s = &amp;quot;&amp;quot;, Param13.s = &amp;quot;&amp;quot;, Value13.s = &amp;quot;&amp;quot;, Param14.s = &amp;quot;&amp;quot;, Value14.s = &amp;quot;&amp;quot;, Param15.s = &amp;quot;&amp;quot;, Value15.s = &amp;quot;&amp;quot;, Param16.s = &amp;quot;&amp;quot;, Value16.s = &amp;quot;&amp;quot;, Param17.s = &amp;quot;&amp;quot;, Value17.s = &amp;quot;&amp;quot;, Param18.s = &amp;quot;&amp;quot;, Value18.s = &amp;quot;&amp;quot;, Param19.s = &amp;quot;&amp;quot;, Value19.s = &amp;quot;&amp;quot;, Param20.s = &amp;quot;&amp;quot;, Value20.s = &amp;quot;&amp;quot;, Param21.s = &amp;quot;&amp;quot;, Value21.s = &amp;quot;&amp;quot;, Param22.s = &amp;quot;&amp;quot;, Value22.s = &amp;quot;&amp;quot;, Param23.s = &amp;quot;&amp;quot;, Value23.s = &amp;quot;&amp;quot;, Param24.s = &amp;quot;&amp;quot;, Value24.s = &amp;quot;&amp;quot;, Param25.s = &amp;quot;&amp;quot;, Value25.s = &amp;quot;&amp;quot;, Param26.s = &amp;quot;&amp;quot;, Value26.s = &amp;quot;&amp;quot;, Param27.s = &amp;quot;&amp;quot;, Value27.s = &amp;quot;&amp;quot;, Param28.s = &amp;quot;&amp;quot;, Value28.s = &amp;quot;&amp;quot;, Param29.s = &amp;quot;&amp;quot;, Value29.s = &amp;quot;&amp;quot;, Param30.s = &amp;quot;&amp;quot;, Value30.s = &amp;quot;&amp;quot; ) 
  
  ; Other
  Declare   Load_File( FilePath$, Container$ = &amp;quot;&amp;quot;, Flags_File = #PB_UTF8 )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  Declare   Save_File( FilePath$, Container$ = &amp;quot;&amp;quot;, Flags_File = #PB_UTF8 )                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  Declare   Free_RegEx() 
  
  ; ОБЪЯВЛЕНИЕ АРХИТЕКТУРЫ
  ; на данный момент, используется единственная архитектура по умолчанию
  ; #SETTINGS_ARCHITECTURE = #Architecture_Default
  
  XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Architectures&amp;quot;+#PS$+&amp;quot;Default_Architecture&amp;quot;+#PS$+&amp;quot;Default_Architecture_Declares.pb&amp;quot;
  
  ;- ОБЪЯВЛЕНИЕ РАСШИРЕНИЙ
  
  ;- - COMMENTS
  ; расширение, позволяющее создавать комментарии
  CompilerIf #EXTENSION_COMMENTS
    XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Extensions&amp;quot;+#PS$+&amp;quot;Comments&amp;quot;+#PS$+&amp;quot;Comments_Declares.pb&amp;quot;
  CompilerEndIf
  
  ;- - TREE
  ; расширение, позволяющее читать и сохранять древовидную конфигурацию
  ; Пример .:Item1 = Value1
  ;         :  Item2 = Value2
  ;         :    Item3 = Value3
  CompilerIf #EXTENSION_TREE
    XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Extensions&amp;quot;+#PS$+&amp;quot;Tree&amp;quot;+#PS$+&amp;quot;Tree_Declares.pb&amp;quot;
  CompilerEndIf
  
EndDeclareModule

Module Settings
  
  ;- СИСТЕМНЫЕ ПРОЦЕДУРЫ                                                                                                            
  
  XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;RegexReplace.pb&amp;quot;
  
  ; очищает строку от пробелов
  Procedure.s _Clear_All_Space_String(Text$)
    While FindString(Text$, &amp;quot; &amp;quot;) : Text$ = ReplaceString(Text$, &amp;quot; &amp;quot;, &amp;quot;&amp;quot;) : Wend 
    ProcedureReturn Text$
  EndProcedure
  
  ; #СИСТЕМНАЯ ПРОЦЕДУРА# ============================================================================================================
  ; Описание ...: Ищет в тексте неэкранированную строку
  ; Параметры ..: Text$        - Текст, в котором происходит поиск
  ;             : Search_Text$ - Строка поиска
  ;             : Escape_Text$ - Экранирующий текст
  ; Возвращает .: Позицию строки от начала (первый символ = 1), если строка найдена и не экранирована
  ;             : #False - Если строка не найдена, либо данная строка экранирована
  ; ==================================================================================================================================
  Procedure _Find_Text_Not_Escape( Text$, Search_Text$, Escape_Text$ )
    Protected Find_Text = FindString( Text$, Search_Text$, 1 )
    Protected Find_Escape = FindString( Text$, Escape_Text$, Find_Text - Len(Escape_Text$) )
    If Not Find_Escape And Find_Text
      ProcedureReturn Find_Text
    EndIf
    ProcedureReturn #False
  EndProcedure
  
  ; создаёт регулярные выражения, если их нет
  Procedure _Create_RegEx()
    
    ; определяет, является ли строка комментарием либо пустой строкой
    If Not IsRegularExpression( #REGEX_Get_Comment_Or_Space )
      CreateRegularExpression( #REGEX_Get_Comment_Or_Space, &amp;quot;^\s*;|^\s*$&amp;quot; )
    EndIf   

    ; определение ссылок шаблонизатора в строке
    If Not IsRegularExpression( #REGEX_Get_Link )
      CreateRegularExpression( #REGEX_Get_Link, &amp;quot;(?&amp;lt;!\\)\{\s*(.+?)\s*\}&amp;quot; ) ; с двоеточием: &amp;quot;(?&amp;lt;!\\)\{\s*(.+?)\s*(?::(.+?))?\s*\}&amp;quot;
    EndIf     
    
    ; получение вложенностей базы относительно ссылки шаблонизатора
    If Not IsRegularExpression( #REGEX_Split_Link_Line)
      CreateRegularExpression( #REGEX_Split_Link_Line, &amp;quot;\s*((?:[^\\/]|\\\/)+)&amp;quot; )
    EndIf 
    
    ; определение имени секции
    If Not IsRegularExpression( #REGEX_Name_Section_Line )
      CreateRegularExpression( #REGEX_Name_Section_Line, &amp;quot;^\s*\[(.*)\]&amp;quot; )
    EndIf 
    
    ; определение элемента
    If Not IsRegularExpression( #REGEX_Item_Line )
      CreateRegularExpression( #REGEX_Item_Line, &amp;quot;^(\s*)(.+?)\s*(:|=)\s*(.+?)\s*$&amp;quot; ) ;&amp;quot;^(\s*)(?:([^:]+?)\s*(?&amp;lt;!\\)=\s*(.*?)\s*|([^=]+?)\s*(?&amp;lt;!\\):\s*(.*)\s*)$&amp;quot; )
    EndIf 

    If Not IsRegularExpression( #REGEX_Parameter )
      CreateRegularExpression( #REGEX_Parameter, &amp;quot;\s*(.*?)\s*(?:(?&amp;lt;!\\)=\s*(.*?))?\s*(?:[^\\]\||\z)&amp;quot; )
    EndIf 
  EndProcedure
  _Create_RegEx()

  ;- ПОДКЛЮЧЕНИЕ ПРОЦЕДУР АРХИТЕКТУРЫ
  ; на данный момент включает единственную архитектуру по умолчанию
  XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Architectures&amp;quot;+#PS$+&amp;quot;Default_Architecture&amp;quot;+#PS$+&amp;quot;Default_Architecture_Procedures.pb&amp;quot; 
  
  
  ;- --- LINKS
  
  ; разделяет ссылку шаблонизатора на уровни иерархии
  Procedure _Split_Link( Line$, List lList$() )
    If IsRegularExpression( #REGEX_Split_Link_Line )
      ClearList( lList$() ) 
      If ExamineRegularExpression( #REGEX_Split_Link_Line, Line$ )
        While NextRegularExpressionMatch( #REGEX_Split_Link_Line )
          AddElement( lList$() )
          lList$() = Trim( RegularExpressionGroup( #REGEX_Split_Link_Line, 1) )
        Wend
      EndIf
    EndIf
  EndProcedure
  
  ; #СИСТЕМНАЯ ПРОЦЕДУРА# ============================================================================================================
  ; Описание ...: Процедура линкера. Заменяет ссылку на данные, расположенные по этой ссылке
  ; ==================================================================================================================================
  Global NewMap g_History_Link$()
  
  ; декларация внутренней процедуры линкера.
  Declare.s _Get_Link_String( Link$, Default_Value$ = &amp;quot;&amp;quot;, Container$ = &amp;quot;&amp;quot; ) 
  
  Procedure.s _Replace_Link( Line$, Container$ = &amp;quot;&amp;quot; )
    
    ; ищем ссылки линкера
    If IsRegularExpression( #REGEX_Get_Link ) And ExamineRegularExpression( #REGEX_Get_Link, Line$ )
      While NextRegularExpressionMatch( #REGEX_Get_Link )
        Define Find_Text$ = Trim( RegularExpressionMatchString( #REGEX_Get_Link ) )
        Define Link$      = RegularExpressionGroup( #REGEX_Get_Link, 1 )
        
        Define NoSpace_Find$ = LCase( _Clear_All_Space_String(Find_Text$) ) ; удаляем все пробелы из строки
        
        If Link$
          Define Find_History = FindMapElement( g_History_Link$(), NoSpace_Find$ ) ; узнаём записана ли ссылка в истории
          AddMapElement( g_History_Link$(), NoSpace_Find$ )
          
          If Find_History ; если ссылка найдена в истории, значит она циклическая, сбрасываем историю и выходим без преобразования ссылки
            ClearMap( g_History_Link$() )
            ProcedureReturn Line$
          EndIf
          
          Define Replace$ = _Get_Link_String( Link$, &amp;quot;&amp;quot;, Container$ ) ; TODO DEFAULT 
          Line$ = ReplaceString(Line$, Find_Text$, Replace$, #PB_String_NoCase)

        EndIf
      Wend
    EndIf
    ProcedureReturn Line$
  EndProcedure

  Procedure.s _Get_Replace_Link_Item_String( Container$, Section$, Item$, Default_Value$ = &amp;quot;&amp;quot; )
    Default_Value$ = _Get_Item_String( Container$, Section$, Item$, Default_Value$ )
    ProcedureReturn _Replace_Link( Default_Value$, Container$ )
  EndProcedure
  
  Procedure.s _Get_Replace_Link_Param_String( Container$, Section$, Item$, Param$, Default_Value$ = &amp;quot;&amp;quot; )
    Default_Value$ = _Get_Param_String( Container$, Section$, Item$, Param$, Default_Value$ )
    ProcedureReturn _Replace_Link( Default_Value$, Container$ )
  EndProcedure
  
  Procedure.s _Get_Link_String( Link$, Default_Value$ = &amp;quot;&amp;quot;, Container$ = &amp;quot;&amp;quot; )
    Protected NewList Hierarchy$(), Section$, Item$, Param$
    _Split_Link( Link$, Hierarchy$() )
    FirstElement( Hierarchy$() )
    Select ListSize( Hierarchy$() ) 
      Case 1 ; поиск в &amp;quot;&amp;quot;/Item - когда Section пустой
        ProcedureReturn _Get_Replace_Link_Item_String( Container$, &amp;quot;&amp;quot;, Hierarchy$(), Default_Value$ )
      Case 2 ; поиск в Section/Item
        Section$ = Hierarchy$()
        NextElement( Hierarchy$() )
        Item$ = Hierarchy$()
        ProcedureReturn _Get_Replace_Link_Item_String( Container$, Section$, Item$, Default_Value$ )
      Case 3  ; поиск в Section/Item/Param
        Section$ = Hierarchy$()
        NextElement( Hierarchy$() )
        Item$    = Hierarchy$()
        NextElement( Hierarchy$() )
        Param$   = Hierarchy$()
        ProcedureReturn _Get_Replace_Link_Param_String( Container$, Section$, Item$, Param$, Default_Value$ )
    EndSelect  
    ProcedureReturn Default_Value$
  EndProcedure
  
  ;- ПОДКЛЮЧЕНИЕ ПРОЦЕДУР РАСШИРЕНИЙ                                                                                                          
  CompilerIf #EXTENSION_COMMENTS
    XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Extensions&amp;quot;+#PS$+&amp;quot;Comments&amp;quot;+#PS$+&amp;quot;Comments_Procedures.pb&amp;quot;
  CompilerEndIf
  
  CompilerIf #EXTENSION_TREE
    XIncludeFile &amp;quot;Internal&amp;quot;+#PS$+&amp;quot;Extensions&amp;quot;+#PS$+&amp;quot;Tree&amp;quot;+#PS$+&amp;quot;Tree_Procedures.pb&amp;quot;
  CompilerEndIf
  
  ;- ПОДКЛЮЧЕНИЕ ПОЛЬЗОВАТЕЛЬСКИХ ПРОЦЕДУР                                                                                                   
  
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;3_Containers.pb&amp;quot;
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;4_Sections.pb&amp;quot;
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;5_Items.pb&amp;quot;
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;6_Params.pb&amp;quot;
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;7_Load_Save.pb&amp;quot;
  XIncludeFile &amp;quot;User_Procedures&amp;quot;+#PS$+&amp;quot;8_RegEx.pb&amp;quot;
  
  ; #ПОЛЬЗОВАТЕЛЬСКАЯ ПРОЦЕДУРА# ============================================================================================================
  ; Описание ...: Получает данные, по иерархической ссылке
  ; Параметры ..: Link$ - Иерархическая ссылка к данным. Например: Elements/Начало/Default
  ;             : Container$ [ По умолчанию = &amp;quot;&amp;quot; ] - контейнер, внутри которого будут извлечены данные
  ; Возвращает .: данные из базы данных, соответствующие иерархической ссылке
  ; Пример .....: Get_Link_String( &amp;quot;SectionName/ItemName/ParamName&amp;quot;, &amp;quot;ContainerName&amp;quot; )
  ; =========================================================================================================================================
  Procedure.s Get_Link_String( Link$, Default_Value$ = &amp;quot;&amp;quot;, Container$ = &amp;quot;&amp;quot; )
    ClearMap( g_History_Link$() ) ; сбрасываем предохранитель от циклических ссылок
    ProcedureReturn _Get_Link_String( Link$, Default_Value$, Container$ )
  EndProcedure
  
EndModule

; Математика прямоугольников

Procedure.l _Min( a.l, b.l )
  If( a &amp;lt; b ) : ProcedureReturn a : EndIf
  ProcedureReturn b
EndProcedure

Procedure.l _Max( a.l, b.l )
  If( a &amp;lt; b ) : ProcedureReturn b : EndIf
  ProcedureReturn a
EndProcedure  

; проверяет, пересекаются ли структуры прямоугольников
Procedure.a _Is_Intersection_StrRectangles( *R1.DefRect, *R2.DefRect )
  If ( *R1\x + *R1\w &amp;gt; *R2\x ) And ( *R2\x + *R2\w &amp;gt; *R1\x ) And 
     ( *R1\y + *R1\h &amp;gt; *R2\y ) And ( *R2\y + *R2\h &amp;gt; *R1\y )
    ProcedureReturn #True
  EndIf
  ProcedureReturn #False
EndProcedure

; получает пересечение двух указанных структур прямоугольников и записывает его по адресу указанной структуры
; возвращает #True в случае успеха, в противном случае #False
Procedure.a _Get_Intersection_StrRectangles( *R1.DefRect, *R2.DefRect, *RetRect.DefRect )
  If _Is_Intersection_StrRectangles( *R1, *R2 ) ; если пересекаются
    Protected Rect.DefRect
    With Rect
      \x = _Max( *R1\x, *R2\x )
      \w = _Min( *R1\x + *R1\w, *R2\x + *R2\w ) - \x
      \y = _Max( *R1\y, *R2\y )
      \h = _Min( *R1\y + *R1\h, *R2\y + *R2\h ) - \y
    EndWith
    CopyStructure( @Rect, *RetRect, DefRect)
    ProcedureReturn #True
  EndIf
  ProcedureReturn #False
EndProcedure

; отвечает, находится ли прямоугольник 1 внутри прямоугольника 2
Procedure.a _Rect1_Inside_Rect2( *R1.DefRect, *R2.DefRect )
  If *R1\X &amp;gt;= *R2\X And *R1\X+*R1\W &amp;lt;= *R2\X+*R2\W And *R1\Y &amp;gt;= *R2\Y And *R1\Y+*R1\H &amp;lt;= *R2\Y+*R2\H 
    ProcedureReturn #True
  EndIf
  ProcedureReturn #False
EndProcedure

; получает четыре отсечения по четырём сторонам, между старым и новым прямоугольниками
; записывает результат в *RetRects
; возвращает соответствующие найденным сторонам флаги
; если прямоугольники не пересекаются, возвращается флаг 16
Procedure.a _Get_Four_Rects_Intersection( *Old.DefRect, *New.DefRect, *RetRects.FourRects )
  Protected RetTypes.a = 0
  If Not _Is_Intersection_StrRectangles( *Old, *New )
    ProcedureReturn 16
  EndIf
  Protected MaxONX.l = _Max( *Old\x, *New\x )
  Protected MinONX.l = _Min( *Old\x+*Old\w, *New\x+*New\w )
  
  With *RetRects
    ; верхний
    If *New\y &amp;lt; *Old\y
      \t\x = MaxONX
      \t\y = *New\y
      \t\w = MinONX - \t\x
      \t\h = _Max( *Old\y, *New\y ) - \t\y
      RetTypes | 1
    EndIf
    ; левый
    If *New\x &amp;lt; *Old\x
      \l\x = *New\x
      \l\y = *New\y
      \l\w = *Old\x - \l\x
      \l\h = *New\h
      RetTypes | 2
    EndIf
    ; правый
    Protected NewXE.l = *New\x + *New\w
    Protected OldXE.l = *Old\x + *Old\w
    If NewXE &amp;gt; OldXE
      \r\x = OldXE
      \r\y = *New\y
      \r\w = NewXE - \r\x
      \r\h = *New\h
      RetTypes | 4
    EndIf
    ; нижний
    Protected NewYE.l = *New\y + *New\h
    Protected OldYE.l = *Old\y + *Old\h
    If NewYE &amp;gt; OldYE
      \b\x = MaxONX
      \b\y = OldYE
      \b\w = MinONX - \b\x
      \b\h = NewYE  - \b\y
      RetTypes | 8
    EndIf
  EndWith
  ProcedureReturn RetTypes
EndProcedure

; ЕЩЁ ПРИМЕРЫ ОФОРМЛЕНИЯ

;.  ______                __        ____                __            
;. /\__  _\              /\ \__    /\  _`\             /\ \           
;. \/_/\ \/    __    ____\ \ ,_\   \ \ \/\_\    ___    \_\ \     __   
;.    \ \ \  /&#039;__`\ /&#039;,__\\ \ \/    \ \ \/_/_  / __`\  /&#039;_` \  /&#039;__`\ 
;.     \ \ \/\  __//\__, `\\ \ \_    \ \ \L\ \/\ \L\ \/\ \L\ \/\  __/ 
;.      \ \_\ \____\/\____/ \ \__\    \ \____/\ \____/\ \___,_\ \____\
;.       \/_/\/____/\/___/   \/__/     \/___/  \/___/  \/__,_ /\/____/
;.                                                                    

;. _/_/_/_/_/                      _/            _/_/_/                  _/           
;.    _/      _/_/      _/_/_/  _/_/_/_/      _/          _/_/      _/_/_/    _/_/    
;.   _/    _/_/_/_/  _/_/        _/          _/        _/    _/  _/    _/  _/_/_/_/   
;.  _/    _/            _/_/    _/          _/        _/    _/  _/    _/  _/          
;. _/      _/_/_/  _/_/_/        _/_/        _/_/_/    _/_/      _/_/_/    _/_/_/     

;. __ __|            |         ___|             |       
;.    |   _ \   __|  __|      |       _ \    _` |   _ \ 
;.    |   __/ \__ \  |        |      (   |  (   |   __/ 
;.   _| \___| ____/ \__|     \____| \___/  \__,_| \___| 
            
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
			<author>mybb@mybb.ru (vanguger)</author>
			<pubDate>Mon, 06 Mar 2023 02:30:17 +0300</pubDate>
			<guid>https://vanguger.mybb.ru/viewtopic.php?pid=1#p1</guid>
		</item>
	</channel>
</rss>
