Secciones de la página

pdb. tol


Declaraciones


Constantes


Funciones


Time oriented language


Árbol de ficheros

Funciones

Set PdbRead()

Set PdbFirstN()

Tol

Artículos del sitio

Presentación de Tol

Todos los programas

Simuladores visuales

Sitios que me gustan

Por categorías

Algoritmia

Búsqueda y ordenación

Computación fisiológica

Editorial y edición

Gráficos de datos

Herramientas y utilidades

Hipertexto

Informática forense

Lectura óptica de datos

Metaprogramación

No determinista

Ofimática

Recursión e iteración

Reglas y restricciones

Series y estadística









pdb.tol de iForense

Posts database functions.

Declaraciones

Constantes

  • Text PdbSep
    Post separator inside the agendas.

Funciones

  • Set PdbRead(Text inpDir)
    Reads and returns a post database.
  • Set PdbFirstN(Set inpSet, Real maxNum, Code funSel)
    Returns the maxNum recents posts for funSel.

Constantes

Text PdbSep

//////////////////////////////////////////////////////////////////////////////
Text PdbSep = Repeat("_",78);
//////////////////////////////////////////////////////////////////////////////
PutDescription("Post separator inside the agendas.", PdbSep);
//////////////////////////////////////////////////////////////////////////////

Funciones

Set PdbRead()

//////////////////////////////////////////////////////////////////////////////
Set PdbRead(Text inpDir)
//////////////////////////////////////////////////////////////////////////////
{
  Real err(Text msg) { Text WriteLn("\nERROR: "+msg+"\n"); FALSE }; // Function
  
  Text filSep = Char(7);

  Text WriteLn("Reading "+inpDir+"...");
  Text inpAll = DirReadFiles(inpDir, "age", filSep);

  Text inpTxt = Replace(inpAll, PdbSep+"\n",filSep);
  Set  inpSet = Tokenizer(inpTxt,filSep);

  Set  inpTab = EvalSet(inpSet, Set(Text inf)
  {
    // Read
    Set  pstCla = Txt2Set(     TxtBetween2Tag(inf,"<Pst.Cla>", "\n<Pst.", TRUE),";");
    Text pstSta = Sub(         TxtBetween2Tag(inf,"<Pst.Sta>", "\n<Pst.", TRUE)+"C",1,1); // C por defecto
    Text pstCod =              TxtBetween2Tag(inf,"<Pst.Cod>", "\n<Pst.", TRUE);
    Text pstTh1 = PhtExpText(  TxtBetween2Tag(inf,"<Pst.Tit>", "\n<Pst.", TRUE));
    Text pstTit = TxtOutHtmScr(TxtBetween2Tag(inf,"<Pst.Tit>", "\n<Pst.", TRUE));
    Date pstDte = Eval(        TxtBetween2Tag(inf,"<Pst.Dte>", "\n<Pst.", TRUE));
    Text pstAut =              TxtBetween2Tag(inf,"<Pst.Aut>", "\n<Pst.", TRUE);
    Text pstTxt =              TxtBetween2Tag(inf,"<Pst.Txt>", "\n<Pst.", FALSE);

    // Check
    Text chkAut = If(pstAut=="", "Antonio Salmerón", pstAut);

    Set  chkCla = EvalSet(pstCla, Real(Text claNam) // Category class
    { If(claNam <: CatAll, TRUE, err("Class: "+pstCod+" "+claNam)) });

    // Store
    Set  pstObj = PdbSt(pstCla, pstSta, pstCod, pstTh1, pstTit, pstDte, chkAut, pstTxt);
//  Text WriteLn(PhtFileName(TxtOutside2Tag(pstObj->pstTit, "<", ">")));
    pstObj
  });

  Set inpSel = Select(inpTab, Real(Set a) { a->pstSta != "A" }); // Not deleted

  Set inpSor = Sort(inpSel, Real(Set a, Set b) // By code
               { Compare(a->pstCod, b->pstCod) });

  // Check
  Real chkDup =
  {
    Set codCla = Classify(inpTab, Real(Set a, Set b) // By name
                 { Compare(a->pstCod,b->pstCod) });
    Set codDup = EvalSet(codCla, Real(Set cla)
    {
      Real crd = Card(cla);
      Text nam = cla[1]->pstCod;
      If(EQ(crd,1), TRUE, err("Name: "+nam+" "+FormatReal(crd,"%.0lf")+" times"))
    });
    
    Set pthCla = Classify(inpTab, Real(Set a, Set b) // By external path / Title
                 { Compare(PhtFileName(TxtOutside2Tag(a->pstTit, "<", ">")),
                           PhtFileName(TxtOutside2Tag(b->pstTit, "<", ">"))) });
    Set pthDup = EvalSet(pthCla, Real(Set cla)
    {
      Real crd = Card(cla);
      Text pth = cla[1]->pstCod;
      If(EQ(crd,1), TRUE, err("Similar titles:\n  ["+cla[1]->pstTit+"]\n  ["+cla[2]->pstTit+"]"))
    });
    Card(codDup)+Card(pthDup)
  };
  
  Text WriteLn("Status ABC "+FormatReal(Card(inpTab),"%3.0lf")+" registers");
  Text WriteLn("Status _BC "+FormatReal(Card(inpSel),"%3.0lf")+" registers");

  inpSor
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Reads and returns a post database.",
PdbRead);
//////////////////////////////////////////////////////////////////////////////

