Subversion Repositories Kolibri OS

Rev

Rev 4846 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //INI parser in C--, GPL licence.
  2. //Leency - 2012
  3.  
  4. #define COMMENT 0
  5. #define SECTION 1
  6. #define PARAM   2
  7. #define OPTION  3
  8.  
  9.  
  10. void GetIni(byte onload)
  11. {
  12.         byte section[32], parametr[32], option[256], InfType=0;
  13.         char bukva[2];
  14.         int errornum, tj;
  15.         static dword buff, fsize;
  16.         if (onload==1)
  17.         {
  18.                 free(buff);
  19.                 if (!GetFile(#buff, #fsize, abspath("Eolite.ini"))) notify("Eolite.ini not found. Defaults will be used.");
  20.         }
  21.        
  22.         ini_get_color stdcall (abspath("Eolite.ini"), "Config", "SelectionColor", 0x94AECE);
  23.         edit2.shift_color = EAX;
  24.         ini_get_int stdcall (abspath("Eolite.ini"), "Config", "LineHeight", 18);
  25.         files.line_h = EAX;
  26.         ini_get_int stdcall (abspath("Eolite.ini"), "Config", "ShowDeviceName", 1);
  27.         show_dev_name = EAX;
  28.         ini_get_int stdcall (abspath("Eolite.ini"), "Config", "RealFileNamesCase", 0);
  29.         real_files_names_case = EAX;
  30.         ini_get_int stdcall (abspath("Eolite.ini"), "Config", "DrwRamDiskSpace", 0);
  31.         drw_ram_disk_space = EAX;
  32. }
  33.  
  34.  
  35. void Write_Error(int error_number)
  36. {
  37.         char error_message[500];
  38.         dword ii;
  39.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  40.         pause(5);
  41.         strcpy(#error_message, "\"Eolite\n");
  42.         ii = get_error(error_number);
  43.         strcat(#error_message, ii);
  44.         strcat(#error_message, "\" -tE");
  45.         notify(#error_message);
  46. }
  47.  
  48.  
  49. dword StrToCol(char* htmlcolor)
  50. {
  51.   dword j, color=0;
  52.   char ch=0x00;
  53.  
  54.   FOR (j=0; j<6; j++)
  55.   {
  56.     ch=ESBYTE[htmlcolor+j];
  57.     IF ((ch>='0') && (ch<='9')) ch -= '0';
  58.     IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
  59.     IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
  60.     color = color*0x10 + ch;
  61.   }
  62.    return color;
  63. }