Secciones de la página

dir. tol


Declaraciones


Funciones


Time oriented language


Árbol de ficheros

Funciones

Set DirExtAll()

Text DirReadFiles()

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









dir.tol de ChRules.Iterative

Directories functions.

Declaraciones

Funciones

  • Set DirExtAll(Text dirPth, Text chkExt, Real toLowe, Real casSen)
    Returns a set of relative paths of files with the extension chkExt that are inside the directory dirPth and inside all of its directories. If toLowe then all names are changed to lower case. If casSen then are case sensitive in the extension match. Is a version of DirAll() function that only check extensions and not uses TextMatch() that writes warnings at Tol 2.0.1.
  • Text DirReadFiles(Text dirPth, Text chkExt, Text filSep)
    Returns as a text the contents of all files in dirPth that theirs file names match with file pattern filPat. In this text, the contenst of each file will be separated with filSep.

Funciones

Set DirExtAll()

//////////////////////////////////////////////////////////////////////////////
Set DirExtAll(Text dirPth, // Directory path
              Text chkExt, // File extension
              Real toLowe, // If true all paths are changed to lower case
              Real casSen) // If true the extension match is case sensitive
//////////////////////////////////////////////////////////////////////////////
{
  If(Not(DirExist(dirPth)), Empty,
  {
    Set  getDir = GetDir(dirPth);
    Set  filSet = getDir[1];
    Set  dirSet = getDir[2];

    Set  filFnd = EvalSet(filSet, Text(Text filNam)
    {
      If(!FilCheckExtension(filNam, chkExt, casSen), "",
         If(toLowe, ToLower(dirPth+"/"+filNam), dirPth+"/"+filNam))
    });

    Set filSel = Select(filFnd, Real(Text filNam) { filNam != "" });

    Set  dirFnd = EvalSet(dirSet, Set(Text subDir)
      { DirExtAll(dirPth+"/"+subDir, chkExt, toLowe, casSen) });

    Real dirCar = Card(dirFnd);
    
    If(EQ(dirCar,0), filSel,
    If(EQ(dirCar,1), filSel << dirFnd[1],
                     filSel << BinGroup("+", dirFnd)))
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a set of relative paths of files with the extension chkExt that
are inside the directory dirPth and inside all of its directories.
If toLowe then all names are changed to lower case.
If casSen then are case sensitive in the extension match.
Is a version of DirAll() function that only check extensions and not uses
TextMatch() that writes warnings at Tol 2.0.1.",
DirExtAll);
//////////////////////////////////////////////////////////////////////////////

Text DirReadFiles()

//////////////////////////////////////////////////////////////////////////////
Text DirReadFiles(Text dirPth, // Directory path
                  Text chkExt, // File extension
                  Text filSep) // File separator
//////////////////////////////////////////////////////////////////////////////
{
  Set pthSet = DirExtAll(dirPth, chkExt, FALSE, TRUE);
  Set txtSet = EvalSet(pthSet, Text(Text filPth) { ReadFile(filPth) });
  Set2Txt(txtSet, "", "", filSep, filSep, "", "", "", "")
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns as a text the contents of all files in dirPth that theirs file names
match with file pattern filPat.
In this text, the contenst of each file will be separated with filSep.",
DirReadFiles);
//////////////////////////////////////////////////////////////////////////////

Time oriented language

//////////////////////////////////////////////////////////////////////////////
// FILE    : dir.tol
// AUTHOR  : http://www.asolver.com
// PURPOSE : Directories functions.
//////////////////////////////////////////////////////////////////////////////


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

//////////////////////////////////////////////////////////////////////////////
Set DirExtAll(Text dirPth, // Directory path
              Text chkExt, // File extension
              Real toLowe, // If true all paths are changed to lower case
              Real casSen) // If true the extension match is case sensitive
//////////////////////////////////////////////////////////////////////////////
{
  If(Not(DirExist(dirPth)), Empty,
  {
    Set  getDir = GetDir(dirPth);
    Set  filSet = getDir[1];
    Set  dirSet = getDir[2];

    Set  filFnd = EvalSet(filSet, Text(Text filNam)
    {
      If(!FilCheckExtension(filNam, chkExt, casSen), "",
         If(toLowe, ToLower(dirPth+"/"+filNam), dirPth+"/"+filNam))
    });

    Set filSel = Select(filFnd, Real(Text filNam) { filNam != "" });

    Set  dirFnd = EvalSet(dirSet, Set(Text subDir)
      { DirExtAll(dirPth+"/"+subDir, chkExt, toLowe, casSen) });

    Real dirCar = Card(dirFnd);
    
    If(EQ(dirCar,0), filSel,
    If(EQ(dirCar,1), filSel << dirFnd[1],
                     filSel << BinGroup("+", dirFnd)))
  })
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns a set of relative paths of files with the extension chkExt that
are inside the directory dirPth and inside all of its directories.
If toLowe then all names are changed to lower case.
If casSen then are case sensitive in the extension match.
Is a version of DirAll() function that only check extensions and not uses
TextMatch() that writes warnings at Tol 2.0.1.",
DirExtAll);
//////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////
Text DirReadFiles(Text dirPth, // Directory path
                  Text chkExt, // File extension
                  Text filSep) // File separator
//////////////////////////////////////////////////////////////////////////////
{
  Set pthSet = DirExtAll(dirPth, chkExt, FALSE, TRUE);
  Set txtSet = EvalSet(pthSet, Text(Text filPth) { ReadFile(filPth) });
  Set2Txt(txtSet, "", "", filSep, filSep, "", "", "", "")
};
//////////////////////////////////////////////////////////////////////////////
PutDescription(
"Returns as a text the contents of all files in dirPth that theirs file names
match with file pattern filPat.
In this text, the contenst of each file will be separated with filSep.",
DirReadFiles);
//////////////////////////////////////////////////////////////////////////////

Árbol de ficheros

ChRules.Iterative programa de aplicacion iterativa de reglas de areas de caracteres

  • make.tol aplica unas bases de reglas de reescritura a varios escenarios
  • make.bat mandato de ejecucion del programa de aplicacion de reglas
  • tol directorios que contienen fichero de codigo fuente Tol
    • cmm funciones comunes
    • app directorio funciones y datos de areas, reglas y motor de reglas
      • are.tol funciones de areas sobre las que se aplican las reglas
      • rul.tol funciones de reglas que transforman de areas de caracteres
      • eng.tol funciones del motor iterativo de aplicacion de reglas
      • bub.tol para realizar un orden parcial con metodo de burbuja
      • cel.tol automata celular con reglas de reproduccion y muerte
      • lab.tol base de reglas para que un robot salga de un laberinto
      • fll.tol base de reglas para rellenar, fill, superficies cerradas
      • pon.tol base de reglas de un pingpong electronico, pong
    • inc.tol para la inclusion de funciones, areas y bases de reglas
  • simulator directorio del simulador en Javascript del motor iterativo de reglas
    • css directorio para css, Cascading Style Sheets, del simulador
      • simulator.css css para simular areas de aplicacion de las reglas
    • src directorio de codigo fuente Javascript del simulador de reglas
      • simulator.js simula el funcionamiento del motor de aplicacion de reglas
      • simulatorarray.js array con ejemplos de evolucion para cada base de reglas
  • automata_celular_al_azar.html automata celular de reglas al azar de reproduccion y muerte
  • automata_celular_determinista.html automata celular determinista de reglas de reproduccion y muerte
  • burbuja_y_sedimentos.html orden parcial con metodo de burbuja simulando una sedimentacion
  • laberinto_2_cabezones.html laberinto con 2 robots que se autobloquean y no pueden salir
  • laberinto_2_negociadores.html laberinto con 2 robots y reglas para resolver su mutuo bloqueo
  • laberinto_mas_grande.html robot que sale del laberinto aplicando reglas de la mano derecha
  • laberinto_mano_izquierda_html robot que busca la salida aplicando reglas de la mano izquierda
  • laberinto_mini_1_robot.html pequeño laberinto con un robot y reglas de la mano derecha
  • partida_de_pong_al_15.html partida de pong donde el 15% de las veces las reglas son al azar
  • partida_de_pong_al_20.html partida de pong donde el 20% de las veces las reglas son al azar
  • partida_de_pong_azarosa.html partida de pingpong electronico, pong, con reglas aleatorias
  • partida_de_pong_eterna.html ciclo eterno de una partida de pong, con reglas deterministas
  • rellena_caja_al_azar.html reglas para llenar superficies aplicadas a una caja con lineas
  • rellena_k_al_azar.html rellenado de superficies aplicado al interior de una letra K
  • simulator.html simulador del motor iterativo de reglas de areas de caracteres
  • chrules_iterative.pdf funciones del motor de aplicacion de reglas de caracteres

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

Tol