AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de colas, pilas, listas y arrays / Funciones de colas, pilas y listas
  • WLanguage properties that can be used with the Stack type
  • WLanguage functions for managing stacks
  • The stacks and the multithread
  • Browsing the stacks
  • Special cases
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
A Stack variable is a structured type that is used to group a set of elements of the same type. The elements are added at the end of stack and they are retrieved from the most recent one.
For example, if the elements are added in the following order: 1, 2, 3, they will be retrieved in the following order: 3, 2, 1.
Novedad versión 2025
WEBDEV - Código Navegador This type of variable is now available in browser code.
Ejemplo
MyStack is Stack of int
 
// Push the values 1, 2 and 3
Push(MyStack, 1)
Push(MyStack, 2)
Push(MyStack, 3)
 
// Display the trace: 3, 2, 1
x is int
WHILE Pop(MyStack, x)
Trace(x)
END
Sintaxis

Declaring and initializing a stack Ocultar los detalles

<Stack name> is Stack of <Type of stack elements>
<Stack name>:
Name of Stack variable to declare.
<Type of stack elements>:
Type of the elements found in the stack.
All types of variables can be used including the arrays, the associative arrays, the queues, the stacks and the lists. For example:
<variable> is stack of arrays of int

<variable> is stack of fixed arrays of 5 int

<variable> is stack of associative arrays of int

<variable> is stack of queues of int

<variable> is stack of stacks of int

<variable> is stack of lists of int
Observaciones

WLanguage properties that can be used with the Stack type

The following properties can be used to define the characteristics of Stack variables.
Property name
Effect
AdditionCompletedReturns and modifies the addition mode of elements.
This property is used for the multithread management.
WEBDEV - Código Navegador This property is not available.
Empty
  • True if the stack is empty,
  • False otherwise.
NbPendingThreadReturns the number of pending threads.
This property is used for the multithread management.
WEBDEV - Código Navegador This property is not available.
OccurrenceReturns the number of stack occurrences.

WLanguage functions for managing stacks

The following functions can be used to handle Stack variables.
DeleteAllDeletes all elements:
  • from a one-dimensional or two-dimensional WLanguage array.
  • from an associative array.
  • from an advanced array property (array of gglCalendar events, etc.).
  • from a WLanguage queue.
  • from a WLanguage stack.
  • from a WLanguage list.
DeserializeDeserializa un búfer o una cadena de caracteres que contiene los datos de una clase, estructura, array (incluyendo un array asociativo), cola, pila, lista o variable avanzada, así como sus subelementos.
PopPop un elemento de un apilamiento.
PushPushes an element onto the stack.
SerializarTransforma los siguientes elementos en un formato específico:
  • una estructura (y sus subelementos),
  • una clase (y sus subelementos),
  • un array (incluidos los arrays asociativos),
  • una cola,
  • un apilamiento,
  • una lista.
StackInfoRecupera las características de un apilamiento: tipos de elementos y número de elementos.

The stacks and the multithread

The management of multithread is taken into account when adding and deleting an element (Push and Pop).
You also have the ability to use properties during a multithread management but the result is not permanent. For example:
IF MyStack.Occurrence > 0 THEN
	// The stack may be empty when the thread reaches this point
END
WEBDEV - Código Navegador Multithreading is not available.

Browsing the stacks

The FOR EACH syntax can be used to browse the stacks. The elements are browsed in pop order that is the reverse order of the push order.
The syntax used corresponds to the one used for the arrays:
FOR EACH [ELEMENT] <Variable> [, <Counter> [, <Counter>]] OF <Stack>
...
END
The elements can be modified during the browse. If the stack is modified during a browse, the elements browsed will be the ones found when the browse was initialized:
  • the elements pushed after the initialization of the browse will not be browsed.
  • the elements popped after the initialization of the browse will still be browsed.

Special cases

  • In the debugger, the content of the stack is displayed in pop order.
  • A stack can be used to type a procedure parameter.
  • A stack can be copied by the operator '='. You also have the ability to copy a class or structure instance containing a stack.
  • A stack can be initialized by a list of elements in push order.
Versión mínima requerida
  • Versión 14
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local