Пример #1
0
int CheckLcmType(const lcmtest::multidim_array_t* msg, int expected) {
  CHECK_FIELD(msg->size_a, expected, "%d");
  CHECK_FIELD(msg->size_b, expected, "%d");
  CHECK_FIELD(msg->size_c, expected, "%d");

  int i, j, k;
  int n = 0;
  // data
  for (i = 0; i < msg->size_a; i++) {
    for (j = 0; j < msg->size_b; j++) {
      for (k = 0; k < msg->size_c; k++) {
        CHECK_FIELD(msg->data[i][j][k], n, "%d");
        n++;
      }
    }
  }

  // strarray
  char expected_buf[80];
  n = 0;
  for (i = 0; i < 2; i++) {
    for (k = 0; k < msg->size_c; k++) {
      snprintf(expected_buf, 79, "%d", n);
      if (strcmp(expected_buf, msg->strarray[i][k].c_str())) {
        info("Expected msg->strarray[%d][%d] to be %s, got %s instead", i, k,
             expected_buf, msg->strarray[i][k].c_str());
        return 0;
      }
      n++;
    }
  }

  return 1;
}
Пример #2
0
void onvif_set_UpgradeSystemFirmware_request(struct soap* soap, struct _tds__UpgradeSystemFirmware * req){
	unsigned char* data;
	size_t size = 0;

	printf("enter %s\n", __FUNCTION__);

	memset(req, 0, sizeof(*req));
	CHECK_FIELD(req->Firmware);


	data = load_file_data("1.bin", &size);
	if (data == NULL) {
		printf("empty file\n");
		return;
	}

	printf("file size:%d\n", size);

	soap_set_field_string(soap, &req->Firmware->xmime__contentType, "binary");

	req->Firmware->xop__Include.__size = min(64*1024,size);
	req->Firmware->xop__Include.__ptr = (unsigned char*) data;
	soap_set_field_string(soap, &req->Firmware->xop__Include.id, "id");
	soap_set_field_string(soap, &req->Firmware->xop__Include.options, "option");
	soap_set_field_string(soap, &req->Firmware->xop__Include.type, "text/html");

	free(data);
}
	bool TMetaProtoSerial::operator() (NPb::Message& m, int protoField) {
        CHECK_FIELD();
        // L_DEBUG << "Serial process of message " << m.GetTypeName() << " as " << protoField << " field number in " << Message.GetTypeName();
        auto* fd = GetFieldDescr(protoField);
        switch (Mode) {
            case ESerialMode::IN:
            {
                if (fd->is_repeated()) {
                    auto* rfPtr = Refl->MutableRepeatedPtrField<NPb::Message>(&Message, fd);
                    m.CopyFrom(rfPtr->Get(0));
                } else {
                    m.CopyFrom(Refl->GetMessage(Message, fd));
                }
            }
            break;
            case ESerialMode::OUT:
            {
                NPb::Message* messageField;
                if (fd->is_repeated()) {
                	auto* rfPtr = Refl->MutableRepeatedPtrField<NPb::Message>(&Message, fd);
                    messageField = rfPtr->Mutable(0);
                } else {
                    messageField = Refl->MutableMessage(&Message, fd);
                }
                ENSURE(messageField->GetTypeName() == m.GetTypeName(), "Message types are not equal, expecting " << m.GetTypeName() << " at " << protoField << " field number, got " << messageField->GetTypeName());
                messageField->CopyFrom(m);
            }
            break;
        }
        return true;
    }
Пример #4
0
    bool TProtoSerial::operator() (TMatrixD& m, int protoField) {
        CHECK_FIELD();

        switch (Mode) {
            case ESerialMode::IN:
            {
                const NGroundProto::TMatrixD* mat = GetEmbedMessage<NGroundProto::TMatrixD>(protoField);
                m = TMatrixD(mat->n_rows(), mat->n_cols());
                for (size_t rowIdx=0; rowIdx < m.n_rows; ++rowIdx) {
                    const NGroundProto::TVectorD& row = mat->row(rowIdx);
                    for (size_t colIdx=0; colIdx < m.n_cols; ++colIdx) {
                        m(rowIdx, colIdx) = row.x(colIdx);
                    }
                }
            }
            break;
            case ESerialMode::OUT:
            {
                NGroundProto::TMatrixD* mat = GetEmbedMutMessage<NGroundProto::TMatrixD>(protoField);
                mat->set_n_rows(m.n_rows);
                mat->set_n_cols(m.n_cols);
                for (size_t rowIdx=0; rowIdx < m.n_rows; ++rowIdx) {
                    NGroundProto::TVectorD* row = mat->add_row();
                    for (size_t colIdx=0; colIdx < m.n_cols; ++colIdx) {
                        row->add_x(m(rowIdx, colIdx));
                    }
                }
            }
            break;
        }
        return true;
    }
