DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ E T

⟦bec33d2a0⟧ TextFile

    Length: 7647 (0x1ddf)
    Types: TextFile
    Names: »EVENT_C«

Derivation

└─⟦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⟧ 

TextFile

#include <stdio.h>
#include <Xm/Xm.h>
#include <Fm.h>

#define MAX_EVENT 100
struct rec_x_event {
    int local_frame;
    char *evt_type;
    char *field_name;
    char *value;
    } queue_event[MAX_EVENT];

int queue_get=0;
int queue_put=0;
int nb_event=0;

void put_event(Widget w,char *evt_type,char *field_name,char *value)
{
  int lf;
  if (nb_event!=MAX_EVENT)
  { 
    if ((lf=widget_to_lf(w)))
    {  
    printf("PUT_EVENT: Widget: %d  lf: %d  type: %s  field: %s\n\tvalue: %s\n",
        w,lf,evt_type,field_name,value);
    queue_event[queue_put].local_frame=lf;
    queue_event[queue_put].evt_type=evt_type;
    queue_event[queue_put].field_name=field_name;
    queue_event[queue_put].value=value;
    queue_put= (queue_put + 1) % MAX_EVENT;
    nb_event++;
   }
   else 
   {
    printf("PUT_EVENT: Widget: %d  lf: %d  type: %s  field: %s\n\tvalue: %s\n",
        w,lf,evt_type,field_name,value);
    print_frame();
    printf("*** Unknown Widget (event.c)\n");
   }
  }
  else printf("*** Buffer Event Full (event.c)\n");
}

int get_lf() 
{
  return queue_event[queue_get].local_frame;
}

char* get_type()
{
    return adastr(queue_event[queue_get].evt_type);
}

char* get_field()
{
    return adastr(queue_event[queue_get].field_name);
}

char* get_value()
{
    return adastr(queue_event[queue_get].value);
}

void next()
{
    queue_get= (queue_get + 1) % MAX_EVENT;
    nb_event--;
}

int empty()
{
  return (nb_event==0);
}

char *MenuActions(Widget w,char *fctn,char *value)
{
  if (!strcmp(fctn,"DesItem"))
  {   
    XmListDeselectItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
  }
  else if (!strcmp(fctn,"DesPos"))
  {   
    XmListDeselectPos(w,atoi(value));
  }
  else
  {
    printf("Unknown Fonction List.%s\n",fctn);
  }
  return "";
}

char *TextActions(Widget w,char *fctn,char *value)
{
  if (!strcmp(fctn,"TextSetString"))
  {   
    XmTextSetString(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
  }
  else if (!strcmp(fctn,"TextSetMaxLength"))
  {   
    XmTextSetMaxLength(w,atoi(value));
  }
  else if (!strcmp(fctn,"TextSetEditable"))
  {   
    XmTextSetEditable(w,atoi(value));
  }
  else if (!strcmp(fctn,"TextGetString"))
  {   
    return XmTextGetString(w);
  }
  else
  {
    printf("Unknown Fonction List.%s\n",fctn);
  }
  return "";
}
char *LabelActions(Widget w,char *fctn,char *value)
{
  if (!strcmp(fctn,"LabelSetString"))
  {
    Arg args[10];
    XtSetArg(args[0],XmNlabelString,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
    XtSetValues(w,args,1);
  }
  else if (!strcmp(fctn,"LabelGetString"))
  {
    Arg args[10];
    char *str; 
    XtSetArg(args[0],XmNlabelString,&value);
    XtSetValues(w,args,1);
    return NULL;
  }
  else
  {
    printf("Unknown Fonction %s\n",fctn);
  }
  return "";
}
char *FmActions(Widget w,char *fctn,char *value)
{
  if (!strcmp(fctn,"TextSetString"))
  {   
    XmTextSetString(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
  }
  else if (!strcmp(fctn,"TextSetMaxLength"))
  {   
    XmTextSetMaxLength(w,atoi(value));
  }
  else if (!strcmp(fctn,"TextSetEditable"))
  {   
    XmTextSetEditable(w,atoi(value));
  }
  else if (!strcmp(fctn,"TextGetString"))
  {   
    return XmTextGetString(w);
  }
  else
  {
    printf("Unknown Fonction %s\n",fctn);
  }
  return "";
}

char *ListActions(Widget w,char *fctn,char *value)
{
      if (!strcmp(fctn,"ListAddItem"))
      {   
        XmListAddItemUnselected(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET),0);
      }
      else if (!strcmp(fctn,"ListDelItem"))
      {   
        XmListDeleteItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
      }
      else if (!strcmp(fctn,"ListDelItemPos"))
      {   
        XmListDeleteItemsPos(w,1,atoi(value));
      }
      else if (!strcmp(fctn,"ListDelAllItems"))
      {   
        XmListDeleteAllItems(w);
      }
      else if (!strcmp(fctn,"ListSelItem"))
      {   
        XmListSelectItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET),0);
      }
      else if (!strcmp(fctn,"ListSelPos"))
      {   
        XmListSelectPos(w,atoi(value),0);
      }
      else if (!strcmp(fctn,"ListDesAll"))
      {   
        XmListDeselectAllItems(w);
      }
      else if (!strcmp(fctn,"ListDesItem"))
      {   
        XmListDeselectItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
      }
      else if (!strcmp(fctn,"ListDesPos"))
      {   
        XmListDeselectPos(w,atoi(value));
      }
      else if (!strcmp(fctn,"ListAddMode"))
      {
        XmListSetAddMode(w,atoi(value));
      }
      else if (!strcmp(fctn,"ListHorizPos"))
      {
        XmListSetHorizPos(w,atoi(value));
      }
      else if (!strcmp(fctn,"ListBottomItem"))
      {
        XmListSetBottomItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
      }
      else if (!strcmp(fctn,"ListBottomPos"))
      {
        XmListSetBottomPos(w,atoi(value));
      }
      else if (!strcmp(fctn,"ListSetItem"))
      {
        XmListSetItem(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
      }
      else if (!strcmp(fctn,"ListSetPos"))
      {
        XmListSetItem(w,atoi(value));
      }
      else if (!strcmp(fctn,"ListItemExists"))
      {
        char *res=malloc(3);
        if (XmListItemExists(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET)))
           strcpy(res,"1");
        else
           strcpy(res,"0");
        return res;
      }
      else if (!strcmp(fctn,"ListItemPos"))
      {
        char *res=malloc(10);
        int pos=XmListItemPos(w,XmStringCreate(value,XmSTRING_DEFAULT_CHARSET));
        sprintf(res,"%d",pos);
        return res;
      }
      else
      {
        printf("Unknown Fonction %s\n",fctn);
      }
  return "";
}

