Changeset bc73be3 in mainline for uspace/lib/cpp/include/__bits


Ignore:
Timestamp:
2019-06-27T08:51:20Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8add15e0
Parents:
ad40b74b (diff), aeba767 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

cpp: merge and resolve conflicts

Location:
uspace/lib/cpp/include/__bits
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/__bits/chrono.hpp

    rad40b74b rbc73be3  
    611611            static time_point now()
    612612            {
    613                 hel::timespec ts{};
    614                 hel::getrealtime(&ts);
     613                ::std::timespec ts{};
     614                ::helenos::getrealtime(&ts);
    615615
    616616                rep time = NSEC2USEC(ts.tv_nsec);
     
    654654            static time_point now()
    655655            {
    656                 hel::timespec ts{};
    657                 hel::getuptime(&ts);
     656                ::std::timespec ts{};
     657                ::helenos::getuptime(&ts);
    658658
    659659                rep time = NSEC2USEC(ts.tv_nsec);
  • uspace/lib/cpp/include/__bits/io/ios.hpp

    rad40b74b rbc73be3  
    4141{
    4242    using streamoff = long long;
    43     using streamsize = hel::ssize_t;
     43    using streamsize = ::ssize_t;
    4444
    4545    /**
  • uspace/lib/cpp/include/__bits/limits.hpp

    rad40b74b rbc73be3  
    528528            static constexpr unsigned short min()
    529529            {
    530                 return USHRT_MIN;
     530                return 0;
    531531            }
    532532
     
    552552            static constexpr unsigned int min()
    553553            {
    554                 return UINT_MIN;
     554                return 0;
    555555            }
    556556
     
    576576            static constexpr unsigned long min()
    577577            {
    578                 return ULONG_MIN;
     578                return 0;
    579579            }
    580580
     
    600600            static constexpr unsigned long long min()
    601601            {
    602                 return ULLONG_MIN;
     602                return 0;
    603603            }
    604604
  • uspace/lib/cpp/include/__bits/locale/num_get.hpp

    rad40b74b rbc73be3  
    301301                if (size > 0)
    302302                {
    303                     int ret{};
     303                    int olderrno{errno};
     304                    errno = EOK;
     305                    char *endptr = NULL;
     306
    304307                    if constexpr (is_signed<BaseType>::value)
    305                         ret = std::hel::str_int64_t(base.buffer_, nullptr, num_base, false, &res);
    306                     else
    307                         ret = std::hel::str_uint64_t(base.buffer_, nullptr, num_base, false, &res);
    308 
    309                     if (ret != EOK)
    310                     {
     308                        res = ::strtoll(base.buffer_, &endptr, num_base);
     309                    else
     310                        res = ::strtoull(base.buffer_, &endptr, num_base);
     311
     312                    if (errno != EOK || endptr == base.buffer_)
    311313                        err |= ios_base::failbit;
    312                         v = 0;
    313                     }
    314                     else if (res > static_cast<BaseType>(numeric_limits<T>::max()))
     314
     315                    errno = olderrno;
     316
     317                    if (res > static_cast<BaseType>(numeric_limits<T>::max()))
    315318                    {
    316319                        err |= ios_base::failbit;
  • uspace/lib/cpp/include/__bits/random.hpp

    rad40b74b rbc73be3  
    10301030             *       something better.
    10311031             */
    1032             hel::srand(hel::time(nullptr));
     1032            ::srand(::time(nullptr));
    10331033        }
    10341034
    10351035        result_type operator()()
    10361036        {
    1037             return hel::rand();
     1037            return ::rand();
    10381038        }
    10391039
  • uspace/lib/cpp/include/__bits/string/string.hpp

    rad40b74b rbc73be3  
    8282        static int compare(const char_type* s1, const char_type* s2, size_t n)
    8383        {
    84             return hel::str_lcmp(s1, s2, n);
     84            return ::strncmp(s1, s2, n);
    8585        }
    8686
    8787        static size_t length(const char_type* s)
    8888        {
    89             return hel::str_size(s);
     89            return ::strlen(s);
    9090        }
    9191
     
    367367            // TODO: This function does not exits...
    368368            __unimplemented();
    369             //return hel::wstr_lcmp(s1, s2, n);
    370369            return 0;
    371370        }
     
    373372        static size_t length(const char_type* s)
    374373        {
    375             return hel::wstr_size(s);
     374            size_t i = 0;
     375            while (s[i] != 0)
     376                i++;
     377            return i;
    376378        }
    377379
  • uspace/lib/cpp/include/__bits/thread/condition_variable.hpp

    rad40b74b rbc73be3  
    3535namespace std
    3636{
    37     extern "C" {
    38         #include <fibril.h>
    39         #include <fibril_synch.h>
    40     }
    41 
    4237    enum class cv_status
    4338    {
  • uspace/lib/cpp/include/__bits/thread/threading.hpp

    rad40b74b rbc73be3  
    3030#define LIBCPP_BITS_THREAD_THREADING
    3131
    32 namespace std::hel
    33 {
    34     extern "C" {
    35         #include <async.h>
    36         #include <fibril.h>
    37         #include <fibril_synch.h>
    38     }
    39 }
    40 
    4132#include <chrono>
     33
     34#include <fibril.h>
     35#include <fibril_synch.h>
    4236
    4337namespace std::aux
     
    5549    struct threading_policy<fibril_tag>
    5650    {
    57         using mutex_type        = hel::fibril_mutex_t;
    58         using thread_type       = hel::fid_t;
    59         using condvar_type      = hel::fibril_condvar_t;
    60         using time_unit         = hel::usec_t;
    61         using shared_mutex_type = hel::fibril_rwlock_t;
     51        using mutex_type        = ::helenos::fibril_mutex_t;
     52        using thread_type       = ::helenos::fid_t;
     53        using condvar_type      = ::helenos::fibril_condvar_t;
     54        using time_unit         = ::helenos::usec_t;
     55        using shared_mutex_type = ::helenos::fibril_rwlock_t;
    6256
    6357        struct thread
     
    6660            static thread_type create(Callable clbl, Payload& pld)
    6761            {
    68                 return hel::fibril_create(clbl, (void*)&pld);
     62                return ::helenos::fibril_create(clbl, (void*)&pld);
    6963            }
    7064
    7165            static void start(thread_type thr)
    7266            {
    73                 hel::fibril_add_ready(thr);
     67                ::helenos::fibril_add_ready(thr);
    7468            }
    7569
    7670            static thread_type this_thread()
    7771            {
    78                 return hel::fibril_get_id();
     72                return ::helenos::fibril_get_id();
    7973            }
    8074
    8175            static void yield()
    8276            {
    83                 hel::fibril_yield();
     77                ::helenos::fibril_yield();
    8478            }
    8579
     
    9589            static void init(mutex_type& mtx)
    9690            {
    97                 hel::fibril_mutex_initialize(&mtx);
     91                ::helenos::fibril_mutex_initialize(&mtx);
    9892            }
    9993
    10094            static void lock(mutex_type& mtx)
    10195            {
    102                 hel::fibril_mutex_lock(&mtx);
     96                ::helenos::fibril_mutex_lock(&mtx);
    10397            }
    10498
    10599            static void unlock(mutex_type& mtx)
    106100            {
    107                 hel::fibril_mutex_unlock(&mtx);
     101                ::helenos::fibril_mutex_unlock(&mtx);
    108102            }
    109103
    110104            static bool try_lock(mutex_type& mtx)
    111105            {
    112                 return hel::fibril_mutex_trylock(&mtx);
     106                return ::helenos::fibril_mutex_trylock(&mtx);
    113107            }
    114108
     
    124118            static void init(condvar_type& cv)
    125119            {
    126                 hel::fibril_condvar_initialize(&cv);
     120                ::helenos::fibril_condvar_initialize(&cv);
    127121            }
    128122
    129123            static void wait(condvar_type& cv, mutex_type& mtx)
    130124            {
    131                 hel::fibril_condvar_wait(&cv, &mtx);
     125                ::helenos::fibril_condvar_wait(&cv, &mtx);
    132126            }
    133127
    134128            static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout)
    135129            {
    136                 return hel::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
     130                return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
    137131            }
    138132
    139133            static void signal(condvar_type& cv)
    140134            {
    141                 hel::fibril_condvar_signal(&cv);
     135                ::helenos::fibril_condvar_signal(&cv);
    142136            }
    143137
    144138            static void broadcast(condvar_type& cv)
    145139            {
    146                 hel::fibril_condvar_broadcast(&cv);
     140                ::helenos::fibril_condvar_broadcast(&cv);
    147141            }
    148142        };
     
    158152            static void sleep(time_unit time)
    159153            {
    160                 hel::fibril_usleep(time);
     154                ::helenos::fibril_usleep(time);
    161155            }
    162156        };
     
    166160            static void init(shared_mutex_type& mtx)
    167161            {
    168                 hel::fibril_rwlock_initialize(&mtx);
     162                ::helenos::fibril_rwlock_initialize(&mtx);
    169163            }
    170164
    171165            static void lock(shared_mutex_type& mtx)
    172166            {
    173                 hel::fibril_rwlock_write_lock(&mtx);
     167                ::helenos::fibril_rwlock_write_lock(&mtx);
    174168            }
    175169
    176170            static void unlock(shared_mutex_type& mtx)
    177171            {
    178                 hel::fibril_rwlock_write_unlock(&mtx);
     172                ::helenos::fibril_rwlock_write_unlock(&mtx);
    179173            }
    180174
    181175            static void lock_shared(shared_mutex_type& mtx)
    182176            {
    183                 hel::fibril_rwlock_read_lock(&mtx);
     177                ::helenos::fibril_rwlock_read_lock(&mtx);
    184178            }
    185179
    186180            static void unlock_shared(shared_mutex_type& mtx)
    187181            {
    188                 hel::fibril_rwlock_read_unlock(&mtx);
     182                ::helenos::fibril_rwlock_read_unlock(&mtx);
    189183            }
    190184
Note: See TracChangeset for help on using the changeset viewer.