コード例 #1
0
ファイル: modconf.c プロジェクト: ThomasAdam/fvwm-cvs
/*
 * ModuleConfig handles commands starting with "*".
 *
 * Each command is added to a list from which modules  request playback
 * thru "sendconfig".
 *
 * Some modules request that module config commands be sent to them
 * as the commands are entered.  Send to modules that want it.
 */
void ModuleConfig(char *action)
{
	int end;
	fmodule_list_itr moditr;
	fmodule *module;
	struct moduleInfoList *new_entry;

	end = strlen(action) - 1;
	if (action[end] == '\n')
		action[end] = '\0';
	/* save for config request */
	new_entry = AddToModList(action);
	/* look at all possible pipes */
	module_list_itr_init(&moditr);
	while ( (module = module_list_itr_next(&moditr)) != NULL)
	{
		if (IS_MESSAGE_SELECTED(module, M_SENDCONFIG))
		{
			/* module wants config cmds */
			char *name = MOD_NAME(module);
			if (MOD_ALIAS(module))
			{
				name = MOD_ALIAS(module);
			}
			SendConfigToModule(
				module, new_entry, CatString2("*", name), 0);
		}
	}

	return;
}
コード例 #2
0
static void SavedPass1( mod_entry *mod )
/**************************************/
{
    ObjFormat = FMT_INCREMENTAL;
    mod->modinfo &= ~FMT_OBJ_FMT_MASK;
    mod->modinfo |= FMT_INCREMENTAL;
    AddToModList( mod );
    ObjPass1();
}
コード例 #3
0
ファイル: module.c プロジェクト: rn10950/FVWM95-Updated
void HandleModuleInput(Window w, int channel)
{
  char text[256];
  int size;
  int cont, n;

  /* Already read a (possibly NULL) window id from the pipe,
   * Now read an fvwm bultin command line */
  n = read(readPipes[channel], &size, sizeof(size));
  if (n < sizeof(size)) {
    KillModule(channel, 1);
    return;
  }

  if (size > 255) {
    fvwm_msg(ERR, "HandleModuleInput",
	     "Module command is too big (%d)", (void *) size);
    size = 255;
  }

  pipeOn[channel] = 1;

  n = read(readPipes[channel], text, size);
  if (n < size) {
    KillModule(channel, 2);
    return;
  }

  text[n] = 0;
  n = read(readPipes[channel], &cont, sizeof(cont));
  if (n < sizeof(cont)) {
    KillModule(channel, 3);
    return;
  }
  if (cont == 0) {
    KillModule(channel, 4);
  }
  if (strlen(text) > 0) {
    extern int Context;
    FvwmWindow *tmp_win;

    /* first, check to see if module config line */
    if (text[0] == '*') {
      AddToModList(text);
      return;
    }

    /* perhaps the module would like us to kill it? */
    if (strncasecmp(text, "KillMe", 6) == 0) {
      KillModule(channel, 12);
      return;
    }


    /*Event.xany.type = ButtonRelease; hmmm... */
    /* If a module does XUngrabPointer(), it can now get proper Popups */
    if (strncasecmp(text, "popup", 5) == 0)
      Event.xany.type = ButtonPress;
    else
      Event.xany.type = ButtonRelease;
    Event.xany.window = w;

    if ((w == None) ||
        (XFindContext(dpy, w, FvwmContext, (caddr_t *) &tmp_win) == XCNOENT)) {
      tmp_win = NULL;
      w = None;
    }
    if (tmp_win) {
      Event.xbutton.button = 1;
      Event.xbutton.x_root = tmp_win->frame_x;
      Event.xbutton.y_root = tmp_win->frame_y;
      Event.xbutton.x = 0;
      Event.xbutton.y = 0;
      Event.xbutton.subwindow = None;
    } else {
      Event.xbutton.button = 1;
      Event.xbutton.x_root = 0;
      Event.xbutton.y_root = 0;
      Event.xbutton.x = 0;
      Event.xbutton.y = 0;
      Event.xbutton.subwindow = None;
    }
    Context = GetContext(tmp_win, &Event, &w);
    ExecuteFunction(text, tmp_win, &Event, Context, channel);
    SendPacket(channel, M_FUNCTION_END, 1, 0, 0, 0, 0, 0, 0, 0);
  }
  return;
}
コード例 #4
0
static void DoPass1( mod_entry *next, file_list *list )
/*****************************************************/
/* do pass 1 on the object file */
{
    member_list         *member;
    char                *membname;
    unsigned long       loc;
    unsigned long       size;
    unsigned            reclength;
    bool                lastmod;
    bool                ignoreobj;

    loc = 0;
    lastmod = FALSE;
    if( CacheOpen( list ) ) {
        reclength = CheckLibraryType( list, &loc, FALSE );
        for( ;; ) { /*  there may be more than 1 object module in a file */
            member = NULL;
            ignoreobj = FALSE;
            if( EndOfLib( list, loc ) )
                break;
            membname = IdentifyObject( list, &loc, &size );
            if( list->status & STAT_IS_LIB ) {
                if( (list->status & STAT_HAS_MEMBER) && list->u.member != NULL ) {
                    member = FindMember( list, membname );
                    if( member == NULL ) {
                        ignoreobj = TRUE;
                    } else if( list->u.member == NULL ) {
                        lastmod = TRUE;
                    }
                }
            }
            if( ignoreobj ) {
                _LnkFree( membname );
                if( size != 0 ) {
                    loc += size;
                } else {
                    SkipFile( list, &loc );
                }
            } else {
                if( next == NULL ) {
                    next = NewModEntry();
                }
                next->n.next_mod = NULL;
                next->f.source = list;
                next->modtime = next->f.source->file->modtime;
                next->modinfo |= ObjFormat & FMT_OBJ_FMT_MASK;
                if( member != NULL ) {
                    next->modinfo |= member->flags;
                    _LnkFree( member );
                }
                if( !(list->status & STAT_HAS_MEMBER) ) {
                    next->modinfo |= list->status & DBI_MASK;
                    if( list->status & STAT_LAST_SEG ) {
                        next->modinfo |= MOD_LAST_SEG;
                    }
                }
                AddToModList( next );
                next->location = loc;
                if( membname == NULL ) {
                    membname = ChkStrDup( list->file->name );
                }
                next->name = membname;
                loc = ObjPass1();
                if( list->status & STAT_TRACE_SYMS ) {
                    TraceSymList( CurrMod->publist );
                }
                next = NULL;
            }
            ObjFormat = 0;
            if( list->status & STAT_IS_LIB ) {             // skip padding.
                loc += CalcAlign( loc, reclength );
            } else if( !IS_FMT_OMF( CurrMod->modinfo ) ) {
                break;          // can only concat omf.
            }
            if( lastmod || CacheEnd( list, loc ) ) {
                break;
            }
        }
        if( list->u.member != NULL ) {
            LnkMsg( ERR+MSG_CANT_FIND_MEMBER, "12", list->file->name,
                                                    list->u.member->name );
        }
        CacheClose( list, 1 );
    }
    CheckStop();
}