Пример #5
0
    bool TProtoSerial::operator() (NPb::Message& m, int protoField) {
        CHECK_FIELD();

        // L_DEBUG << "Serial process of message " << m.GetTypeName() << " as " << protoField << " field number in " << Message.GetTypeName();
        auto* fd = GetFieldDescr(protoField);
        switch (Mode) {
            case ESerialMode::IN:
            {
                if (fd->is_repeated()) {
                    auto* rfPtr = Refl->MutableRepeatedPtrField<NPb::Message>(&Message, fd);
                    m.CopyFrom(rfPtr->Get(0));
                    rfPtr->DeleteSubrange(0, 1);
                } else {
                    m.CopyFrom(Refl->GetMessage(Message, fd));
                }
            }
            break;
            case ESerialMode::OUT:
            {
                NPb::Message* messageField;
                if (fd->is_repeated()) {
                    messageField = Refl->AddMessage(&Message, fd);
                } else {
                    messageField = Refl->MutableMessage(&Message, fd);
                }
                messageField->CopyFrom(m);
            }
            break;
        }
        return true;
    }
Пример #6
0
    bool TProtoSerial::operator() (TVector<double>& v, int protoField) {
        CHECK_FIELD();

        TVectorD laVec = NLa::StdToVec(v);
        (*this)(laVec, protoField);
        v = NLa::VecToStd(laVec);
        return true;
    }
Пример #7
0
static bool
virSysinfoSystemIsEqual(virSysinfoSystemDefPtr src,
                        virSysinfoSystemDefPtr dst)
{
    bool identical = false;

    if (!src && !dst)
        return true;

    if ((src && !dst) || (!src && dst)) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                       _("Target sysinfo does not match source"));
        goto cleanup;
    }

    CHECK_FIELD(manufacturer, "system vendor");
    CHECK_FIELD(product, "system product");
    CHECK_FIELD(version, "system version");
    CHECK_FIELD(serial, "system serial");
    CHECK_FIELD(uuid, "system uuid");
    CHECK_FIELD(sku, "system sku");
    CHECK_FIELD(family, "system family");

    identical = true;
 cleanup:
    return identical;
}
Пример #8
0
static bool
virSysinfoBaseBoardIsEqual(virSysinfoBaseBoardDefPtr src,
                           virSysinfoBaseBoardDefPtr dst)
{
    bool identical = false;

    if (!src && !dst)
        return true;

    if ((src && !dst) || (!src && dst)) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                       _("Target base board does not match source"));
        goto cleanup;
    }

    CHECK_FIELD(manufacturer, "base board vendor");
    CHECK_FIELD(product, "base board product");
    CHECK_FIELD(version, "base board version");
    CHECK_FIELD(serial, "base board serial");
    CHECK_FIELD(asset, "base board asset");
    CHECK_FIELD(location, "base board location");

    identical = true;
 cleanup:
    return identical;
}
Пример #9
0
int CheckLcmType(const lcmtest::node_t* msg, int expected) {
  CHECK_FIELD(msg->num_children, expected, "%d");
  if (!msg->num_children)
    return 1;

  int i;
  for (i = 0; i < msg->num_children; i++) {
    const lcmtest::node_t* child = &msg->children[i];
    if (!CheckLcmType(child, msg->num_children - 1))
      return 0;
  }
  return 1;
}
Пример #10
0
    bool TProtoSerial::operator() (IMetaProtoSerial& v, int protoField, bool newMessage) {
        CHECK_FIELD();

        NPb::Message* message = GetEmbedMutMessage<NPb::Message>(protoField, newMessage);
        TMetaProtoSerial serial(*message, protoField, Mode);
        v.SerialProcess(serial);
        if (newMessage && IsInput()) {
            auto* fd = GetFieldDescr(protoField);
            ENSURE(fd->is_repeated(), "New message on non repeated field");
            auto* rfPtr = Refl->MutableRepeatedPtrField<NPb::Message>(&Message, fd);
            rfPtr->DeleteSubrange(0, 1);
        }
        return true;
    }
