DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ F T ┃
Length: 5578 (0x15ca) Types: TextFile Names: »FRAME_C«
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13 └─ ⟦124ff5788⟧ »DATA« └─⟦this⟧ └─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16 └─ ⟦6f12a12be⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧
#include <stdio.h> #include <Xm/Xm.h> #define NULL_STRING "" #define MAX_FRAME 10 #define NO_FREE_FRAME 0 #define INVALID_WIDGET 0 #define MAX_EVENT 40 #define LG_WINDOW_NAME 10 #define LG_TYPE 15 #define LG_FIELD 30 #define LG_VALUE 60 struct s_event { char type[LG_TYPE]; char field[LG_FIELD]; char value[LG_VALUE]; }; struct s_frame { Widget w; int busy; char name[LG_WINDOW_NAME]; struct s_event event[MAX_EVENT]; int get; int put; int nbevent; Boolean fieldChanged; Boolean changeEnable; } frames[MAX_FRAME+1]; /* -------- Utilitaires ------------------------------------*/ char *RemoveTrailingSpaces(char *str) { int i; for (i=strlen(str)-1; str[i]==' '; i--) str[i]='\0'; return str; } /* -------- Routines de gestion des Frames associes aux fenetres XFM -----*/ void InitFrame() { int i,j; for (i=1;i<MAX_FRAME+1;i++) { frames[i].w=0; frames[i].busy=FALSE; frames[i].name[0]='\0'; frames[i].put=frames[i].get=frames[i].nbevent=0; frames[i].fieldChanged=FALSE; frames[i].changeEnable=TRUE; for (j=0; j<MAX_EVENT; j++) { frames[i].event[j].type[0]='\0'; frames[i].event[j].field[0]='\0'; frames[i].event[j].value[0]='\0'; } } } void PrintFrame() { int i; for (i=0; i<MAX_FRAME+1; i++) if (frames[i].busy) printf("frame[%d]: %d, %s \n",i,frames[i].w,frames[i].name); } int GetFrameId(char *name) { int i; if (strlen(name) > LG_WINDOW_NAME) { printf("*** Size of Window Name %s is too long (Frame.c)\n",name); exit(1); } for (i=1;i<MAX_FRAME+1;i++) if (!frames[i].busy) { frames[i].busy=TRUE; strcpy(frames[i].name,name); return i; } return NO_FREE_FRAME; } int WidgetToFrame(Widget w) { int i; for(i=1;i<MAX_FRAME;i++) if (frames[i].busy) if (frames[i].w==w) return i; return INVALID_WIDGET; } char* GetFrameName(int frame) { if (frames[frame].busy) return frames[frame].name; else return NULL_STRING; } void FreeFrame(int frame) { int j; frames[frame].busy=FALSE; frames[frame].name[0]='\0'; frames[frame].w=0; frames[frame].put=frames[frame].get=frames[frame].nbevent=0; for (j=1; j<MAX_EVENT; j++) { frames[frame].event[j].type[0]='\0'; frames[frame].event[j].field[0]='\0'; frames[frame].event[j].value[0]='\0'; } } void SetFrameWidget(int frame, Widget w) { frames[frame].w = w; } Widget GetFrameWidget(int frame) { return frames[frame].w; } int MaxFrame() { return MAX_FRAME; } /* -- Routines de gestion des files d'evenements associees a chaque frame -- */ void PutEventAda(int frame,char *evt_type,char *field_name,char *value) { if (frames[frame].nbevent < MAX_EVENT) { if (!frames[frame].busy) { printf("*** Frame %d not affected to a window (Frame.c)\n",frame); exit(1); } if (strlen(evt_type) > LG_TYPE) { printf("*** Size of Event Type %s is too long (Frame.c)\n",evt_type); exit(1); } else strcpy(frames[frame].event[frames[frame].put].type,evt_type); if (strlen(field_name) > LG_FIELD) { printf("*** Size of Field Name %s is too long (Frame.c)\n",field_name); exit(1); } else strcpy(frames[frame].event[frames[frame].put].field,field_name); if (strlen(field_name) > LG_VALUE) { printf("*** Size of Field Value %s is too long (Frame.c)\n",value); exit(1); } else strcpy(frames[frame].event[frames[frame].put].value, RemoveTrailingSpaces(value)); frames[frame].put=(frames[frame].put + 1) % MAX_EVENT; frames[frame].nbevent++; } else printf("*** Buffer Event Full (Frame.c)\n"); } void PutEvent(Widget w,char *evt_type,char *field_name,char *value) { int frame; if ((frame=WidgetToFrame(w))) { #ifdef DEBUG printf("PUT_EVENT: %d,%s -> %s,%s,\"%s\"\n", frame,GetFrameName(frame),evt_type,field_name,value); #endif PutEventAda(frame,evt_type,field_name,value); } else { printf("*** Unknown Widget %d (Frame.c)\n",w); printf(" type: %s field: %s value: %s\n",evt_type,field_name,value); PrintFrame(); } } char* GetType(int frame) { return frames[frame].event[frames[frame].get].type; } char* GetField(int frame) { return frames[frame].event[frames[frame].get].field; } char* GetValue(int frame) { return frames[frame].event[frames[frame].get].value; } void Next(int frame) { if (frames[frame].busy) { frames[frame].event[frames[frame].get].type[0]='\0'; frames[frame].event[frames[frame].get].field[0]='\0'; frames[frame].event[frames[frame].get].value[0]='\0'; frames[frame].get=(frames[frame].get + 1) % MAX_EVENT; frames[frame].nbevent--; } } int Empty(int frame) { if (!frames[frame].busy) return 1; else return (frames[frame].nbevent==0); } /* ------- Detection modification sur un champ ------------ */ int FindFrameId(Widget w) { int i; for(i=1;i<MAX_FRAME;i++) if (frames[i].busy) if (frames[i].w==w) return i; printf("*** Widget %d not found (Frame.c)\n",w); exit(1); } void SetFalse(Widget w) { frames[FindFrameId(w)].fieldChanged=FALSE; } Boolean FieldChanged(Widget w) { return frames[FindFrameId(w)].fieldChanged; } void DisableChanged(Widget w) { frames[FindFrameId(w)].changeEnable=FALSE; } void EnableChanged(Widget w) { frames[FindFrameId(w)].changeEnable=TRUE; } void ValueChanged(Widget w) { int Fid; Fid=FindFrameId(w); if (frames[Fid].changeEnable==TRUE) frames[Fid].fieldChanged=TRUE; }