Subversion Repositories Kolibri OS

Rev

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

  1. #include <menuet/os.h>
  2. #include <math.h>
  3. #include <time.h>
  4.  
  5. #ifdef DBG
  6. #undef DBG
  7. #endif
  8. #define DBG(s) __menuet__debug_out(s) /* For the debug messages in BOARD */
  9. //#define DBG(s) LOG((s))            /* So that we see debug in Netsurf's LOG files */
  10.  
  11. /*     
  12. long int  __divdi3(long int  a, long int  b) {
  13.         //DBG("divdi3\n");
  14.         return 0;}
  15. */
  16.  
  17. /*
  18. long long int __divdi3(long long int a, long long int b) {
  19.         DBG("divdi3\n");
  20.         return a/b;}
  21. */
  22.  
  23.  
  24. char * locale_charset(){
  25.         DBG("Charset is US\n");
  26.         return "US-ASCII";}
  27.  
  28. float strtof(const char* str, char** endptr){
  29.         DBG("STRTOOOF\n");
  30.         return 0.0f;}
  31.        
  32.        
  33. char *realpath(const char *path, char *resolved_path){
  34.         char zuup[1024];
  35.         int i;
  36.         char *zoo;
  37.         char *boo;
  38.         char n, s;
  39.        
  40.         if (resolved_path==0) {
  41.                 DBG("ResPath is null");
  42.                 resolved_path=malloc(strlen(path)+1);
  43.         }
  44.        
  45.         zoo=resolved_path;
  46.         boo=path;
  47.         memcpy(zoo,boo,strlen(boo));
  48.         zoo[strlen(boo)]=0;
  49.        
  50.        
  51.         for (i=0; i<strlen(boo); i++) {
  52.                 n=*path;
  53.                 path++;
  54.                 s=*path;
  55.                
  56.                 if ((n=='/' && s!='/') || (n!='/') ) {
  57.                         *resolved_path=n;
  58.                         resolved_path++;
  59.                        
  60.                 }
  61.         }
  62.         *resolved_path=0;
  63.        
  64.        
  65.        
  66.         DBG("Real path is... \n");
  67.         sprintf (zuup, "A:%s\n", boo);
  68.         DBG(zuup);
  69.         sprintf (zuup, "B:%s\n", zoo);
  70.         DBG(zuup);
  71.        
  72.         //memcpy(resolved_path, path, strlen(path));
  73.        
  74.        
  75.        
  76.        
  77.        
  78.         return zoo;
  79. }
  80.  
  81. #include <stdint.h>
  82. #include <netinet/in.h>
  83.  
  84. int inet_aton(const char *cp, struct in_addr *inp){
  85.         DBG("No IP\n");
  86.         return 0;
  87. }
  88.  
  89. #include <stdarg.h>
  90.  
  91. void va_copy(va_list dest, va_list src){ //WHAA
  92. dest=src;
  93. DBG("Some shit...\n");
  94. }
  95.  
  96.  
  97.  
  98. void timeradd(struct timeval *a, struct timeval *b,
  99.                      struct timeval *res){
  100.                                                  
  101.                                                   (res)->tv_sec = (a)->tv_sec + (b)->tv_sec;      
  102.         (res)->tv_usec = (a)->tv_usec + (b)->tv_usec;  
  103.          if ((res)->tv_usec >= 1000000) {        
  104.              (res)->tv_sec++;                    
  105.              (res)->tv_usec -= 1000000;          
  106.          }      
  107.                                                  //DBG("Timeradd\n");
  108.  }
  109.  
  110. void timersub(struct timeval *a, struct timeval *b,
  111.                      struct timeval *res){
  112.                                                  
  113.                                                  res->tv_sec=a->tv_sec - b->tv_sec;
  114.                                                  res->tv_usec=a->tv_usec - b->tv_usec;
  115.                                                  if ((res)->tv_usec < 0) {              
  116.              (res)->tv_sec--;                    
  117.              (res)->tv_usec += 1000000;          
  118.          }    
  119.                                                 // DBG("Timersub\n");
  120.          }
  121.  
  122.      
  123.  
  124.        int timerisset(struct timeval *tvp){
  125.                    
  126.                    //DBG("Timer is set?\n");
  127.                    
  128.                    return  ((tvp)->tv_sec || (tvp)->tv_usec);
  129.                    
  130.                    }
  131.  
  132.        int timercmp(struct timeval *a, struct timeval *b, int z){
  133.                    
  134.                    //DBG("Timercmp is a MACRO \n");
  135.                    
  136.                    if (a->tv_sec > b->tv_sec) return 1; //was 1
  137.                    return 0;}
  138.  
  139. int wctomb(char *s, int wchar){
  140.        
  141.         DBG("wctomb\n");
  142.         return 0;}
  143.        
  144. int wcrtomb(char * s, int wc, int * ps){
  145.         DBG("wcrtomb\n");
  146.         return 0;
  147. }
  148.  
  149. int mbrtowc(int * pwc, const char * s,
  150.        int n, int * ps){
  151.                    DBG("mbrtowc\n");
  152.                    return 0;}
  153.  
  154. int johab_hangul_decompose( const char * s){
  155.                    DBG("hanguul?\n");
  156.                    return 0;}
  157.