Пример #11
0
static bool
virSysinfoBIOSIsEqual(virSysinfoBIOSDefPtr src,
                      virSysinfoBIOSDefPtr dst)
{
    bool identical = false;

    if (!src && !dst)
        return true;

    if ((src && !dst) || (!src && dst)) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                       _("Target sysinfo does not match source"));
        goto cleanup;
    }

    CHECK_FIELD(vendor, "BIOS vendor");
    CHECK_FIELD(version, "BIOS version");
    CHECK_FIELD(date, "BIOS date");
    CHECK_FIELD(release, "BIOS release");

    identical = true;
 cleanup:
    return identical;
}
Пример #12
0
 bool TProtoSerial::operator() (TString& v, int protoField) {
     CHECK_FIELD();
     switch (Mode) {
         case ESerialMode::IN:
         {
             v = Refl->GetString(Message, GetFieldDescr(protoField));
         }
         break;
         case ESerialMode::OUT:
         {
             Refl->SetString(&Message, GetFieldDescr(protoField), v);
         }
         break;
     }
     return true;
 }
Пример #13
0
    bool TProtoSerial::SerialRepeated(TString& v, int idx, int protoField) {
        CHECK_FIELD();

        auto* fd = GetFieldDescr(protoField);
        switch (Mode) {
            case ESerialMode::IN:
            {
                v = Refl->GetRepeatedString(Message, fd, idx);
            }
            break;
            case ESerialMode::OUT:
            {
                Refl->AddString(&Message, fd, v);
            }
            break;
        }
        return true;
    }
Пример #14
0
    bool TProtoSerial::SerialRepeated(NPb::Message& m, int idx, int protoField) {
        CHECK_FIELD();

        switch (Mode) {
            case ESerialMode::IN:
            {
                const auto& messageField = Refl->GetRepeatedMessage(Message, GetFieldDescr(protoField), idx);
                m.CopyFrom(messageField);
            }
            break;
            case ESerialMode::OUT:
            {
                NPb::Message* messageField = Refl->AddMessage(&Message, GetFieldDescr(protoField));
                messageField->CopyFrom(m);
            }
            break;
        }
        return true;
    }
Пример #15
0
    bool TProtoSerial::SerialRepeated(TComplex& v, int idx, int protoField) {
        CHECK_FIELD();

        switch (Mode) {
            case ESerialMode::IN:
            {
                const auto& messageField = Refl->GetRepeatedMessage(Message, GetFieldDescr(protoField), idx);
                const NGroundProto::TComplex& cpx = dynamic_cast<const NGroundProto::TComplex&>(messageField);
                v = TComplex(cpx.real(), cpx.imag());
            }
            break;
            case ESerialMode::OUT:
            {
                NPb::Message* messageField = Refl->AddMessage(&Message, GetFieldDescr(protoField));
                NGroundProto::TComplex* cpx = dynamic_cast<NGroundProto::TComplex*>(messageField);
                cpx->set_real(v.real());
                cpx->set_imag(v.imag());
            }
            break;
        }
        return true;
    }
Пример #16
0
    bool TProtoSerial::operator() (TVectorD& v, int protoField) {
        CHECK_FIELD();

        switch (Mode) {
            case ESerialMode::IN:
            {
                const NGroundProto::TVectorD* vecProto = GetEmbedMessage<NGroundProto::TVectorD>(protoField);
                v = TVectorD(vecProto->x_size());
                for (size_t vecIdx=0; vecIdx < v.size(); ++vecIdx) {
                    v(vecIdx) = vecProto->x(vecIdx);
                }
            }
            break;
            case ESerialMode::OUT:
            {
                NGroundProto::TVectorD* vecProto = GetEmbedMutMessage<NGroundProto::TVectorD>(protoField);
                for (const auto& val: v) {
                    vecProto->add_x(val);
                }
            }
            break;
        }
        return true;
    }
