Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

f_his_swpbas.c

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 /*****************+***********+****************************************/
00017 /*                                                                    */
00018 /*   GSI, Gesellschaft fuer Schwerionenforschung mbH                  */
00019 /*   Postfach 11 05 52                                                */
00020 /*   D-64220 Darmstadt                                                */
00021 /*                                                                    */
00022 /*1+ C Procedure *************+****************************************/
00023 /*                                                                    */
00024 /*+ Module      : f_his_swpbas                                        */
00025 /*                                                                    */
00026 /*--------------------------------------------------------------------*/
00027 /*+ CALLING     : l_status = f_his_swpbas(ps_head)                    */
00028 /*--------------------------------------------------------------------*/
00029 /*                                                                    */
00030 /*+ PURPOSE     : Swaps whole base (except strings)                   */
00031 /*                                                                    */
00032 /*+ ARGUMENTS   :                                                     */
00033 /*                                                                    */
00034 /*+   ps_head  : (s_head *) input                                     */
00035 /*                 pointer to header structure, address of shared     */
00036 /*                 segment.                                           */
00037 /*+ Return type : int                                                 */
00038 /*                                                                    */
00039 /*2+Description***+***********+****************************************/
00040 /*                                                                    */
00041 /*+ CALLING     : l_status = f_his_swpbas(ps_head)                    */
00042 /*                                                                    */
00043 /*+ FUNCTION    :                                                     */
00044 /*                                                                    */
00045 /*3+Function******+***********+****************************************/
00046 /*                                                                    */
00047 /*                                                                    */
00048 /*                                                                    */
00049 /*2+Implementation************+****************************************/
00050 /*+ Utility     : f_his_swpbas                                        */
00051 /*+ File name   : f_his_swpbas.c                                      */
00052 /*+ Home direct.: /sbs/prod/src                                       */
00053 /*+ Version     : 1.01                                                */
00054 /*+ Author      : H.G.Essel                                           */
00055 /*+ Created     : 06-Jul-2000                                         */
00056 /*+ Object libr.:                                                     */
00057 /*+ Updates     : Date        Purpose                                 */
00058 /*1- C Procedure *************+****************************************/
00059 
00060 #include "f_his_swpbas.h"
00061 
00062 #include <stdlib.h>
00063 #include <stdio.h>
00064 #include "s_spe.h"
00065 #include "s_pol_cond.h"
00066 #include "s_win_cond.h"
00067 #include "f_swaplw.h"
00068 
00069 INTS4 f_his_swpbas(s_head *ps_head)
00070 {
00071   INTS4  i;
00072   s_spe  *ps_spe;
00073   s_win *ps_win;
00074   s_pol *ps_pol;
00075   INTS4  *pl_mem,*pl;
00076 
00077 /* swap first two LWs to get correct size */
00078 pl=(INTS4 *)ps_head;
00079 f_swaplw(pl,2,NULL);
00080 if(ps_head->l_endian != 1)
00081 {
00082     printf("endian was wrong %x\n",ps_head->l_endian);
00083     return(-1);
00084 }
00085 
00086 /* swap whole base */
00087 pl += 2;
00088 f_swaplw(pl,ps_head->l_len-2,NULL);
00089 
00090 /* swap back strings in header */
00091 pl=(INTS4 *)&ps_head->c_date;
00092 f_swaplw(pl,23,NULL);
00093 
00094 /* swap back strings in all slots */
00095 ps_spe=(s_spe *)(ps_head+1);
00096 pl=(INTS4 *)&ps_spe->c_name;
00097 for(i=0;i<ps_head->i_slot;i++)
00098 {
00099     f_swaplw(pl,71,NULL);
00100     pl += (sizeof(s_spe)/4);
00101 }
00102 
00103 /* swap back strings in all conditions */
00104 if(ps_head->l_cond_win > 0)
00105 {
00106 pl=(INTS4 *)ps_head;
00107 pl = pl + ps_head->l_cond_win;
00108 ps_win = (s_win *)(pl + 1);
00109 /*reswap window names */
00110 for(i=0;i< * pl;i++)
00111 {
00112   f_swaplw((INTS4 *)ps_win->c_name,28,NULL);
00113   ps_win++;
00114 }
00115 }
00116 if(ps_head->l_cond_pol > 0)
00117 {
00118 pl=(INTS4 *)ps_head;
00119 pl = pl + ps_head->l_cond_pol;
00120 ps_pol = (s_pol *)(pl + 1);
00121 /*reswap window names */
00122 for(i=0;i < *pl;i++)
00123 {
00124   f_swaplw((INTS4 *)ps_pol->c_name,28,NULL);
00125   ps_pol++;
00126 }
00127 }
00128 return(0);
00129 }
00130 
00131 
00132 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:33 2008 for Go4-v3.04-1 by  doxygen 1.4.2