Changeset 1093


Ignore:
Timestamp:
03/20/11 08:18:14 (2 years ago)
Author:
reyalP
Message:

merge r1092 from trunk to ptp branch

Location:
branches/reyalp-ptp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-ptp

    • Property svn:mergeinfo changed
      /trunkmerged: 1092
  • branches/reyalp-ptp/include/ctype.h

    r993 r1093  
    11#ifndef CTYPE_H 
    22#define CTYPE_H 
    3  
     3// dummy for lua code 
    44#include <stdlib.h> 
    5  
    6 static inline int iscntrl( int c ) { 
    7     return 0; 
    8 } 
    9  
    10 static inline int isalnum( int c ) { 
    11     return isalpha(c) || isdigit(c); 
    12 } 
    13  
    145#endif 
  • branches/reyalp-ptp/include/stdlib.h

    r871 r1093  
    100100extern int ispunct(int c); 
    101101extern int isxdigit(int c); 
     102extern int iscntrl(int c); 
     103extern int isalnum(int c); 
    102104 
    103105extern long sprintf(char *s, const char *st, ...); 
  • branches/reyalp-ptp/platform/generic/wrappers.c

    r1068 r1093  
    1515#define _X      0x40    /* hex digit */ 
    1616#define _SP     0x80    /* hard space (0x20) */ 
    17 unsigned char _ctype[] = { 
     17static int _ctype(int c,int t) { 
     18static unsigned char ctypes[] = { 
    1819_C,_C,_C,_C,_C,_C,_C,_C,                        /* 0-7 */ 
    1920_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,         /* 8-15 */ 
     
    40410,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                /* 224-239 */ 
    41420,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};               /* 240-255 */ 
     43    // have to handle EOF (-1) 
     44    if( (unsigned)c >= sizeof(ctypes)) { 
     45        return 0; 
     46    } 
     47    return ctypes[c] & t; 
     48} 
    4249#endif 
    4350 
     
    286293    return _isdigit(c); 
    287294#else 
    288     return _ctype[c]&_D; 
     295    return _ctype(c,_D); 
    289296#endif 
    290297} 
     
    294301    return _isspace(c); 
    295302#else 
    296     return _ctype[c]&_S; 
     303    return _ctype(c,_S); 
    297304#endif 
    298305 
     
    303310    return _isalpha(c); 
    304311#else 
    305     return _ctype[c]&(_U|_L); 
     312    return _ctype(c,(_U|_L)); 
    306313#endif 
    307314} 
     
    311318    return _isupper(c); 
    312319#else 
    313     return _ctype[c]&_U; 
     320    return _ctype(c,_U); 
    314321#endif 
    315322 
     
    320327    return _islower(c); 
    321328#else 
    322     return _ctype[c]&_L; 
     329    return _ctype(c,_L); 
    323330#endif 
    324331 
     
    329336    return _ispunct(c); 
    330337#else 
    331     return _ctype[c]&_P; 
     338    return _ctype(c,_P); 
    332339#endif 
    333340} 
     
    337344    return _isxdigit(c); 
    338345#else 
    339     return _ctype[c]&(_X|_D); 
     346    return _ctype(c,(_X|_D)); 
     347#endif 
     348} 
     349 
     350int isalnum(int c) { 
     351    return (isdigit(c) || isalpha(c)); 
     352} 
     353 
     354int iscntrl(int c) { 
     355#if !CAM_DRYOS 
     356    return ((c >=0 && c <32) || c == 127); // don't want to require the whole ctype table on vxworks just for this one 
     357#else 
     358    return _ctype(c,_C); 
    340359#endif 
    341360} 
Note: See TracChangeset for help on using the changeset viewer.