Esempio n. 1
0
#include <limits.h>


//
// Define the description strings and track indicators for the memory
// descriptors.
//
#define CHPL_MEMDESC_MACRO(_enum, _str, _track)  { _str, _track }

struct md_desc_type {
    const char* string;
    chpl_bool track;
};

static struct md_desc_type rt_md[] = {
    CHPL_MD_ALL_MEMDESCS(CHPL_MEMDESC_MACRO)
};

#undef CHPL_MEMDESC_MACRO


const char* chpl_mem_descString(chpl_mem_descInt_t mdi) {
    if (mdi < CHPL_RT_MD_NUM)
        return rt_md[mdi].string;
    return chpl_mem_descs[mdi-CHPL_RT_MD_NUM];
}


chpl_bool chpl_mem_descTrack(chpl_mem_descInt_t mdi) {
    //
    // For the runtime-defined descriptor types, for now we either track
//
// Shared code for different mem implementations in mem-*/chpl_*_mem.c
//
#include "chplrt.h"

#include "chpl-mem-desc.h"
#include "chpltypes.h"
#include "error.h"

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>


//
// Define the description strings for the memory descriptors.
//
#define CHPL_MEMDESC_DESC(md_name, md_desc)  md_desc
static const char* rt_memDescs[] = {
  CHPL_MD_ALL_MEMDESCS(CHPL_MEMDESC_DESC)
};

const char* chpl_mem_descString(chpl_mem_descInt_t mdi) {
  if (mdi < CHPL_RT_MD_NUM)
    return rt_memDescs[mdi];
  else
    return chpl_mem_descs[mdi-CHPL_RT_MD_NUM];
}