Subversion Repositories Kolibri OS

Rev

Rev 7970 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. struct _anchors {
  3.         char current[256];
  4.         collection anchor_name;
  5.         collection anchor_position;
  6.         void add();
  7.         int get_pos_by_name();
  8.         void clear();
  9.         void take_anchor_from();
  10. } anchors=0;
  11.  
  12. void _anchors::add(dword _name, _pos)
  13. {
  14.         anchor_name.add(_name);
  15.         anchor_position.add(itoa(_pos));
  16. }
  17.  
  18. int _anchors::get_pos_by_name(dword _get_name)
  19. {
  20.         dword pos_name = anchor_name.get_pos_by_name(_get_name);
  21.         if (ESBYTE[_get_name]==NULL) return 0;
  22.         if (pos_name==-1) {
  23.                 return -1;
  24.         } else {
  25.                 return atoi(anchor_position.get(pos_name));
  26.         }
  27. }
  28.  
  29. void _anchors::clear()
  30. {
  31.         anchor_name.drop();
  32.         anchor_position.drop();
  33. }
  34.  
  35. void _anchors::take_anchor_from(dword _URL)
  36. {
  37.         int anchor_pos;
  38.         if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
  39.                 strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
  40.                 ESBYTE[_URL+anchor_pos-1] = '\0';
  41.         }
  42. }
  43.  
  44.