Пример #1
0
GffFileWriter::GffFileWriter(
	)
/*++

Routine Description:

	This routine constructs a new GffFileWriter object and initializes the root
	structure.

Arguments:

	None.

Return Value:

	The newly constructed object.

Environment:

	User mode.

--*/
: m_Language( GffFileReader::LangEnglish ),
  m_FileType( GFF_FILE_TYPE )
{
	m_RootStruct = new FieldStruct;

	m_RootStruct->StructType = 0xFFFFFFFF;

	AddStruct( m_RootStruct );
}
Пример #2
0
void Library::AddStruct(const StructType &structType) {
    if (m_RegisteredStruct.find(structType.GetName()) != m_RegisteredStruct.end()) {
        return;
    }
    m_RegisteredStruct.insert(structType.GetName());
    for (auto it : structType.GetArgs()) {
        std::shared_ptr<StructType> st = it->GetStructType();
        if (st.get() != nullptr) {
            AddStruct(*st);
        }
    }
    structType.EmitForwardDeclaration(m_Stream);
}
Пример #3
0
void GetStructSpec( FILE *infile,
                    ListNode *structs,
                    ListNode *vec_secs,
                    ListNode *primitives,
                    ListNode *macros )
{   char nextchar;
    Structs *newstruct;

    fscanf( infile, "%s ", buffer );
    newstruct = AddStruct( buffer, structs);
    if(( nextchar = skiplayout(infile)) == '=' )
    {   GetStructEntries( infile, newstruct, vec_secs, primitives, macros );
        StructDefined( newstruct) = TRUE;
    }
    else
    {   ungetc(nextchar,infile);
    }
}
Пример #4
0
void Y_add_member(int nArgs)
{
  Operand op;
  IOStream *file;
  long offset;
  char *structName, *name;
  StructDef *memType, *base;
  Symbol *stack= sp-nArgs+1;
  if (nArgs<5) YError("add_member requires at least five arguments");

  file= YGetFile(stack++);
  structName= YGetString(stack++);
  offset= YGetInteger(stack++);
  name= YGetString(stack++);

  stack->ops->FormOperand(stack, &op);
  if (op.ops==&structDefOps) memType= op.value;
  else if (op.ops==&stringOps && !op.type.dims) {
    char *typeName= ((char **)op.value)[0];
    if (!HashFind(&file->structTable, typeName, 0L))
      YError("5th argument refers to non-existent data type");
    memType= file->structList[hashIndex];
  } else {
    YError("5th argument must be either string or struct definition");
    memType= 0;
  }

  if (HashFind(&file->structTable, structName, 0L))
    base= file->structList[hashIndex];
  else
    base= AddStruct(file, structName, 0L);

  if (!base) YError("unable to create given struct_name in add_member");

  nArgs-= 5;
  stack++;
  BuildDimList(stack, nArgs);

  if (AddMember(base, offset, name, memType, tmpDims))
    YError("add_member failed -- duplicate member name?");

  Drop(nArgs);
}
Пример #5
0
 CWizKMAttachmentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strAttachmentGUID, UINT nParts, const WIZDOCUMENTATTACHMENTDATA& infodata, const QString& strObjMd5)
     : CWizKMAttachmentGetDataParam(nApiVersion, strToken, strBookGUID, strAttachmentGUID, nParts)
 {
     CWizXmlRpcStructValue* pAttachmentStruct = new CWizXmlRpcStructValue();
     AddStruct(_T("attachment"), pAttachmentStruct);
     //
     pAttachmentStruct->AddString(_T("attachment_guid"), strAttachmentGUID);
     pAttachmentStruct->AddBool(_T("attachment_info"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE);
     pAttachmentStruct->AddBool(_T("attachment_data"), (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE);
     //
     BOOL bInfo = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_INFO) ? TRUE : FALSE;
     BOOL bData = (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA) ? TRUE : FALSE;
     //
     BOOL bDataInfoAdded = FALSE;
     //
     if (bInfo)
     {
         pAttachmentStruct->AddString(_T("attachment_document_guid"), infodata.strDocumentGUID);
         pAttachmentStruct->AddString(_T("attachment_name"), infodata.strName);
         pAttachmentStruct->AddString(_T("attachment_url"), infodata.strURL);
         pAttachmentStruct->AddString(_T("attachment_description"), infodata.strDescription);
         pAttachmentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
         pAttachmentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
         pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
         pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
         //
         bDataInfoAdded = TRUE;
     }
     if (bData)
     {
         if (!bDataInfoAdded)
         {
             pAttachmentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
             pAttachmentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
             bDataInfoAdded = TRUE;
         }
         pAttachmentStruct->AddString(_T("attachment_zip_md5"), strObjMd5);
     }
 }
Пример #6
0
sym_id  STStruct( char *name, int length ) {
//==========================================

// Lookup the specified structure name in the symbol table.

    sym_id      sym;

    if( length > MAX_SYMLEN ) {
        length = MAX_SYMLEN;
    }
    if( name != NULL ) {
        sym = FindStruct( name, length );
    } else {
        // This is so that we don't issue SP_DUPLICATE_FIELD errors when
        // the user makes mistakes such as:
        //      STRUCTURE               ! forgot the name
        //          INTEGER K
        //      END STRUCTURE
        //      STRUCTURE               ! forgot the name again
        //          REAL K
        //      END STRUCTURE
        // or,
        //      STRUCTURE /FOO/
        //          INTEGER     K
        //      END STRUCTURE
        //      STRUCTURE /FOO/         ! CpStructure will pass NULL name here
        //          INTEGER     K
        //      END STRUCTURE
        sym = NULL;
    }
    if( sym == NULL ) {
        sym = AddStruct( name, length );
        sym->u.sd.link = RList;
        sym->u.sd.fl.fields = NULL;
        sym->u.sd.size = 0;
        RList = sym;
    }
    return( sym );
}
Пример #7
0
 CWizKMDocumentPostDataParam(int nApiVersion, const QString& strToken, const QString& strBookGUID, const QString& strDocumentGUID, UINT nParts, const WIZDOCUMENTDATA& infodata, const CWizStdStringArray& tags, const std::deque<WIZDOCUMENTPARAMDATA>& params, const QString& strObjMd5)
     : CWizKMDocumentGetDataParam(nApiVersion, strToken, strBookGUID, strDocumentGUID, nParts)
 {
     CWizXmlRpcStructValue* pDocumentStruct = new CWizXmlRpcStructValue();
     AddStruct(_T("document"), pDocumentStruct);
     //
     pDocumentStruct->AddString(_T("document_guid"), strDocumentGUID);
     pDocumentStruct->AddBool(_T("document_info"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE);
     pDocumentStruct->AddBool(_T("document_data"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE);
     pDocumentStruct->AddBool(_T("document_param"), (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE);
     //
     BOOL bInfo = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_INFO) ? TRUE : FALSE;
     BOOL bData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE;
     BOOL bParam = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_PARAM) ? TRUE : FALSE;
     //
     BOOL bParamInfoAdded = FALSE;
     BOOL bDataInfoAdded = FALSE;
     //
     if (bInfo)
     {
         pDocumentStruct->AddString(_T("document_title"), infodata.strTitle);
         pDocumentStruct->AddString(_T("document_category"), infodata.strLocation);
         pDocumentStruct->AddString(_T("document_filename"), infodata.strName);
         pDocumentStruct->AddString(_T("document_seo"), infodata.strSEO);
         pDocumentStruct->AddString(_T("document_url"), infodata.strURL);
         pDocumentStruct->AddString(_T("document_author"), infodata.strAuthor);
         pDocumentStruct->AddString(_T("document_keywords"), infodata.strKeywords);
         pDocumentStruct->AddString(_T("document_type"), infodata.strType);
         pDocumentStruct->AddString(_T("document_owner"), infodata.strOwner);
         pDocumentStruct->AddString(_T("document_filetype"), infodata.strFileType);
         pDocumentStruct->AddString(_T("document_styleguid"), infodata.strStyleGUID);
         pDocumentStruct->AddTime(_T("dt_created"), infodata.tCreated);
         pDocumentStruct->AddTime(_T("dt_modified"), infodata.tModified);
         pDocumentStruct->AddTime(_T("dt_accessed"), infodata.tAccessed);
         pDocumentStruct->AddInt(_T("document_iconindex"), infodata.nIconIndex);
         pDocumentStruct->AddInt(_T("document_protected"), infodata.nProtected);
         pDocumentStruct->AddInt(_T("document_readcount"), infodata.nReadCount);
         pDocumentStruct->AddInt(_T("document_attachment_count"), infodata.nAttachmentCount);
         pDocumentStruct->AddTime(_T("dt_info_modified"), infodata.tInfoModified);
         pDocumentStruct->AddString(_T("info_md5"), infodata.strInfoMD5);
         pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
         pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
         pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
         pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
         //
         bParamInfoAdded = TRUE;
         bDataInfoAdded = TRUE;
         //
         pDocumentStruct->AddStringArray(_T("document_tags"), tags);
     }
     if (bParam)
     {
         if (!bParamInfoAdded)
         {
             pDocumentStruct->AddTime(_T("dt_param_modified"), infodata.tParamModified);
             pDocumentStruct->AddString(_T("param_md5"), infodata.strParamMD5);
             bParamInfoAdded = TRUE;
         }
         //
         std::deque<WIZDOCUMENTPARAMDATA> arrParams;
         arrParams.assign(params.begin(), params.end());
         pDocumentStruct->AddArray(_T("document_params"), arrParams);
     }
     if (bData)
     {
         if (!bDataInfoAdded)
         {
             pDocumentStruct->AddTime(_T("dt_data_modified"), infodata.tDataModified);
             pDocumentStruct->AddString(_T("data_md5"), infodata.strDataMD5);
             bDataInfoAdded = TRUE;
         }
         //
         pDocumentStruct->AddString(_T("document_zip_md5"), strObjMd5);
     }
 }
Пример #8
0
void Y_install_struct(int nArgs)
{
  IOStream *file;
  long size= 0, align= 0, order= 0, *layout= 0;
  Dimension *dims;
  FPLayout fpLayout;
  char *structName;
  StructDef *base, *model;
  Symbol *stack= sp-nArgs+1;
  if (nArgs!=2 && nArgs!=5 && nArgs!=6)
    YError("install_struct requires 2, 5, or 6 arguments");

  file= YGetFile(stack++);
  structName= YGetString(stack++);

  if (nArgs>2) {
    size= YGetInteger(stack++);
    align= YGetInteger(stack++);
    order= YGetInteger(stack++);
    if (nArgs==6) {
      layout= YGet_L(stack, 1, &dims);
      if (!layout || TotalNumber(dims)!=7)
        YError("layout argument must be array of 7 longs in install_struct");
      fpLayout.sgnAddr= (int)layout[0];
      fpLayout.expAddr= (int)layout[1];
      fpLayout.expSize= (int)layout[2];
      fpLayout.manAddr= (int)layout[3];
      fpLayout.manSize= (int)layout[4];
      fpLayout.manNorm= (int)layout[5];
      fpLayout.expBias= layout[6];
    }
  }

  if (HashFind(&file->structTable, structName, 0L)) {
    if (hashIndex<=6 && nArgs<=2)
      YError("install_struct cannot change primitive type into a struct");
    base= file->structList[hashIndex];
    if (hashIndex>=8 && base->dataOps)
      YError("install_struct cannot redefine non-primitive data type");
    model= base->model;
    if (model) while (model->model) model= model->model;
    base->dataOps= 0;
  } else {
    base= AddStruct(file, structName, 0L);
    model= 0;
  }

  if (!base) YError("unable to create given struct_name in install_struct");

  if (nArgs>2) {
    int addressType= 1;
    if (order>=size && size>1) {
      order= 0;
      addressType= 2;
    }
    if (DefinePrimitive(base, size, (int)align, addressType, (int)order,
                        layout? &fpLayout : 0, model, (Converter *)0))
      YError("failed to define primitive data type in add_member");
  }

  InstallStruct(base, (StructDef *)0);

  Drop(nArgs);
}