예제 #1
0
  struct qt_t *
qt_vargs (struct qt_t *qsp, int nbytes, struct va_list *vargs,
	  void *pt, qt_function_t *startup,
	  qt_function_t *vuserf, qt_function_t *cleanup)
{
  va_list ap;
  int i;
  int max;		/* Maximum *words* of args to copy. */
  int tmove;		/* *Words* of args moved typed->typed. */
  qt_word_t *sp;

  ap = *(va_list *)vargs;
  qsp = QT_VARGS_MD0 (qsp, nbytes);
  sp = (qt_word_t *)qsp;

  tmove = 6 - ap._offset/sizeof(qt_word_t);

  /* Copy from one typed area to the other. */
  for (i=0; i<tmove; ++i) {
    /* Integer args: */
    sp[i+6] = ((qt_word_t *)(ap._a0 + ap._offset))[i];
    /* Fp args: */
    sp[i] = ((qt_word_t *)(ap._a0 + ap._offset))[i-6];
  }

  max = nbytes/sizeof(qt_word_t);

  /* Copy from the untyped area to the typed area.  Split each arg.
     in to integer and floating-point save areas. */
  for (; i<6 && i<max; ++i) {
    sp[i] = sp[i+6] = ((qt_word_t *)(ap._a0 + ap._offset))[i];
  }

  /* Copy from the untyped area to the other untyped area. */
  for (; i<max; ++i) {
    sp[i+6] = ((qt_word_t *)(ap._a0 + ap._offset))[i];
  }

  QT_VARGS_MD1 (QT_VADJ(sp));
  QT_SPUT (QT_VADJ(sp), QT_VARGT_INDEX, pt);
  QT_SPUT (QT_VADJ(sp), QT_VSTARTUP_INDEX, startup);
  QT_SPUT (QT_VADJ(sp), QT_VUSERF_INDEX, vuserf);
  QT_SPUT (QT_VADJ(sp), QT_VCLEANUP_INDEX, cleanup);
  return ((qt_t *)QT_VADJ(sp));
}
예제 #2
0
  qt_t *
qt_vargs (qt_t *sp, int nbytes, void *vargs,
	  void *pt, qt_startup_t *startup,
	  qt_vuserf_t *vuserf, qt_cleanup_t *cleanup)
{
  int i;

  sp = QT_VARGS_MD0 (sp, nbytes);
#ifdef QT_GROW_UP
    for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
      QT_SPUT (QT_VARGS_ADJUST(sp), i, ((qt_word_t *)vargs)[-i]);
    }
#else
    for (i=nbytes/sizeof(qt_word_t); i>0; --i) {
      QT_SPUT (QT_VARGS_ADJUST(sp), i-1, ((qt_word_t *)vargs)[i-1]);
    }
#endif

  QT_VARGS_MD1 (QT_VADJ(sp));
  QT_SPUT (QT_VADJ(sp), QT_VARGT_INDEX, pt);
  QT_SPUT (QT_VADJ(sp), QT_VSTARTUP_INDEX, startup);
  QT_SPUT (QT_VADJ(sp), QT_VUSERF_INDEX, vuserf);
  QT_SPUT (QT_VADJ(sp), QT_VCLEANUP_INDEX, cleanup);
  return ((qt_t *)QT_VADJ(sp));
}