home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / tab.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  1.1 KB  |  42 lines

  1. // $Id: tab.cpp,v 1.6 2001/01/10 16:49:45 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1999, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #include "tab.h"
  11.  
  12. #ifdef    HAVE_JIKES_NAMESPACE
  13. namespace Jikes {    // Open namespace Jikes block
  14. #endif
  15.  
  16. int Tab::tab_size = Tab::DEFAULT_TAB_SIZE;
  17.  
  18. //
  19. // Compute the length of a wide character string segment
  20. // after expanding tabs.
  21. //
  22. int Tab::Wcslen(wchar_t *line, int start, int end)
  23. {
  24.     for (int i = start--; i <= end; i++)
  25.     {
  26.         if (line[i] == U_HORIZONTAL_TAB)
  27.         {
  28.             int offset = (i - start) - 1;
  29.             start -= ((tab_size - 1) - offset % tab_size);
  30.         }
  31.         else if (Coutput.ExpandWchar() && line[i] > 0xFF)
  32.              start -= 5;
  33.     }
  34.  
  35.     return (end - start);
  36. }
  37.  
  38. #ifdef    HAVE_JIKES_NAMESPACE
  39. }            // Close namespace Jikes block
  40. #endif
  41.  
  42.