Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
port to alpha, inital try to convert, exchange/convert arrays of scalar in one shoot
[simgrid.git] / src / gras / DataDesc / ddt_convert.c
1 /* $Id$ */
2
3 /* ddt_remote - Stuff needed to get datadescs about remote hosts            */
4
5 /* Authors: Olivier Aumage, Martin Quinson                                  */
6 /* Copyright (C) 2003, 2004 the GRAS posse.                                 */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 /************************************************************************/
12 /* C combines the power of assembler with the portability of assembler. */
13 /************************************************************************/
14
15 #include "DataDesc/datadesc_private.h"
16
17 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(convert,DataDesc);
18
19 /***
20  *** Table of all known architectures. 
21  ***/
22
23 const gras_arch_desc_t gras_arches[gras_arch_count] = {
24   {"i386",   0,   {1,2,4,4,8,   4,4,   4,8}},
25   {"alpha",  0,   {1,2,4,8,8,   8,8,   4.8}},
26   {"powerpc",1,   {1,2,4,4,8,   4,4,   4,8}},
27   {"sparc",  1,   {1,2,4,8,8,   8,8,   4,8}}
28 };
29
30 const char *gras_datadesc_arch_name(int code) {
31    if (code < 0 || code >= gras_arch_count)
32      return "[unknown arch]";
33    return gras_arches[code].name;
34 }
35
36 /**
37  * gras_dd_convert_elm:
38  *
39  * Convert the element described by @type comming from architecture @r_arch.
40  * The data to be converted is stored in @src, and is to be stored in @dst.
41  * Both pointers may be the same location if no resizing is needed.
42  */
43 gras_error_t
44 gras_dd_convert_elm(gras_datadesc_type_t *type, int count,
45                     int r_arch, 
46                     void *src, void *dst) {
47   //  gras_dd_cat_scalar_t scal_data = type->category.scal_data;
48
49   gras_assert(type->category_code == e_gras_datadesc_type_cat_scalar);
50
51   if (r_arch == GRAS_THISARCH)
52     return no_error;
53
54   if (gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian &&
55       type->aligned_size[r_arch] == type->aligned_size[GRAS_THISARCH])
56     return no_error;
57
58   
59
60   RAISE_UNIMPLEMENTED;
61 }
62
63 /**
64  * gras_arch_selfid:
65  *
66  * returns the ID of the architecture the process is running on
67  */
68 int
69 gras_arch_selfid(void) {
70   return GRAS_THISARCH;
71 }