mylisp/gds-sabre.el
changeset 1735 e8425ea2f39b
child 1736 b4c49ef014e2
equal deleted inserted replaced
1734:ae2c6a001464 1735:e8425ea2f39b
       
     1 ;;;###autoload
       
     2 (defun gds-sabre-decode-region (&optional beg end prefix)
       
     3   "Decode garbage coming from UTF8 terminals when Sabre operates in iso-8859-1."
       
     4   (interactive "r\nP")
       
     5   (unless beg (setq beg (region-beginning)))
       
     6   (unless end (setq end (region-end)))
       
     7   (let (text)
       
     8     (setq text
       
     9           (decode-coding-string
       
    10            (encode-coding-string
       
    11             (decode-coding-string
       
    12              (encode-coding-string (buffer-substring beg end) 'iso-8859-1)
       
    13              'utf-8)
       
    14             'iso-8859-1)
       
    15            'cp1252))
       
    16     (when prefix
       
    17       (delete-region beg end)
       
    18       (insert text))
       
    19     text))
       
    20 
       
    21 ;;;###autoload
       
    22 (defun gds-sabre-highlight ()
       
    23   (interactive)
       
    24   (highlight-phrase "[[:alpha:]_]*PseudoCityCode=\\|CreationAgent=\\|BookingSource=\\|AgentSine=" 'hi-pink)
       
    25   (highlight-phrase ":Arunk\\|:FlightSegment\\>\\|:FareBasis\\>" 'hi-pink)
       
    26   (highlight-phrase "ResBookDesigCode=\\|Status=\\|FlightNumber=\\|ArrivalDateTime=\\|DepartureDateTime=\\|FareBasisCode=\\|passengerType=\\|isPast=\\|isExpired=\\|itineraryChange=" 'hi-green)
       
    27   (highlight-phrase "InputMessage=" 'hi-blue))
       
    28 
       
    29 ;;;###autoload
       
    30 (defun gds-tp-highlight ()
       
    31   (interactive)
       
    32   (highlight-phrase "\\w+Ref=\\|Key=" 'hi-blue)
       
    33   (highlight-phrase "ProviderCode" 'hi-pink)
       
    34   (highlight-phrase "\\w*LocatorCode" 'hi-pink)
       
    35   (highlight-phrase "OwningPCC" 'hi-pink)
       
    36   (highlight-phrase "FareBasis" 'hi-green)
       
    37   (highlight-phrase "CabinClass" 'hi-green)
       
    38   (highlight-phrase "BookingCode" 'hi-green)
       
    39   (highlight-phrase "FareBasis" 'hi-green)
       
    40   (highlight-phrase "ClassOfService" 'hi-green)
       
    41   (highlight-phrase "Status=" 'hi-green)
       
    42   (highlight-phrase "\\w*TotalPrice" 'hi-green))
       
    43 
       
    44 (provide 'gds-sabre)