Changeset 4444

Show
Ignore:
Timestamp:
03/27/12 19:39:32 (6 years ago)
Author:
vdebuen
Message:

Fixes #1491

Location:
tolp/trunk/tol
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • tolp/trunk/tol/btol/bgrammar/str.cpp

    r3342 r4444  
    3535#include <tol/tol_bgrammar.h> 
    3636#include <tol/tol_bsymboltable.h> 
     37#include <tol/tol_btxtgra.h> 
    3738#include <tol/tol_bsetgra.h> 
    3839#include <tol/tol_bcodgra.h> 
     
    4041#include <tol/tol_bclass.h> 
    4142 
     43static BStruct* strStructFieldInfo_  = NULL; 
    4244 
    4345#ifdef CATCH_NON_STANDARD_STRUCT 
     
    240242# define TRACE_SHOW_STRUCT_STEP(fun,status,pos,step) 
    241243#endif 
     244 
    242245 
    243246//-------------------------------------------------------------------- 
     
    725728  return(ok); 
    726729} 
     730 
     731//-------------------------------------------------------------------- 
     732DeclareContensClass(BSet, BSetTemporary, BStructFields); 
     733DefExtOpr(1, BStructFields, "StructFields", 1, 1, "Text", 
     734 "(Text className)", 
     735 I2("Returns a set with a register of information about each field " 
     736    " on a structure. The information is returned using structure\n", 
     737    "Devuelve un conjunto con un registro de información acerca " 
     738    "de cada uno de los campos de una estructura. La " 
     739    "información se devuelve usando la estructura:\n")+ 
     740    "  @StructFieldInfo { \n" 
     741    "    Text Type,\n" 
     742    "    Text Name,\n" 
     743    "    Text Description }\n", 
     744 BOperClassify::System_); 
     745//-------------------------------------------------------------------- 
     746void BStructFields::CalcContens() 
     747//-------------------------------------------------------------------- 
     748{ 
     749  static BStruct* strStructFieldInfo_ = NULL; 
     750  if(!strStructFieldInfo_) 
     751  { 
     752    strStructFieldInfo_ = FindStruct("@StructFieldInfo"); 
     753  } 
     754  assert(strStructFieldInfo_); 
     755  const BText& strName = Text(Arg(1)); 
     756  BStruct* str = FindStruct(strName); 
     757  if(!str) { return; } 
     758  int i; 
     759  contens_.PrepareStore(str->Size()); 
     760  for(i=0; i<str->Size(); i++) 
     761  { 
     762    BField& fld = (*str)[i]; 
     763    BSet reg; 
     764    reg.PrepareStore(3); 
     765    reg.AddElement(new BContensText("",fld.GetType(),"")); 
     766    reg.AddElement(new BContensText("",fld.Name(),"")); 
     767    reg.AddElement(new BContensText("","","")); 
     768    reg.PutStruct(strStructFieldInfo_); 
     769    contens_.AddElement(new BSetTuple("", reg)); 
     770  } 
     771} 
  • tolp/trunk/tol/init.cpp

    r4357 r4444  
    985985 
    986986  InitRefStructs(); 
     987 
     988  BStruct* strStructFieldInfo_  = NewStruct("@StructFieldInfo",  
     989    "Text:Type," 
     990    "Text:Name," 
     991    "Text:Description"); 
    987992 
    988993  TOLHasBeenInitialized_ = true;