Set PdbFirstN()

//////////////////////////////////////////////////////////////////////////////
Set PdbFirstN(Set  inpSet, // Post database
              Real maxNum, // Maximum numbers of posts to return
              Code funSel) // Post selection conditions
//////////////////////////////////////////////////////////////////////////////
{
  Set  selFst = Select(inpSet, funSel); // Select all that funSel()
  SetFirstN(selFst, maxNum)             // Fst maxNum or all if there are few
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the maxNum recents posts for funSel.",
PdbFirstN);
//////////////////////////////////////////////////////////////////////////////

Time oriented language

//////////////////////////////////////////////////////////////////////////////
// FILE    : pdb.tol
// AUTHOR  : http://www.asolver.com
// PURPOSE : Posts database functions.
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
// CONSTANTS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Text PdbSep = Repeat("_",78);
//////////////////////////////////////////////////////////////////////////////
PutDescription("Post separator inside the agendas.", PdbSep);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
Set PdbRead(Text inpDir)
//////////////////////////////////////////////////////////////////////////////
{
  Real err(Text msg) { Text WriteLn("\nERROR: "+msg+"\n"); FALSE }; // Function
  
  Text filSep = Char(7);

  Text WriteLn("Reading "+inpDir+"...");
  Text inpAll = DirReadFiles(inpDir, "age", filSep);

  Text inpTxt = Replace(inpAll, PdbSep+"\n",filSep);
  Set  inpSet = Tokenizer(inpTxt,filSep);

  Set  inpTab = EvalSet(inpSet, Set(Text inf)
  {
    // Read
    Set  pstCla = Txt2Set(     TxtBetween2Tag(inf,"<Pst.Cla>", "\n<Pst.", TRUE),";");
    Text pstSta = Sub(         TxtBetween2Tag(inf,"<Pst.Sta>", "\n<Pst.", TRUE)+"C",1,1); // C por defecto
    Text pstCod =              TxtBetween2Tag(inf,"<Pst.Cod>", "\n<Pst.", TRUE);
    Text pstTh1 = PhtExpText(  TxtBetween2Tag(inf,"<Pst.Tit>", "\n<Pst.", TRUE));
    Text pstTit = TxtOutHtmScr(TxtBetween2Tag(inf,"<Pst.Tit>", "\n<Pst.", TRUE));
    Date pstDte = Eval(        TxtBetween2Tag(inf,"<Pst.Dte>", "\n<Pst.", TRUE));
    Text pstAut =              TxtBetween2Tag(inf,"<Pst.Aut>", "\n<Pst.", TRUE);
    Text pstTxt =              TxtBetween2Tag(inf,"<Pst.Txt>", "\n<Pst.", FALSE);

    // Check
    Text chkAut = If(pstAut=="", "Antonio Salmerón", pstAut);

    Set  chkCla = EvalSet(pstCla, Real(Text claNam) // Category class
    { If(claNam <: CatAll, TRUE, err("Class: "+pstCod+" "+claNam)) });

    // Store
    Set  pstObj = PdbSt(pstCla, pstSta, pstCod, pstTh1, pstTit, pstDte, chkAut, pstTxt);
//  Text WriteLn(PhtFileName(TxtOutside2Tag(pstObj->pstTit, "<", ">")));
    pstObj
  });

  Set inpSel = Select(inpTab, Real(Set a) { a->pstSta != "A" }); // Not deleted

  Set inpSor = Sort(inpSel, Real(Set a, Set b) // By code
               { Compare(a->pstCod, b->pstCod) });

  // Check
  Real chkDup =
  {
    Set codCla = Classify(inpTab, Real(Set a, Set b) // By name
                 { Compare(a->pstCod,b->pstCod) });
    Set codDup = EvalSet(codCla, Real(Set cla)
    {
      Real crd = Card(cla);
      Text nam = cla[1]->pstCod;
      If(EQ(crd,1), TRUE, err("Name: "+nam+" "+FormatReal(crd,"%.0lf")+" times"))
    });
    
    Set pthCla = Classify(inpTab, Real(Set a, Set b) // By external path / Title
                 { Compare(PhtFileName(TxtOutside2Tag(a->pstTit, "<", ">")),
                           PhtFileName(TxtOutside2Tag(b->pstTit, "<", ">"))) });
    Set pthDup = EvalSet(pthCla, Real(Set cla)
    {
      Real crd = Card(cla);
      Text pth = cla[1]->pstCod;
      If(EQ(crd,1), TRUE, err("Similar titles:\n  ["+cla[1]->pstTit+"]\n  ["+cla[2]->pstTit+"]"))
    });
    Card(codDup)+Card(pthDup)
  };
  
  Text WriteLn("Status ABC "+FormatReal(Card(inpTab),"%3.0lf")+" registers");
  Text WriteLn("Status _BC "+FormatReal(Card(inpSel),"%3.0lf")+" registers");

  inpSor
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Reads and returns a post database.",
PdbRead);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Set PdbFirstN(Set  inpSet, // Post database
              Real maxNum, // Maximum numbers of posts to return
              Code funSel) // Post selection conditions
