gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/libcallgl callgl.cxx


From: Matti Katila
Subject: [Gzz-commits] gzz/gfx/libcallgl callgl.cxx
Date: Fri, 06 Sep 2002 17:36:20 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Matti Katila <address@hidden>   02/09/06 17:36:20

Modified files:
        gfx/libcallgl  : callgl.cxx 

Log message:
        Fixed #-comments

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcallgl/callgl.cxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: gzz/gfx/libcallgl/callgl.cxx
diff -c gzz/gfx/libcallgl/callgl.cxx:1.8 gzz/gfx/libcallgl/callgl.cxx:1.9
*** gzz/gfx/libcallgl/callgl.cxx:1.8    Wed Sep  4 09:09:27 2002
--- gzz/gfx/libcallgl/callgl.cxx        Fri Sep  6 17:36:20 2002
***************
*** 27,44 ****
  
      int getToken(string tok);
      double getTokenf(string tok);
!  
      vector<string> split(string str) {
!       vector<string> v;
!       const char *p = str.c_str();
!       char buf[1000];
!       int n;
! 
!       while (sscanf(p, " %999s %n", buf, &n) == 1) {
!       v.insert(v.end(), string(buf));
!       p += n;
!       }
!       return v;
      }
  
      vector<GLfloat> getfv(vector<string> v, unsigned i, int reserve = 0) {
--- 27,86 ----
  
      int getToken(string tok);
      double getTokenf(string tok);
! 
! 
!     /* Understands whitespaces: ' ' and '\t' (tabulator)
!      *
!      *  string foo = "abcd efg";
!      *  string bar = separate(foo);
!      *    -> foo = "efg"
!      *    -> bar = "abcd"                                        
!      *
!      *  bar = separate(foo);
!      *    -> foo = ""
!      *    -> bar = "efg"
!      */   
!     string separate(string & str) {
!         string::size_type position_space = str.find(' ');
!         string::size_type position_tab = str.find('\t');
!         string first_part;
! 
!         if (position_space != string::npos ||
!             position_tab != string::npos ) 
!         {
!             if (position_space < position_tab) {
!                first_part = str.substr(0, position_space);
!                str = str.substr(position_space + 1, str.length() );
!             } else {
!                first_part = str.substr(0, position_tab);
!                str = str.substr(position_tab + 1, str.length() );
!             }
!         } else {
!             first_part = str; 
!             str = "";
!         }
!         return first_part;
!     }
! 
! 
! 
!     /* vector<string> v = split("  asdf   #  asdffoo fasdf # fadasfd ");
!      * 0: asdf
!      * 1: #
!      * 2: asdffoo
!      * 3: fasdf
!      * 4: #
!      * 5: fadasfd
!      */ 
      vector<string> split(string str) {
!         string tmp;
!         vector<string> v;
! 
!         while (str != "") {
!             tmp = separate(str);
!             if (tmp != "") v.push_back(tmp);
!         }
!         return v;
      }
  
      vector<GLfloat> getfv(vector<string> v, unsigned i, int reserve = 0) {
***************
*** 82,94 ****
    
      bool callGLop(string s) {
          DBG(dbg) << "callGLop(\"" << s << "\")\n";
!  
        vector<string> v = split(s);
        
        if (v.size() < 1) return true;
  
        // Ignore lines where the first splitted "word" starts with a '#'
!       if (v[0][0] == '#') return true;
   
        if (checkfunc(v, "Enable", 1)) {
          glEnable(getToken(v[1]));
--- 124,139 ----
    
      bool callGLop(string s) {
          DBG(dbg) << "callGLop(\"" << s << "\")\n";
! 
!         string::size_type position = s.find('#');
!         if (position != string::npos) s = s.substr(0, position);
!         
        vector<string> v = split(s);
        
        if (v.size() < 1) return true;
  
        // Ignore lines where the first splitted "word" starts with a '#'
!       //if (v[0][0] == '#') return true;
   
        if (checkfunc(v, "Enable", 1)) {
          glEnable(getToken(v[1]));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]