Пример #17
0
	MatchQuality MatchesStyle(const PGFFontStyle &style, bool optimum) const {
		// If no field matches, it doesn't match.
		MatchQuality match = MATCH_NONE;

#define CHECK_FIELD(f, m) \
		if (style.f != 0) { \
			if (style.f != style_.f) { \
				return MATCH_NONE; \
			} \
			if (match < m) { \
				match = m; \
			} \
		}
#define CHECK_FIELD_STR(f, m) \
		if (style.f[0] != '\0') { \
			if (strcmp(style.f, style_.f) != 0) { \
				return MATCH_NONE; \
			} \
			if (match < m) { \
				match = m; \
			} \
		}

		// H and V take the first match, most other fields take the last match.
		CHECK_FIELD(fontH, MATCH_PERFECT);
		CHECK_FIELD(fontV, MATCH_PERFECT);

		CHECK_FIELD(fontFamily, MATCH_GOOD);
		CHECK_FIELD(fontStyle, MATCH_GOOD);
		CHECK_FIELD(fontLanguage, MATCH_GOOD);
		CHECK_FIELD(fontCountry, MATCH_GOOD);

		CHECK_FIELD_STR(fontName, MATCH_GOOD);
		CHECK_FIELD_STR(fontFileName, MATCH_GOOD);

#undef CHECK_FIELD_STR
#undef CHECK_FIELD
		return match;
	}
Пример #18
0
bool virSysinfoIsEqual(virSysinfoDefPtr src,
                       virSysinfoDefPtr dst)
{
    bool identical = false;

    if (!src && !dst)
        return true;

    if ((src && !dst) || (!src && dst)) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                       _("Target sysinfo does not match source"));
        goto cleanup;
    }

    if (src->type != dst->type) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                       _("Target sysinfo %s does not match source %s"),
                       virSysinfoTypeToString(dst->type),
                       virSysinfoTypeToString(src->type));
        goto cleanup;
    }

#define CHECK_FIELD(name, desc)                                         \
    do {                                                                \
        if (STRNEQ_NULLABLE(src->name, dst->name)) {                    \
            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,                  \
                           _("Target sysinfo %s %s does not match source %s"), \
                           desc, NULLSTR(src->name), NULLSTR(dst->name)); \
        }                                                               \
    } while (0)

    CHECK_FIELD(bios_vendor, "BIOS vendor");
    CHECK_FIELD(bios_version, "BIOS version");
    CHECK_FIELD(bios_date, "BIOS date");
    CHECK_FIELD(bios_release, "BIOS release");

    CHECK_FIELD(system_manufacturer, "system vendor");
    CHECK_FIELD(system_product, "system product");
    CHECK_FIELD(system_version, "system version");
    CHECK_FIELD(system_serial, "system serial");
    CHECK_FIELD(system_uuid, "system uuid");
    CHECK_FIELD(system_sku, "system sku");
    CHECK_FIELD(system_family, "system family");

#undef CHECK_FIELD

    identical = true;

