home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / fed0217s.zip / source / profile.cpp < prev    next >
C/C++ Source or Header  |  2001-10-29  |  22KB  |  668 lines

  1. /*
  2. ** Module   :PROFILE.CPP
  3. ** Abstract :FED profile (FED.INI) reader/parser
  4. **
  5. ** Copyright (C) Sergey I. Yevtushenko
  6. **
  7. ** Log: Wed  17/03/1998     Created
  8. */
  9.  
  10. #include <string.h>
  11.  
  12. #define INCL_DOS
  13. #include <os2.h>
  14.  
  15. #include <boxcoll.h>
  16. #include <fio.h>
  17. #include <version.h>
  18.  
  19. #define P_INT  1
  20. #define P_CHAR 2
  21. #define P_PSZ  3
  22.  
  23. struct stPairDef;
  24. typedef struct stPairDef* PPairDef;
  25.  
  26. struct stPairDef
  27. {
  28.     char *index;
  29.     int type;
  30.     void *value;
  31. };
  32.  
  33. stPairDef ProfileDef[]=
  34. {
  35.     {"color.app.default"             , P_CHAR, app_pal + CL_APPLICATION_START+CL_DEFAULT       },
  36.     {"color.app.status"              , P_CHAR, app_pal + CL_APPLICATION_START+CL_STATUSLINE    },
  37.     {"color.dialog.default"          , P_CHAR, app_pal + CL_DIALOG_START+CL_DEFAULT            },
  38.     {"color.dialog.hilite"           , P_CHAR, app_pal + CL_DIALOG_START+CL_BORDER             },
  39.     {"color.edit.comment"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_COMMENT           },
  40.     {"color.edit.const"              , P_CHAR, app_pal + CL_EDITBOX_START+CL_CONST             },
  41.     {"color.edit.default"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_DEFAULT           },
  42.     {"color.edit.eof"                , P_CHAR, app_pal + CL_EDITBOX_START+CL_EOF               },
  43.     {"color.edit.function"           , P_CHAR, app_pal + CL_EDITBOX_START+CL_FUNCTION          },
  44.     {"color.edit.ident"              , P_CHAR, app_pal + CL_EDITBOX_START+CL_IDENT             },
  45.     {"color.edit.number"             , P_CHAR, app_pal + CL_EDITBOX_START+CL_NUMBER            },
  46.     {"color.edit.preproc"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_PREPROC           },
  47.     {"color.edit.selection"          , P_CHAR, app_pal + CL_EDITBOX_START+CL_SELECTION         },
  48.     {"color.edit.semicol"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_SEMICOL           },
  49.     {"color.edit.stdword"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_STDWORD           },
  50.     {"color.edit.xnumber"            , P_CHAR, app_pal + CL_EDITBOX_START+CL_XNUMBER           },
  51.     {"color.line.active.comment"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_COMMENT         },
  52.     {"color.line.active.const"       , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_CONST           },
  53.     {"color.line.active.default"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_DEFAULT         },
  54.     {"color.line.active.eof"         , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_EOF             },
  55.     {"color.line.active.function"    , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_FUNCTION        },
  56.     {"color.line.active.ident"       , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_IDENT           },
  57.     {"color.line.active.number"      , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_NUMBER          },
  58.     {"color.line.active.preproc"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_PREPROC         },
  59.     {"color.line.active.selection"   , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_SELECTION       },
  60.     {"color.line.active.semicol"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_SEMICOL         },
  61.     {"color.line.active.stdword"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_STDWORD         },
  62.     {"color.line.active.xnumber"     , P_CHAR, app_pal + CL_EDITLINE_ACTIVE+CL_XNUMBER         },
  63.     {"color.line.inactive.comment"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_COMMENT       },
  64.     {"color.line.inactive.const"     , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_CONST         },
  65.     {"color.line.inactive.default"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_DEFAULT       },
  66.     {"color.line.inactive.eof"       , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_EOF           },
  67.     {"color.line.inactive.function"  , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_FUNCTION      },
  68.     {"color.line.inactive.ident"     , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_IDENT         },
  69.     {"color.line.inactive.number"    , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_NUMBER        },
  70.     {"color.line.inactive.preproc"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_PREPROC       },
  71.     {"color.line.inactive.selection" , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_SELECTION     },
  72.     {"color.line.inactive.semicol"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_SEMICOL       },
  73.     {"color.line.inactive.stdword"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_STDWORD       },
  74.     {"color.line.inactive.xnumber"   , P_CHAR, app_pal + CL_EDITLINE_INACTIVE+CL_XNUMBER       },
  75.     {"color.list.active.current"     , P_CHAR, app_pal + CL_LISTBOX_ACTIVE+CL_CURRENT          },
  76.     {"color.list.active.currsel"     , P_CHAR, app_pal + CL_LISTBOX_ACTIVE+CL_CURRSEL          },
  77.     {"color.list.active.default"     , P_CHAR, app_pal + CL_LISTBOX_ACTIVE+CL_DEFAULT          },
  78.     {"color.list.active.selection"   , P_CHAR, app_pal + CL_LISTBOX_ACTIVE+CL_SELECTION        },
  79.     {"color.list.inactive.current"   , P_CHAR, app_pal + CL_LISTBOX_INACTIVE+CL_CURRENT        },
  80.     {"color.list.inactive.currsel"   , P_CHAR, app_pal + CL_LISTBOX_INACTIVE+CL_CURRSEL        },
  81.     {"color.list.inactive.default"   , P_CHAR, app_pal + CL_LISTBOX_INACTIVE+CL_DEFAULT        },
  82.     {"color.list.inactive.selection" , P_CHAR, app_pal + CL_LISTBOX_INACTIVE+CL_SELECTION      },
  83.     {"color.menu.active.current"     , P_CHAR, app_pal + CL_MENU+CL_CURRENT                    },
  84.     {"color.menu.active.currsel"     , P_CHAR, app_pal + CL_MENU+CL_CURRSEL                    },
  85.     {"color.menu.active.default"     , P_CHAR, app_pal + CL_MENU+CL_DEFAULT                    },
  86.     {"color.menu.active.selection"   , P_CHAR, app_pal + CL_MENU+CL_SELECTION                  },
  87.     {"color.static.default"          , P_CHAR, app_pal + CL_STEXT_START+CL_DEFAULT             },
  88.     {"color.static.hilite"           , P_CHAR, app_pal + CL_STEXT_START+CL_HILITE              },
  89.     {"cursor.shape.insert"           , P_INT , iShape + 0},
  90.     {"cursor.shape.overwrite"        , P_INT , iShape + 1},
  91.     {"editor.ctrlbreak.action"       , P_INT , &iCtrlBrk},
  92.     {"editor.default.format"         , P_INT , &iDefType},
  93.     {"editor.helptext"               , P_PSZ , &help_text},
  94.     {"editor.no.ea"                  , P_INT , &iNoEA},
  95.     {"editor.statusline"             , P_PSZ , &statusline},
  96.     {"editor.statuspos"              , P_INT , &iUpperStatus},
  97.     {"editor.syntax"                 , P_PSZ , &hi_map},
  98.     {"editor.syntax.save.mode"       , P_INT , &iSaveSyntax},
  99.     {"editor.tabwidth"               , P_INT , &iTabWidth},
  100.     {"editor.default.wordwrap.state" , P_INT , &iWWDef},
  101.     {"editor.default.wordwrap.margin", P_INT , &iDefWidth},
  102.     {"editor.untitled"               , P_PSZ , &untitled},
  103.     {"editor.verbose.search"         , P_INT , &iVSearch},
  104.     {"editor.file.name.reduce"       , P_INT , &iFileName},
  105.     {"mouse.event.mask"              , P_INT , &iMouseMask},
  106.     {"mouse.sense.shift"             , P_INT , &iSenseShift}
  107. };
  108.  
  109. ProfileDictionary::ProfileDictionary():Dictionary(1, 0, 0)
  110. {
  111.     for(int i = 0; i < sizeof(ProfileDef)/sizeof(ProfileDef[0]); i++)
  112.     {
  113.         //printf("init: %s=%08x\n", ProfileDef[i].index, ProfileDef[i].value);
  114.         Add(&ProfileDef[i]);
  115.     }
  116. }
  117.  
  118. int get_ini_name(char *cProgName, char *ini_ext)
  119. {
  120.     char* lastdot;
  121.     char* lastslash;
  122.  
  123.     strcpy(cProgName, _cFedPATH);
  124.  
  125.     lastdot   = strrchr(cProgName, '.');
  126.     lastslash = strrchr(cProgName, '\\');
  127.  
  128.     if(lastdot > lastslash) //dot really in extension, not in path
  129.         strcpy(lastdot, ini_ext);
  130.     else
  131.         strcat(cProgName, ini_ext);
  132.  
  133.     return 0;
  134. }
  135.  
  136. void EditBoxCollection::load_profile(int mode)
  137. {
  138.     char cProgName[FED_MAXPATH];
  139.  
  140.     if(!mode)
  141.     {
  142.         if(get_ini_name(cProgName, ".ini"))
  143.             return;
  144.     }
  145.     else
  146.     {
  147.         strcpy(cProgName, "fed.ini");
  148.     }
  149.  
  150.     load_profile_file(cProgName);
  151. }
  152.  
  153. static char* skip_to_eol(char* ptr)
  154. {
  155.     while(*ptr && *ptr != '\n')
  156.         ptr++;
  157.  
  158.     return ptr;
  159. }
  160.  
  161. void EditBoxCollection::load_profile_file(char* cFile)
  162. {
  163.     char *orig_file = _ld_file(cFile);
  164.  
  165.     if(orig_file)
  166.         load_profile(orig_file);
  167.  
  168.     _fr_file(orig_file);
  169. }
  170.  
  171. void EditBoxCollection::load_profile(char* orig_file)
  172. {
  173.     char *ptr;
  174.     char *str;
  175.  
  176.     for(ptr = str = orig_file; *ptr;)
  177.     {
  178.         int j = 0;
  179.  
  180.         //Skip whitespaces
  181.         //Skip empty lines
  182.         while(__issp(*ptr))
  183.             ptr++;
  184.  
  185.         // Ignore comments
  186.         if(*ptr == ':' || *ptr == '#' || (ptr[0] == '/' && ptr[1] == '/'))
  187.         {
  188.             ptr = skip_to_eol(ptr);
  189.             continue;
  190.         }
  191.  
  192.         if(*ptr == '@') // '@' - commands
  193.         {
  194.             char cCmd[32];
  195.             int i;
  196.  
  197.             ptr++;
  198.  
  199.             while(__isic(ptr[j]) || ptr[j] == '.')
  200.                 j++;
  201.  
  202.             if(j == 0 || j >= sizeof(cCmd))  /* something wrong, wkip line */
  203.             {
  204.                 ptr = skip_to_eol(ptr);
  205.                 continue;
  206.             }
  207.  
  208.             for(i = 0; i < j; i++)
  209.                 cCmd[i] = __to_lower(ptr[i]);
  210.  
  211.             cCmd[i] = 0;
  212.  
  213.             ptr += j;
  214.  
  215.             while(__issp(*ptr))
  216.                 ptr++;
  217.  
  218.             if(!strcmp(cCmd, "include"))    //@include "some.file"
  219.             {
  220.                 char cProgName[FED_MAXPATH];
  221.  
  222.                 do
  223.                 {
  224.                     int iDelim = *ptr;
  225.  
  226.                     if(iDelim != '\'' && iDelim != '"')
  227.                     {
  228.                         ptr = skip_to_eol(ptr);
  229.                         break;
  230.                     }
  231.  
  232.                     ptr++;
  233.                     str = ptr;
  234.  
  235.                     while(*ptr && *ptr != iDelim && *ptr != '\r' && *ptr != '\n')
  236.                         ptr++;
  237.  
  238.                     if(*ptr != iDelim)
  239.                     {
  240.                         if(*ptr != '\n')
  241.                             ptr = skip_to_eol(ptr);
  242.                         break;
  243.                     }
  244.  
  245.                     int iSz = (ptr - str);
  246.  
  247.                     if(iSz <= 0 || iSz >= sizeof(cProgName))
  248.                     {
  249.                         ptr = skip_to_eol(ptr);
  250.                         break;
  251.                     }
  252.  
  253.                     memcpy(cProgName, str, iSz);
  254.                     cProgName[iSz] = 0;
  255.  
  256.                     load_profile_file(cProgName);
  257.  
  258.                     ptr = skip_to_eol(ptr);
  259.                 }
  260.                 while(0);
  261.             }
  262.             else if(!strcmp(cCmd, "mode"))
  263.             {
  264.                 do
  265.                 {
  266.                     j = 0;
  267.  
  268.                     while(__isic(ptr[j]) || ptr[j] == '+')
  269.                         j++;
  270.  
  271.                     if(j == 0 || j >= sizeof(cCmd))  /* something wrong, wkip line */
  272.                     {
  273.                         ptr = skip_to_eol(ptr);
  274.                         break;
  275.                     }
  276.  
  277.                     for(i = 0; i < j; i++)
  278.                         cCmd[i] = ptr[i];
  279.  
  280.                     cCmd[i] = 0;
  281.  
  282.                     ptr += j;
  283.  
  284.                     while(__issp(*ptr))
  285.                         ptr++;
  286.  
  287.                     if(*ptr != '{')
  288.                     {
  289.                         ptr = skip_to_eol(ptr);
  290.                         break;
  291.                     }
  292.  
  293.                     ptr++;
  294.  
  295.                     str = ptr;
  296.  
  297.                     while(*ptr)
  298.                     {
  299.                         while(*ptr && *ptr != '}')
  300.                             ptr++;
  301.  
  302.                         if(!*ptr)
  303.                             break;
  304.  
  305.                         char* tmp = ptr + 1;
  306.  
  307.                         while(__issp(*tmp) && *tmp != '\n') //skip trailing spaces
  308.                             tmp++;
  309.  
  310.                         if(*ptr == '}' && *tmp == '\n')   //at the end of line!
  311.                             break;
  312.                         ptr++;
  313.                     }
  314.  
  315.                     if(*ptr && *ptr != '}')
  316.                     {
  317.                         ptr = skip_to_eol(ptr);
  318.                         break;
  319.                     }
  320.  
  321.                     int iSz = (ptr - str);
  322.  
  323.                     char* compile = new char[iSz + 1];
  324.  
  325.                     for(i = 0; str < ptr; i++)
  326.                         compile[i] = *str++;
  327.  
  328.                     compile[i] = 0;
  329.  
  330.                     //Parse it using recursive call to ourselves
  331.                     //load_profile(compile, cCmd);
  332.  
  333.                     delete compile;
  334.                 }
  335.                 while(0);
  336.             }
  337.             else
  338.                 ptr = skip_to_eol(ptr);
  339.  
  340.             continue;
  341.         }
  342.  
  343.         // Look for variable name
  344.  
  345.         while(__isic(ptr[j]) || ptr[j] == '.')
  346.             j++;
  347.  
  348.         if(j == 0)  /* something wrong, wkip line */
  349.         {
  350.             ptr = skip_to_eol(ptr);
  351.             continue;
  352.         }
  353.  
  354.         PPairDef pProf;
  355.  
  356.         pProf = (PPairDef) prof_keys.IsIn(ptr, j, 0);
  357.  
  358.         if(pProf)
  359.         {
  360.             //Process lines
  361.             //Skip everything up to first non-space character after delimiter
  362.  
  363.             ptr += j;
  364.  
  365.             while(__issp(*ptr))
  366.                 ptr++;
  367.  
  368.             if(*ptr != ':' && *ptr != '=')
  369.             {
  370.                 ptr = skip_to_eol(ptr);
  371.                 continue;
  372.             }
  373.  
  374.             ptr++;
  375.  
  376.             while(__issp(*ptr))
  377.                 ptr++;
  378.  
  379.             switch(pProf->type)
  380.             {
  381.                 case P_INT:
  382.                 case P_CHAR:
  383.                     {
  384.                         int iSign  = 0;
  385.                         int iValue = 0;
  386.                         int iValid = 0;
  387.  
  388.                         if(*ptr == '-')
  389.                         {
  390.                             iSign = 1;
  391.                             ptr++;
  392.                         }
  393.                         else
  394.                             if(*ptr == '+')
  395.                             {
  396.                                 iSign = 0;
  397.                                 ptr++;
  398.                             }
  399.  
  400.                         if(ptr[0] == '0' && __to_upper(ptr[1]) == 'X')
  401.                         {
  402.                             ptr += 2;
  403.                             while(__ishd(*ptr))
  404.                             {
  405.                                 iValue <<= 4;
  406.  
  407.                                 if(__to_upper(*ptr) > '9')
  408.                                     iValue |= __to_upper(*ptr) - 'A' + 0x0A;
  409.                                 else
  410.                                     iValue |= *ptr - '0';
  411.  
  412.                                 ptr++;
  413.  
  414.                                 iValid = 1;
  415.                             }
  416.                         }
  417.                         else
  418.                         {
  419.                             while(__isdd(*ptr))
  420.                             {
  421.                                 iValue *= 10;
  422.                                 iValue += *ptr - '0';
  423.  
  424.                                 ptr++;
  425.  
  426.                                 iValid = 1;
  427.                             }
  428.                         }
  429.  
  430.                         if(iValid)
  431.                         {
  432.                             if(iSign)
  433.                                 iValue = -iValue;
  434.  
  435.                             if(pProf->value)
  436.                             {
  437.                                 if(pProf->type == P_CHAR)
  438.                                     *((char *)pProf->value) = (char)iValue;
  439.  
  440.                                 if(pProf->type == P_INT)
  441.                                     *((int *)pProf->value) = (int)iValue;
  442.                             }
  443.                         }
  444.  
  445.                         ptr = skip_to_eol(ptr);
  446.                     }
  447.                     break;
  448.  
  449.                 case P_PSZ:
  450.                     {
  451.                         int iDelim = ptr[0];
  452.                         char *pEOL = 0;
  453.  
  454.                         if(iDelim != '\'' && iDelim != '"')
  455.                         {
  456.                             //Ignore definition
  457.                             ptr = skip_to_eol(ptr);
  458.                             break;
  459.                         }
  460.  
  461.                         //First pass - calculate length
  462.                         int iLen    = 0;
  463.                         int iInside = 0;
  464.  
  465.                         str = ptr;
  466.  
  467.                         while(*ptr && !pEOL)
  468.                         {
  469.                             if(!iInside)
  470.                             {
  471.                                 if(*ptr == '\'' || *ptr == '"')
  472.                                 {
  473.                                     iDelim = *ptr;
  474.                                     iInside = 1;
  475.                                     ptr++;
  476.                                     continue;
  477.                                 }
  478.  
  479.                                 if(ptr[0] == ',' &&
  480.                                    (ptr[1] == '\r' || ptr[1] == '\n'))
  481.                                 {
  482.                                     //Include next line too
  483.                                     ptr++;
  484.  
  485.                                     while(__issp(*ptr))
  486.                                         ptr++;
  487.  
  488.                                     continue;
  489.                                 }
  490.  
  491.                                 if(*ptr == '\n')
  492.                                 {
  493.                                     pEOL = ptr;
  494.                                     break;
  495.                                 }
  496.  
  497.                                 ptr++;
  498.                                 continue;
  499.                             }
  500.  
  501.                             if(*ptr == iDelim)
  502.                             {
  503.                                 iInside = 0;
  504.                                 ptr++;
  505.                                 continue;
  506.                             }
  507.  
  508.                             iLen++;
  509.  
  510.                             //Inside string
  511.  
  512.                             if(*ptr == '\\')
  513.                                 ptr++;
  514.  
  515.                             ptr++;
  516.                         }
  517.  
  518.                         if(!pEOL)
  519.                             pEOL = ptr;
  520.  
  521.                         //Second pass - copy string
  522.  
  523.                         char* pOut = new char[iLen + 1];
  524.  
  525.                         ptr = str;
  526.                         str = pOut;
  527.  
  528.                         iInside = 0;
  529.  
  530.                         while(ptr != pEOL)
  531.                         {
  532.                             if(!iInside)
  533.                             {
  534.                                 if(*ptr == '\'' || *ptr == '"')
  535.                                 {
  536.                                     iDelim = *ptr;
  537.                                     iInside = 1;
  538.                                     ptr++;
  539.                                     continue;
  540.                                 }
  541.  
  542.                                 ptr++;
  543.                                 continue;
  544.                             }
  545.  
  546.                             if(*ptr == iDelim)
  547.                             {
  548.                                 iInside = 0;
  549.                                 ptr++;
  550.                                 continue;
  551.                             }
  552.  
  553.                             //Inside string
  554.                             if(*ptr == '\\')
  555.                             {
  556.                                 ptr++;
  557.  
  558.                                 char chr = *ptr;
  559.  
  560.                                 if(chr == 'b') chr = '\b';
  561.                                 if(chr == 't') chr = '\t';
  562.                                 if(chr == 'n') chr = '\n';
  563.                                 if(chr == 'r') chr = '\r';
  564.  
  565.                                 *str++ = chr;
  566.  
  567.                                 ptr++;
  568.  
  569.                                 continue;
  570.                             }
  571.  
  572.                             *str++ = *ptr++;
  573.                         }
  574.                         *str = 0;
  575.  
  576.                         *(char **)(pProf->value) = pOut;
  577.                     }
  578.                     break;
  579.             }
  580.             continue;
  581.         }
  582.  
  583.         if(__to_upper(ptr[0]) == 'K' &&
  584.            __to_upper(ptr[1]) == 'B' &&
  585.            j < KEY_NAME_LEN)
  586.         {
  587.             //Process keydef
  588.             str = ptr;
  589.  
  590.             ptr += j;
  591.  
  592.             while(__issp(*ptr))
  593.                 ptr++;
  594.  
  595.             if(*ptr != ':' && *ptr != '=')
  596.             {
  597.                 ptr = skip_to_eol(ptr);
  598.                 continue;
  599.             }
  600.  
  601.             ptr++;
  602.  
  603.             while(__issp(*ptr))
  604.                 ptr++;
  605.  
  606.             if(*ptr == '{') // REXX macro
  607.             {
  608.                 while(*ptr)
  609.                 {
  610.                     while(*ptr && *ptr != '}')
  611.                         ptr++;
  612.  
  613.                     if(!*ptr)
  614.                         break;
  615.  
  616.                     char* tmp = ptr + 1;
  617.  
  618.                     while(__issp(*tmp) && *tmp != '\n') //skip trailing spaces
  619.                         tmp++;
  620.  
  621.                     if(*ptr == '}' && *tmp == '\n')   //at the end of line!
  622.                         break;
  623.  
  624.                     ptr++;
  625.                 }
  626.             }
  627.             else            //Ordinary keydef
  628.             {
  629.                while(*ptr)
  630.                {
  631.                     if(ptr[0] == ',' &&
  632.                        (ptr[1] == '\r' || ptr[1] == '\n'))
  633.                     {
  634.                         //Include next line too
  635.                         ptr++;
  636.  
  637.                         while(__issp(*ptr))
  638.                             ptr++;
  639.  
  640.                         continue;
  641.                     }
  642.  
  643.                     if(*ptr == '\n')
  644.                         break;
  645.  
  646.                     ptr++;
  647.                 }
  648.             }
  649.  
  650.             if(*ptr)
  651.             {
  652.                 *ptr = 0;
  653.                 ptr++;
  654.             }
  655.  
  656.             keys.InsKey(str, j);
  657.             continue;
  658.         }
  659.  
  660.         //Ignore unrecognized line
  661.         ptr = skip_to_eol(ptr);
  662.     }
  663.  
  664.     if(iUpperStatus != 0)
  665.         iUpperStatus = 1;
  666. }
  667.  
  668.