Skip to content
Snippets Groups Projects
Select Git revision
  • ec0b07dbf036d67adbab21656c27ebde28e35c7f
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

GModel.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    OS.cpp 11.65 KiB
    // GetDP - Copyright (C) 1997-2018 P. Dular and C. Geuzaine, University of Liege
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <getdp@onelab.info>.
    
    // This file contains a bunch of functions that depend on OS-dependent
    // features and/or system calls
    
    // these are available on all OSes
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <signal.h>
    #include <time.h>
    #include <string.h>
    
    #if defined(__APPLE__)
    #include <sys/sysctl.h>
    #endif
    
    #if defined(__linux__) && !defined(BUILD_ANDROID)
    #include <sys/sysinfo.h>
    #endif
    
    #if !defined(WIN32) || defined(__CYGWIN__)
    #include <unistd.h>
    #include <sys/time.h>
    #include <sys/resource.h>
    #endif
    
    #if defined(WIN32)
    #include <windows.h>
    #include <process.h>
    #include <psapi.h>
    #include <direct.h>
    #include <io.h>
    #include <sys/timeb.h>
    #endif
    
    #include "Message.h"
    
    #if defined(WIN32) && !defined(__CYGWIN__)
    
    // Unicode utility routines borrowed from FLTK
    
    static unsigned int utf8decode(const char* p, const char* end, int* len)
    {
      static unsigned short cp1252[32] = {
        0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
        0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
        0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
        0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178
      };
      unsigned char c = *(unsigned char*)p;
      if (c < 0x80) {
        if (len) *len = 1;
        return c;
      } else if (c < 0xa0) {
        if (len) *len = 1;
        return cp1252[c-0x80];
      } else if (c < 0xc2) {
        goto FAIL;
      }
      if ( (end && p+1 >= end) || (p[1]&0xc0) != 0x80) goto FAIL;
      if (c < 0xe0) {
        if (len) *len = 2;
        return
          ((p[0] & 0x1f) << 6) +
          ((p[1] & 0x3f));