//////////////////////////////////////////////////////////////////////////////
{
  Set  selFst = Select(inpSet, funSel); // Select all that funSel()
  SetFirstN(selFst, maxNum)             // Fst maxNum or all if there are few
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns the maxNum recents posts for funSel.",
PdbFirstN);
//////////////////////////////////////////////////////////////////////////////

Árbol de ficheros

iForense construye las paginas del sitio sobre informática forense Forense.Info

  • make.tol proceso principal de generacion del sitio web y todas su páginas
  • tol directorios de código en lenguaje Tol
    • cmm funciones comunes
      • txt.tol código de funciones de textos
      • dte.tol código de funciones de fechas
      • set.tol código de funciones de conjuntos
      • fil.tol código de funciones de ficheros
      • dir.tol código de funciones de directorios
      • tme.tol funciones del macro-expansor doble de Tol en Html
      • img.tol funciones para imagenes declaradas en Html
      • ftp.tol para generar mandatos para hacer Ftp
      • xsm.tol para construir sitemaps en Xml
    • app funciones específicas de aplicación
      • glo.tol de términos del glosario forense e informatico
      • pdb.tol de manejo de los posts de una agenda
      • pht.tol funciones auxiliares para el Html de los post
    • inc.tol para la inclusión de ficheros en lenguaje Tol
  • agenda directorio destinado a la agenda de post
  • web directorio destinado a las páginas web generadas y a contenido
    • css directorio para ficheros de estilo de tipo Css
      • common.css fichero Cascading Style Sheets para las paginas Html
    • seed directorio para ficheros semilla
      • seed.htm semilla de página Html, template, con Tol embebido
    • src directorio para ficheros con código Javascript
      • common.js funciones Javascript de redes sociales y multimedia
    • imagenes directorio de ilustraciones del sitio web
    • articulos directorio para las páginas de artículos de informática forense
    • categorias directorio para paginas de categorias de informática forense
    • sitemap.xml mapa del sitio web generado automáticamente en Xml
  • resultado.html muestra del web de informática forense del dominio Forense.Info
  • iforense.pdf documento resumen de funciones del programa creador del web

2015 asolver.com | Aviso legal | XHTML | Δ Θ Ξ | Creative Commons | Mapa y funciones del sitio

Tol