char *XMStringImage(XmStringTable str)
{
  return FmGetString(*str);
}

char *CreateActions(int lf,char *field,char *value)
{
  Widget w;
  if (!strcmp(field,"FrameG"))
  {
    w = FmCreateFrameG ("FrameG", get_local_frame_widget(atoi(value)), NULL, 0);
    set_local_frame_widget(lf,w);
    printf("CREATE FrameG: lf:%d parent_widget:%d child_widget:%d\n",
                lf,get_local_frame_widget(atoi(value)),w);
  }
  else printf("Event.Action.Create: %s not Found\n",field); 
  return "";
}

char *UserActions(int lf,char *fctn,char *field,char *value)
{
  return "";
}


char *InitActions(int lf,char *field,char *value)
{
    Widget w;
    w = FmInitialize (field, field, NULL, 0, NULL, 0);
    printf("INITIALIZE: lf:%d w:%d\n",lf,w);
    set_local_frame_widget(lf,w);
    return "";
}

char *action(int lf,char *fctn,char *field,char *value)
{
  Widget w;

 /* printf("ACTION: lf:%d fctn:%s field:%s value:%s\n",lf,fctn,field,value);
*/
  if (!strncmp(fctn,"Init",4))
  {
    return adastr(InitActions(lf,field,value));
  }
  else if (!strncmp(fctn,"Create",6))
  {
    return adastr(CreateActions(lf,field,value)); 
  }
  else if ((w=XtNameToWidget(get_local_frame_widget(lf),field))!=NULL)
  {
    if (!strncmp(fctn,"Fm",2))
    {
      return adastr(FmActions(w,fctn ,value));
    }
    else if (!strncmp(fctn,"List",4))
    {
      return adastr(ListActions(w,fctn ,value));
    }
    else if (!strncmp(fctn,"Menu",4))
    {
      return adastr(MenuActions(w,fctn ,value));
    }
    else if (!strncmp(fctn,"Text",4))
    {
      return adastr(TextActions(w,fctn ,value));
    }
    else if (!strncmp(fctn,"Label",5))
    {
      return adastr(LabelActions(w,fctn ,value));
    }
    else if (!strncmp(fctn,"User",4))
    {
      return adastr(UserActions(w,fctn ,field,value));
    }
    else printf("Event : Function not implemented : %s\n",fctn);
  }
  else printf("Event : Widget not found : %s from local frame %d\n",field,lf);
  return adastr("");
}