DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦d222c1b68⟧ TextFile

    Length: 2319 (0x90f)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦c76a5d29a⟧ 
            └─⟦this⟧ 

TextFile

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

#define MAX_LOCAL_FRAME 100
#define NO_FREE_FRAME   0
#define INVALID_WIDGET  0

struct rec_local_frame {
     Widget w;
     int busy;
     char *name;
     } local_frames[MAX_LOCAL_FRAME];

void print_frame()
{
 int i;

 for (i=0; i<MAX_LOCAL_FRAME; i++)
  if (local_frames[i].busy)
     printf("frame[%d]: %d, %s \n",i,local_frames[i].w,local_frames[i].name);
}

int widget_to_lf(Widget w)
{
  int i;
  for(i=1;i<MAX_LOCAL_FRAME;i++)
    if (local_frames[i].busy)
      if (local_frames[i].w==w) return i;
  return INVALID_WIDGET;
}

void init_local_frames()
{
  int i;
  for (i=1;i<MAX_LOCAL_FRAME;i++)
    local_frames[i].busy=FALSE;
}

Widget get_local_frame_widget(int lf)
{
  return local_frames[lf].w;
}

int get_local_frame_id(char *name)
{
  int i;
  for (i=1;i<MAX_LOCAL_FRAME;i++)
    if (!local_frames[i].busy)
    {
      local_frames[i].busy=TRUE;
      local_frames[i].name=malloc(strlen(name)+1);
      strcpy(local_frames[i].name,name);
      return i;
    }
  return NO_FREE_FRAME;
}

int get_local_frame_id_with_name(char *name,int main_lf,char *path)
{
  int i;
  Widget w_main,w_child;
  for (i=1;i<MAX_LOCAL_FRAME;i++)
    if (!local_frames[i].busy)
    {                                 
      w_main=get_local_frame_widget(main_lf);
      if (w_main==NULL)
      {
        printf("get_local_frame_id_with_name: cannot get Widget for main_localframe %d\n",main_lf);
        return NO_FREE_FRAME;
      }
      else
      {
        w_child=XtNameToWidget(w_main,path);
        if (w_child==NULL)
        {
          printf("get_local_frame_id_with_name: cannot get Widget for path %s\n",path);
          return NO_FREE_FRAME;
        }
        else
        {
          local_frames[i].busy=TRUE;
          local_frames[i].w=w_child;
          local_frames[i].name=malloc(strlen(name)+1);
          strcpy(local_frames[i].name,name);
          return i;     
        }                           
      }
    }
  return NO_FREE_FRAME;
}

char *get_local_frame_name(int lf)
{
  if (local_frames[lf].busy) return adastr(local_frames[lf].name);
     else return adastr((char *) NULL);
}

void free_local_frame(int lf)
{
  free(local_frames[lf].name);
  local_frames[lf].busy=FALSE;
}

void set_local_frame_widget(int lf, Widget w)
{
  local_frames[lf].w = w;
}