cleanup:
    return identical;
}
Пример #19
0
int CheckLcmType(const lcmtest2::another_type_t* msg, int expected) {
    int n = expected;
    CHECK_FIELD(msg->val, n, "%d");
    return 1;
}
Пример #20
0
int CheckLcmType(const lcmtest::primitives_t* msg, int expected) {
  int n = expected;
  CHECK_FIELD(msg->i8, n % 100, "%d");
  CHECK_FIELD(msg->i16, n * 10, "%d");
  CHECK_FIELD(msg->i64, (int64_t )(n * 10000), "%jd");
  CHECK_FIELD(msg->position[0], (double )n, "%f");
  CHECK_FIELD(msg->position[1], (double )n, "%f");
  CHECK_FIELD(msg->position[2], (double )n, "%f");
  CHECK_FIELD(msg->orientation[0], (double )n, "%f");
  CHECK_FIELD(msg->orientation[1], (double )n, "%f");
  CHECK_FIELD(msg->orientation[2], (double )n, "%f");
  CHECK_FIELD(msg->orientation[3], (double )n, "%f");
  CHECK_FIELD(msg->num_ranges, n, "%d");
  int i;
  for (i = 0; i < n; i++)
    CHECK_FIELD(msg->ranges[i], i, "%d");
  char expected_name[100];
  sprintf(expected_name, "%d", n);
  if (strcmp(expected_name, msg->name.c_str())) {
    info("Expected msg->expected_name to be %s, got %s instead",
         expected_name, msg->name.c_str());
    return 0;
  }
  CHECK_FIELD(msg->enabled, (int )(n % 2), "%d");
  return 1;
}
Пример #21
0
void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
{
  ME_DisplayItem *para, *para_end;
  PARAFORMAT2 *curFmt;

  if (pFmt->cbSize < sizeof(PARAFORMAT)) {
    pFmt->dwMask = 0;
    return;
  }

  ME_GetSelectionParas(editor, &para, &para_end);

  ME_GetParaFormat(editor, para, pFmt);

  /* Invalidate values that change across the selected paragraphs. */
  while (para != para_end)
  {
    para = para->member.para.next_para;
    curFmt = para->member.para.pFmt;

#define CHECK_FIELD(m, f) \
    if (pFmt->f != curFmt->f) pFmt->dwMask &= ~(m);

    CHECK_FIELD(PFM_NUMBERING, wNumbering);
    CHECK_FIELD(PFM_STARTINDENT, dxStartIndent);
    CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent);
    CHECK_FIELD(PFM_OFFSET, dxOffset);
    CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
    if (pFmt->dwMask & PFM_TABSTOPS) {
      if (pFmt->cTabCount != para->member.para.pFmt->cTabCount ||
          memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int)))
        pFmt->dwMask &= ~PFM_TABSTOPS;
    }

    if (pFmt->dwMask >= sizeof(PARAFORMAT2))
    {
      pFmt->dwMask &= ~((pFmt->wEffects ^ curFmt->wEffects) << 16);
      CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
      CHECK_FIELD(PFM_SPACEAFTER, dySpaceAfter);
      CHECK_FIELD(PFM_LINESPACING, dyLineSpacing);
      CHECK_FIELD(PFM_STYLE, sStyle);
      CHECK_FIELD(PFM_SPACEAFTER, bLineSpacingRule);
      CHECK_FIELD(PFM_SHADING, wShadingWeight);
      CHECK_FIELD(PFM_SHADING, wShadingStyle);
      CHECK_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
      CHECK_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
      CHECK_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
      CHECK_FIELD(PFM_BORDER, wBorderSpace);
      CHECK_FIELD(PFM_BORDER, wBorderWidth);
      CHECK_FIELD(PFM_BORDER, wBorders);
    }
