Ejemplo n.º 1
0
void AdrenoMM_Final()
{
#ifdef USE_MEMORY_MANAGER
	memmgr_final();
#endif
	MEMORY_CHECK();
}
Ejemplo n.º 2
0
void malloc_final (void)
{
#ifdef USE_MEMMGR
	memmgr_final ();
#endif
	MEMORY_CHECK();
}
Ejemplo n.º 3
0
Archivo: read.c Proyecto: elopez/AC
inline void vm_READ_IMM(int32_t param1, int32_t unused param2)
{
    /* IMM: read an integer and copy it to address IMM */

    MEMORY_CHECK(param1);

    scanf("%d", &MEM32(param1));
}
Ejemplo n.º 4
0
Archivo: mov.c Proyecto: elopez/AC
inline void vm_MOV_IMM_IMM(int32_t param1, int32_t param2)
{
    /* IMM -> IMM: immediate to memory address */

    MEMORY_CHECK(param2);

    MEM32(param2) = param1;
}
Ejemplo n.º 5
0
Archivo: mov.c Proyecto: elopez/AC
inline void vm_MOV_REG_IMM(int32_t param1, int32_t param2)
{
    /* REG -> IMM: register to memory address */

    MEMORY_CHECK(param2);

    MEM32(param2) = REG(param1);
}
Ejemplo n.º 6
0
/// Tests the memory for errors and memory leaks.
void malloc_memory_check(void)
{
	MEMORY_CHECK();
}
Ejemplo n.º 7
0
int main(int argc, char **argv) {
	if(argc < 4) {
		printf("Usage: nc32bin varname nc3file binfile\n");
		exit(1);
	}

	int status, i, ndims;
	int ncfile_id, ncvar_id;
	int dimids[DIM_LEN];
	size_t size, nelmts, buflen;
	size_t dimlens[DIM_LEN];
	nc_type vartype;
	void *buf = NULL;

	/*
	 * read nc file
	 */
	status = nc_open(argv[2], NC_NOWRITE, &ncfile_id);
	NC_ASSERT(status);

	status = nc_inq_varid(ncfile_id, argv[1], &ncvar_id);
	NC_ASSERT(status);
	
	nc_inq_varndims(ncfile_id, ncvar_id, &ndims);
	nc_inq_vartype(ncfile_id, ncvar_id, &vartype);
	nc_inq_vardimid(ncfile_id, ncvar_id, dimids);
	for(i = 0; i < ndims; i++)
		nc_inq_dimlen(ncfile_id, dimids[i], &(dimlens[i]));

	size = get_type_size(vartype);
	nelmts = 1;
	for(i = 0; i < ndims; i++)
		nelmts *= dimlens[i];
	buflen = size * nelmts;
	buf = malloc(buflen);
	MEMORY_CHECK(buf);
	
	if(NC_SHORT == vartype)
		status = nc_get_var_short(ncfile_id, ncvar_id, (short *)buf);
	else if(NC_USHORT == vartype)
		status = nc_get_var_ushort(ncfile_id, ncvar_id, (unsigned short *)buf);
	else if(NC_INT == vartype)
		status = nc_get_var_int(ncfile_id, ncvar_id, (int *)buf);
	else if(NC_UINT == vartype)
		status = nc_get_var_uint(ncfile_id, ncvar_id, (unsigned int *)buf);
	else if(NC_INT64 == vartype)
		status = nc_get_var_longlong(ncfile_id, ncvar_id, (long long *)buf);
	else if(NC_UINT64 == vartype)
		status = nc_get_var_ulonglong(ncfile_id, ncvar_id, (unsigned long long *)buf);
	else if(NC_FLOAT == vartype)
		status = nc_get_var_float(ncfile_id, ncvar_id, (float *)buf);
	else if(NC_DOUBLE == vartype)
		status = nc_get_var_double(ncfile_id, ncvar_id, (double *)buf);
	
	NC_ASSERT(status);
	nc_close(ncfile_id);

	
	/*
	 * write binary
	 */
	FILE *fp = NULL;
	fp = fopen(argv[3], "wb");
	assert(fp != NULL);
	fwrite(buf, size, nelmts, fp);
	fclose(fp);

	return 0;
}
Ejemplo n.º 8
0
/// Tests the memory for errors and memory leaks.
void AdrenoMM_MemoryCheck()
{
	MEMORY_CHECK();
}