' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '  
 '   H P G L V i e w  
 ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '  
  
 f i l e   =   G e t F i l e T o O p e n ( " H P G L   F i l e | * . h p g l " )  
 h p g l   =   R e a d H P G L F i l e   ( f i l e )  
  
 ' P a r s e H P G L ( h p g l )  
 D r a w H P G L ( h p g l )  
  
 F u n c t i o n   G e t F i l e T o O p e n ( f i l t e r )  
       D i m   o f d  
       D i m   o p e n f i l e  
       S e t   o f d   =   C r e a t e O b j e c t ( " C E C o m D l g . C o m m o n D i a l o g " )  
       o f d . D i a l o g T i t l e   =   " O p e n "  
       o f d . F i l t e r             =   f i l t e r  
       o f d . S h o w O p e n  
       o p e n f i l e   =   o f d . F i l e N a m e  
       S e t   o f d   =   N o t h i n g  
       G e t F i l e T o O p e n   =   o p e n f i l e  
 E n d   F u n c t i o n  
  
 F u n c t i o n   R e a d H P G L F i l e ( f i l e )  
       D i m   l i n e  
       l i n e   =   " "  
       S e t   f i l   =   C r e a t e O b j e c t ( " F I L E C T L . F i l e " )  
       f i l . O p e n   f i l e , 1 , 1 , 2  
       W h i l e   N o t   f i l . E O F  
             l i n e   =   l i n e   &   f i l . L i n e I n p u t S t r i n g  
       W e n d  
       f i l . C l o s e  
       S e t   f i l   =   N o t h i n g  
       R e a d H P G L F i l e   =   l i n e  
 E n d   F u n c t i o n  
  
 S u b   P a r s e H P G L ( h p g l )  
       c m d   =   " "  
       i x 1   =   0  
       i y 1   =   0  
       i x 2   =   0  
       i y 2   =   0  
       s x 1   =   " "  
       s y 1   =   " "  
       s x 2   =   " "  
       s y 2   =   " "  
       c o l   =   A r r a y ( 0 , 0 , 0 )  
       I n i t D i a l o g  
       N a m e D i a l o g   " H P G L V i e w "  
       S h o w D i a l o g  
       F o r   i = 1   T o   1 0 0 0   ' L e n ( h p g l )  
             D o E v e n t s  
             I f   M i d ( h p g l , i , 1 )   =   " ; "   T h e n  
                   I f   M i d ( c m d , 1 , 2 )   =   " S P "   T h e n  
                         p e n   =   C I n t ( M i d ( c m d , 2 ) )  
                         S e l e c t   C a s e   p e n  
                               C a s e   1  
                                     c o l ( 0 )   =   2 5 5  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =       0  
                               C a s e   2  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =   2 5 5  
                                     c o l ( 2 )   =       0  
                               C a s e   3  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =   2 5 5  
                               C a s e   E l s e  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =       0  
                         E n d   S e l e c t  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P U "   T h e n  
                         s x 1   =   " "  
                         s y 1   =   " "  
                         F o r   j = 3   T o   L e n ( c m d )  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     s x 1   =   M i d ( c m d , 3 , j - 2 )  
                                     s y 1   =   M i d ( c m d , j + 1 )  
                               E n d   I f  
                         N e x t  
                         P r i n t   " P U   "   &   s x 1   &   "   -   "   &   s x 2   &   v b C r L f  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P A "   T h e n  
                         s x 1   =   " "  
                         s y 1   =   " "  
                         F o r   j = 3   T o   L e n ( c m d )  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     s x 1   =   M i d ( c m d , 3 , j - 2 )  
                                     s y 1   =   M i d ( c m d , j + 1 )  
                               E n d   I f  
                         N e x t  
                         P r i n t   " P A   "   &   s x 1   &   "   -   "   &   s y 1   &   v b C r L f  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P D "   T h e n  
                         s x 2   =   " "  
                         s y 2   =   " "  
                         F o r   j = 3   T o   L e n ( c m d )  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     s x 2   =   M i d ( c m d , 3 , j - 2 )  
                                     s y 2   =   M i d ( c m d , j + 1 )  
                               E n d   I f  
                         N e x t  
                         P r i n t   " P D   "   &   s x 2   &   "   -   "   &   s y 2   &   v b C r L f  
                   E n d   I f  
                   c m d   =   " "  
             E l s e  
                   I f   ( M i d ( h p g l , i , 1 ) < > v b C r )   A n d   ( M i d ( h p g l , i , 1 ) < > v b L f )   T h e n  
                         c m d   =   c m d   &   M i d ( h p g l , i , 1 )  
                   E n d   I f  
             E n d   I f  
       N e x t  
 E n d   S u b  
  
 S u b   D r a w H P G L ( h p g l )  
       c m d   =   " "  
       i x 1   =   0  
       i y 1   =   0  
       i x 2   =   0  
       i y 2   =   0  
       s x 1   =   " "  
       s y 1   =   " "  
       s x 2   =   " "  
       s y 2   =   " "  
       c o l   =   A r r a y ( 0 , 0 , 0 )  
       d r w   =   F a l s e  
       d i v   =   1 2  
       o f f   =   2 2 0  
       I n i t D i a l o g  
       N a m e D i a l o g   " H P G L V i e w "  
       I n i t G r a p h i c s   2 5 5 , 2 5 5 , 2 5 5  
       N a m e G r a p h i c s   " H P G L V i e w "  
       S h o w G r a p h i c s  
       D r a w T e x t   1 0 , 1 0 , " 0 %   D o n e " , 0 , 0 , 0  
       F o r   i = 1   T o   L e n ( h p g l ) - 1  
             D o E v e n t s  
             I f   i   M o d   ( L e n ( h p g l ) / 1 0 0 )   =   0   T h e n  
                   p d   =   C S t r ( C I n t ( i / ( L e n ( h p g l ) / 1 0 0 ) ) )   &   " %   D o n e "  
                   D r a w T e x t   1 0 , 1 0 , p d , 0 , 0 , 0  
             E n d   I f  
             I f   M i d ( h p g l , i , 1 )   =   " ; "   T h e n  
                   I f   M i d ( c m d , 1 , 2 )   =   " S P "   T h e n  
                         p e n   =   C I n t ( M i d ( c m d , 2 ) )  
                         S e l e c t   C a s e   p e n  
                               C a s e   1  
                                     c o l ( 0 )   =   2 5 5  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =       0  
                               C a s e   2  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =   2 5 5  
                                     c o l ( 2 )   =       0  
                               C a s e   3  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =   2 5 5  
                               C a s e   E l s e  
                                     c o l ( 0 )   =       0  
                                     c o l ( 1 )   =       0  
                                     c o l ( 2 )   =       0  
                         E n d   S e l e c t  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P U "   T h e n  
                         s x 1   =   " "  
                         s y 1   =   " "  
                         F o r   j = 3   T o   L e n ( c m d ) - 1  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     s x 1   =   M i d ( c m d , 3 , j - 3 )  
                                     s y 1   =   M i d ( c m d , j + 1 )  
                               E n d   I f  
                         N e x t  
                         ' P r i n t   " P U   "   &   s x 1   &   "   -   "   &   s x 2   &   v b C r L f  
                         d r w   =   F a l s e  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P A "   T h e n  
                         I f   d r w   T h e n  
                               s x 2   =   " "  
                               s y 2   =   " "  
                         E l s e  
                               s x 1   =   " "  
                               s y 1   =   " "  
                         E n d   I f  
                         F o r   j = 3   T o   L e n ( c m d ) - 1  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     I f   d r w   T h e n  
                                           s x 2   =   M i d ( c m d , 3 , j - 3 )  
                                           s y 2   =   M i d ( c m d , j + 1 )  
                                     E l s e  
                                           s x 1   =   M i d ( c m d , 3 , j - 3 )  
                                           s y 1   =   M i d ( c m d , j + 1 )  
                                     E n d   I f  
                               E n d   I f  
                         N e x t  
                         ' P r i n t   " P A   "   &   s x 1   &   "   -   "   &   s y 1   &   v b C r L f  
                         I f   d r w   T h e n  
                               I f   ( s x 1 < > " " )   A n d   ( s y 1 < > " " )   A n d   ( s x 2 < > " " )   A n d   ( s y 2 < > " " )   T h e n  
                                     i x 1   =   C I n t ( C I n t ( s x 1 ) / d i v )  
                                     i y 1   =   o f f - C I n t ( C I n t ( s y 1 ) / d i v )  
                                     i x 2   =   C I n t ( C I n t ( s x 2 ) / d i v )  
                                     i y 2   =   o f f - C I n t ( C I n t ( s y 2 ) / d i v )  
                                     D r a w L i n e   i x 1 , i y 1 , i x 2 , i y 2 , c o l ( 0 ) , c o l ( 1 ) , c o l ( 2 )  
                                     s x 1   =   s x 2  
                                     s y 1   =   s y 2  
                               E n d   I f  
                         E n d   I f  
                   E n d   I f  
                   I f   M i d ( c m d , 1 , 2 )   =   " P D "   T h e n  
                         s x 2   =   " "  
                         s y 2   =   " "  
                         F o r   j = 3   T o   L e n ( c m d ) - 1  
                               I f   M i d ( c m d , j , 1 )   =   " , "   T h e n  
                                     s x 2   =   M i d ( c m d , 3 , j - 3 )  
                                     s y 2   =   M i d ( c m d , j + 1 )  
                               E n d   I f  
                         N e x t  
                         ' P r i n t   " P D   "   &   s x 2   &   "   -   "   &   s y 2   &   v b C r L f  
                         I f   ( s x 1 < > " " )   A n d   ( s y 1 < > " " )   A n d   ( s x 2 < > " " )   A n d   ( s y 2 < > " " )   T h e n  
                               i x 1   =   C I n t ( C I n t ( s x 1 ) / d i v )  
                               i y 1   =   o f f - C I n t ( C I n t ( s y 1 ) / d i v )  
                               i x 2   =   C I n t ( C I n t ( s x 2 ) / d i v )  
                               i y 2   =   o f f - C I n t ( C I n t ( s y 2 ) / d i v )  
                               D r a w L i n e   i x 1 , i y 1 , i x 2 , i y 2 , c o l ( 0 ) , c o l ( 1 ) , c o l ( 2 )  
                               s x 1   =   s x 2  
                               s y 1   =   s y 2  
                         E n d   I f  
                         d r w   =   T r u e  
                   E n d   I f  
                   c m d   =   " "  
             E l s e  
                   I f   ( M i d ( h p g l , i , 1 ) < > v b C r )   A n d   ( M i d ( h p g l , i , 1 ) < > v b L f )   T h e n  
                         c m d   =   c m d   &   M i d ( h p g l , i , 1 )  
                   E n d   I f  
             E n d   I f  
       N e x t  
       D r a w T e x t   1 0 , 1 0 , " 1 0 0 %   D o n e " , 0 , 0 , 0  
 E n d   S u b  
  
 