#undef CHECK_FIELD
  }
}
Пример #22
0
int CheckLcmType(const lcmtest::primitives_list_t* msg, int expected)
{
    CHECK_FIELD(msg->num_items, expected, "%d");
    for(int n=0; n<expected; n++)
    {
        const lcmtest::primitives_t* ex = &msg->items[n];
        CHECK_FIELD(ex->i8, -(n % 100), "%d");
        CHECK_FIELD(ex->i16, -n * 10, "%d");
        CHECK_FIELD(ex->i64, (int64_t)(-n * 10000), "%jd");
        CHECK_FIELD(ex->position[0], (double)-n, "%f");
        CHECK_FIELD(ex->position[1], (double)-n, "%f");
        CHECK_FIELD(ex->position[2], (double)-n, "%f");
        CHECK_FIELD(ex->orientation[0], (double)-n, "%f");
        CHECK_FIELD(ex->orientation[1], (double)-n, "%f");
        CHECK_FIELD(ex->orientation[2], (double)-n, "%f");
        CHECK_FIELD(ex->orientation[3], (double)-n, "%f");
        CHECK_FIELD(ex->num_ranges, n, "%d");
        int i;
        for(i=0; i<n; i++)
            CHECK_FIELD(ex->ranges[i], -i, "%d");
        char expected_name[100];
        sprintf(expected_name, "%d", -n);
        if(strcmp(expected_name, ex->name.c_str())) {
            info("Expected msg->items[%d].name to be %s, got %s instead", n, expected_name, ex->name.c_str());
            return 0;
        }
        CHECK_FIELD(ex->enabled, (int)((n+1)%2), "%d");
    }
    return 1;
}
Пример #23
0
int
main ()
{
  if (sizeof (struct S1)		!=  4)
    return 1;
  if (alignof (struct S1)		!=  4)
    return 2;
  CHECK_FIELD (S1, j,  0,  5,  3);
  CHECK_FIELD (S1, k,  5,  6,  4);
  CHECK_FIELD (S1, m, 11,  7,  5);

#ifdef HAVE_IA64_TYPES
  if (sizeof (struct S2)		!= 16)
    return 6;
  if (alignof (struct S2)		!=  8)
    return 7;
  CHECK_FIELD (S2, s,  0,  9,  8);
  CHECK_FIELD (S2, j,  9,  9,  9);
  CHECK_FIELD (S2, c, 24,  8, 10);
  CHECK_FIELD (S2, t, 32,  9, 11);
  CHECK_FIELD (S2, u, 48,  9, 12);
  CHECK_FIELD (S2, d, 64,  8, 13);
#endif  /* HAVE_IA64_TYPES  */

  if (sizeof (struct S3)		!=  2)
    return 14;
  if (sizeof (struct S3)		!=  2)
    return 15;
  CHECK_FIELD (S3, c,  0,  8, 16);
  CHECK_FIELD (S3, s,  8,  8, 17);

  if (sizeof (union U4) 		!=  2)
    return 18;
  if (alignof (union U4)		!=  2)
    return 19;
  CHECK_FIELD (U4, c,  0,  8, 20);
  CHECK_FIELD (U4, s,  0,  8, 21);

  if (sizeof (struct S5)		!=  9)
    return 22;
  if (alignof (struct S5)		!=  1)
    return 23;
  CHECK_FIELD (S5, c,  0,  8, 24);
  CHECK_FIELD (S5, d, 32,  8, 25);
  CHECK_FIELD (S5, e, 64,  8, 26);

  return 0;
}
int load_conf(const char *path, struct rc_conf_s *r)
{
	int n;
	int missing_field = 0;
	size_t size = 0;
	ssize_t csize = 0;

	char *wpath = NULL;
	char *par_string;
	char *line = NULL;

	FILE *f;

	char conf_name[MAX_CONFIGURATION_SIZE];
	char conf_value[MAX_CONFIGURATION_SIZE];

	memset(r, 0, sizeof(struct rc_conf_s));

	if (path[0] == '~') {
		struct passwd *p = getpwuid(getuid());
		asprintf(&wpath, "%s%s", p->pw_dir, path + 1);
	} else {
		asprintf(&wpath, "%s", path);
	}

	f = fopen(wpath, "r");

	if (!f)
		return -1;

	/* Avoid buffer overflows */
	asprintf(&par_string, "%%%ds %%%ds",
			MAX_CONFIGURATION_SIZE, MAX_CONFIGURATION_SIZE);

	for (n = 0;
	    (csize = getline(&line, &size, f)) > 0;
	     n++) {

		size = csize;

		/* comment */
		if (trim(line)[0] == '#' || size <= 1)
			continue;

		sscanf(trim(line), par_string, conf_name, conf_value);
		if (option_dispatcher(conf_name, conf_value, r))
			fprintf(stderr, "warning, unknown conf: %s\n", conf_name);
	}

	free(line);

	fclose(f);

	/* With that we have some granularity on the error printf. */
	CHECK_FIELD(r, missing_field, db_name);
	CHECK_FIELD(r, missing_field, db_host);
	CHECK_FIELD(r, missing_field, db_user);
	CHECK_FIELD(r, missing_field, dir_change_subgenre);
	CHECK_FIELD(r, missing_field, dir_change_genre_on_one);
	CHECK_FIELD(r, missing_field, dir_change_genre_on_any);
	CHECK_FIELD(r, missing_field, dir_change_mood_on_one);
	CHECK_FIELD(r, missing_field, dir_change_mood_on_any);
	CHECK_FIELD(r, missing_field, dir_change_chord_on_one);
	CHECK_FIELD(r, missing_field, dir_change_chord_on_any);
	CHECK_FIELD(r, missing_field, dir_random_multi_chord);
	CHECK_FIELD(r, missing_field, dir_chord_tritone);
	CHECK_FIELD(r, missing_field, dir_chord_cadenza);
	CHECK_FIELD(r, missing_field, dir_chord_tonal_zone);

	if (missing_field)
		n = -1;

	return n;
}