[CONFIGURATION]

* BUG: Do not compile database manager anymore, it has been deprecated.
* BUG: Compile the gb.dbus component.

[INTERPRETER]
* NEW: Pointer is a real datatype now.
* NEW: Static arrays came back. They are now like real array classes, 
  except that they are not resizable.
* NEW: IsPointer() is a new function that tells if an expression is a 
  pointer.
* NEW: All XXXX?() function synonymous were removed. Use the IsXXXX() 
  version instead.
* NEW: Remove now useless source files.

[COMPILER]
* NEW: Static arrays came back, with actually the same syntax as before.

[EXAMPLES]
* BUG: Fix the examples according to the new array syntax.



git-svn-id: svn://localhost/gambas/trunk@2949 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-05-19 12:43:57 +00:00
parent 9ccdbce7dd
commit a2850ebc91
70 changed files with 1220 additions and 1661 deletions

View file

@ -25,6 +25,7 @@ SUBDIRS = \
@cairo_dir@ \
@imageio_dir@ \
@imageimlib_dir@ \
@dbus_dir@ \
comp \
app \
examples

View file

@ -20,7 +20,7 @@ AC_DEFUN([GB_INIT_AUTOMAKE],
##AM_SILENT_RULES([yes])
AM_CONFIG_HEADER([config.h])
AC_DEFINE(GAMBAS_FULL_VERSION, 0x02990000, [Full Gambas version])
AC_DEFINE(GAMBAS_PCODE_VERSION, 0x02990005, [Gambas bytecode version])
AC_DEFINE(GAMBAS_PCODE_VERSION, 0x02990006, [Gambas bytecode version])
])
## ---------------------------------------------------------------------------

View file

@ -1 +1 @@
gambas3 gambas-database-manager gbs3
gambas3 gbs3

View file

@ -1,6 +1,18 @@
#Chart
CA
_$ColChart
V
Collection
Id
v
s
_fProportionnal
v
f
FirstColumnAsLabel
p
b

View file

@ -21,6 +21,7 @@ Private Sub Load()
Dim sLine As String
Dim sSlot As String
Dim iPos As Integer
Dim hCol As Collection
$cSlot = New Collection
If Not Exist($sPath) Then Return
@ -38,7 +39,8 @@ Private Sub Load()
If Left$(sLine) = "[" Then
If Right$(sLine) = "]" Then
sSlot = Mid$(sLine, 2, -1)
$cSlot[sSlot] = New Collection
hCol = New Collection
$cSlot[sSlot] = hCol
Continue
Else
sSlot = False
@ -58,7 +60,7 @@ Private Sub Load()
Catch
If iLine Then
Error.Raise("Syntax error in settings file at line #" & iLine & ": " & Error.Text)
Error.Raise("Syntax error in settings file at line #" & iLine & ": " & Error.Where & ": " & Error.Text)
Else
Error.Raise(Error.Text)
Endif

View file

@ -34,6 +34,7 @@ GB_CONFIG_SUBDIRS(pdf, gb.pdf)
GB_CONFIG_SUBDIRS(cairo, gb.cairo)
GB_CONFIG_SUBDIRS(imageio, gb.image.io)
GB_CONFIG_SUBDIRS(imageimlib, gb.image.imlib)
GB_CONFIG_SUBDIRS(dbus, gb.dbus)
AC_CONFIG_SUBDIRS(comp)
AC_CONFIG_SUBDIRS(app)

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2606)
# Compiled with Gambas 2.99.0 (r2921)
Title=Barcode Printing
Startup=FMain
Icon=barcode.png

View file

@ -15,8 +15,8 @@ SearchComment=False
SearchString=True
[OpenFile]
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Drawing/Barcode/.src/modCrBcode.module:23.47"
Active=2
Active=1
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Drawing/Barcode/.src/modCrBcode.module:85.25"
File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Drawing/Barcode/.src/FMain.class:56.2"
File[3]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Drawing/Barcode/.src/FMain.form"
Count=3

View file

@ -1,23 +1,23 @@
' Gambas module file
PUBLIC SUB PrintBarcode(bcode AS String, posX AS Integer, posY AS Integer, bcHeight AS Integer, barThickness AS Integer, SorP AS Boolean)
DIM structure AS String[10]
Public Sub PrintBarcode(bcode As String, posX As Integer, posY As Integer, bcHeight As Integer, barThickness As Integer, SorP As Boolean)
Dim structure As New String[10]
'DIM enc AS String[10, 3]. I did it the following way 'cos I get not get the prg to read a multi-dimension array!
DIM enc1 AS String[10]
DIM enc2 AS String[10]
DIM enc3 AS String[10]
DIM fontSizeScreen AS Integer[10]
DIM fontSizePrinter AS Integer[10]
Dim enc1 As New String[10]
Dim enc2 As New String[10]
Dim enc3 As New String[10]
Dim fontSizeScreen As New Integer[10]
Dim fontSizePrinter As New Integer[10]
DIM first6 AS String ' encoding for first 6: l-code(1), g-code(2)
DIM j AS Integer
DIM l AS Integer
DIM k AS Integer
DIM frst AS Integer 'the first digit
DIM num AS Integer 'each digit in turn
DIM bars AS String ' the bars for the digit
DIM thkns AS Integer 'thickness of each bar
DIM LinePos AS Integer 'used to horizontaly locate the next bar
Dim first6 As String ' encoding for first 6: l-code(1), g-code(2)
Dim j As Integer
Dim l As Integer
Dim k As Integer
Dim frst As Integer 'the first digit
Dim num As Integer 'each digit in turn
Dim bars As String ' the bars for the digit
Dim thkns As Integer 'thickness of each bar
Dim LinePos As Integer 'used to horizontaly locate the next bar
'
structure = ["111111", "112122", "112212", "112221", "121122", "122112", "122211", "121212", "121221", "122121"]
@ -31,68 +31,68 @@ PUBLIC SUB PrintBarcode(bcode AS String, posX AS Integer, posY AS Integer, bcHei
first6 = structure[frst]
'draw 1st 2 deep bars-----------------------------------------------
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(l + posX, 1 + posY, l + posX, bcHeight * 1.2 + posY)
NEXT
Next
LinePos = LinePos + barThickness * 2 'allows for following gap
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(LinePos + l + posX, 1 + posY, LinePos + l + posX, bcHeight * 1.2 + posY)
NEXT
Next
LinePos = LinePos + barThickness
'---------------------------------------------------------------
FOR j = 2 TO 13 'loop through each of the 12 digits
For j = 2 To 13 'loop through each of the 12 digits
num = Val(Mid$(bcode, j, 1)) 'find the individual number IN the first 6
IF j < 8 THEN 'different for first 6
IF Val(Mid(first6, j - 1, 1)) = 1 THEN 'find the bars making up that number (L,G or R)
If j < 8 Then 'different for first 6
If Val(Mid(first6, j - 1, 1)) = 1 Then 'find the bars making up that number (L,G or R)
bars = enc1[num]
ELSE
Else
bars = enc2[num]
ENDIF
ELSE
Endif
Else
bars = enc3[num]
ENDIF
Endif
'put the 2 middle deep bars----------------------------------------
IF j = 8 THEN
If j = 8 Then
LinePos = LinePos + barThickness
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(linepos + l + posX, 1 + posY, linepos + l + posX, bcHeight * 1.2 + posY)
NEXT
Next
LinePos = LinePos + barThickness * 2 'allows for following gap
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(LinePos + l + posX, 1 + posY, LinePos + l + posX, bcHeight * 1.2 + posY)
NEXT
Next
LinePos = LinePos + barThickness * 2 'allows for following gap
ENDIF
Endif
'---------------------------------------------------------------
FOR k = 1 TO 7 'draw bars for single digit
IF Mid(bars, k, 1) = "1" THEN
FOR l = 1 TO barThickness
For k = 1 To 7 'draw bars for single digit
If Mid(bars, k, 1) = "1" Then
For l = 1 To barThickness
Draw.Line(linepos + l + posX, 1 + posY, LinePos + l + posX, bcHeight + posY)
NEXT
ENDIF
Next
Endif
linepos = LinePos + barThickness
NEXT
NEXT
Next
Next
'draw last 2 deep bars------------------------------------------------
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(linepos + l + posX, 1 + posY, linepos + l + posX, bcHeight * 1.2 + posY)
NEXT
Next
LinePos = LinePos + barThickness * 2 'allows for following gap
FOR l = 1 TO barThickness
For l = 1 To barThickness
Draw.Line(LinePos + l + posX, 1 + posY, LinePos + l + posX, bcHeight * 1.2 + posY)
NEXT
Next
'---------------------------------------------------------------
'write the barcode text
IF SorP THEN
If SorP Then
Draw.Font.Size = fontSizeScreen[barThickness - 1]
ELSE
Else
Draw.Font.Size = fontSizePrinter[barThickness - 1]
ENDIF
Endif
Draw.Text(Left(bcode, 1), posX - barThickness * 6, posY + bcHeight * 1.02)
Draw.Text(Mid(bcode, 2, 6), posX + barThickness * 9, posY + bcHeight * 1.02)
Draw.Text(Right(bcode, 6), posX + barThickness * 58, posY + bcHeight * 1.02)
END
End

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2606)
# Compiled with Gambas 2.99.0 (r2921)
Title=Concéntrese Geográfico
Startup=principal
Icon=imagenes/logo.png

View file

@ -12,7 +12,9 @@ SearchComment=False
SearchString=True
[OpenFile]
Count=0
Active=1
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/Concent/.src/funciones.module:8.38"
Count=1
[Watches]
Count=0

View file

@ -3,38 +3,38 @@
'Arreglos para guardar info de las imagenes a cargar y el estado de los botones
'................................................................................
'Arrays for save images information to load.
PRIVATE botones_numero_foticos[64] AS Integer 'Almacena el numero de foto (indice) que llevara cada botoncito al descubrirse
Private botones_numero_foticos As New Integer[64] 'Almacena el numero de foto (indice) que llevara cada botoncito al descubrirse
'Almacenate the image number (index).
PRIVATE boton_lleno[64] AS Boolean 'para especificar si un boton ya recibio asignacion de fotico
Private boton_lleno As New Boolean[64] 'para especificar si un boton ya recibio asignacion de fotico
'Specify if a button have a image asigned
'Variables de juego
PUBLIC jugadas AS Integer 'contador del numero de jugadas durante una partida (counter for number of movements)
PUBLIC tiempo AS Integer 'contador del numero de segundos durante una partida (counter for game time)
PUBLIC aciertos AS Integer 'Contar el numero de aciertos del jugador, es decir, cada vez que el jugador logra en una misma
Public jugadas As Integer 'contador del numero de jugadas durante una partida (counter for number of movements)
Public tiempo As Integer 'contador del numero de segundos durante una partida (counter for game time)
Public aciertos As Integer 'Contar el numero de aciertos del jugador, es decir, cada vez que el jugador logra en una misma
'jugada encontrar dos botones con el mismo dibujito
'..............................................................................................
'Count the acerts for player.
PUBLIC num_movimiento_actual AS Integer 'Siempre tendra valor de 0, o 1. se usa para saber si el jugador ya destapo un boton el turno actual
Public num_movimiento_actual As Integer 'Siempre tendra valor de 0, o 1. se usa para saber si el jugador ya destapo un boton el turno actual
'es decir, una jugada consta de dos movimientos
'..................................................................................
'Controle the set of button moved in a movement
PUBLIC SUB distrib(tam_tablero AS Integer, tam_botones AS Integer)
DIM i AS Integer
DIM j AS Integer
DIM izq AS Integer
DIM arr AS Integer
DIM pos AS Integer
Public Sub distrib(tam_tablero As Integer, tam_botones As Integer)
Dim i As Integer
Dim j As Integer
Dim izq As Integer
Dim arr As Integer
Dim pos As Integer
izq = (principal.Width - tam_botones * tam_tablero) / 2
arr = (principal.Height - tam_botones * tam_tablero) / 2
pos = 0
FOR I = 0 TO tam_tablero - 1
FOR J = 0 TO tam_tablero - 1
principal.botones[pos].visible = TRUE
For I = 0 To tam_tablero - 1
For J = 0 To tam_tablero - 1
principal.botones[pos].visible = True
principal.botones[pos].width = tam_botones
principal.botones[pos].height = tam_botones
principal.botones[pos].x = izq
@ -47,35 +47,35 @@ PUBLIC SUB distrib(tam_tablero AS Integer, tam_botones AS Integer)
'principal.botones[pos].enabled=TRUE
izq = izq + tam_botones
pos = pos + 1
NEXT
Next
arr = arr + tam_botones
izq = (principal.Width - tam_botones * tam_tablero) / 2
NEXT
Next
'Se ocultan los botones que no sean necesarios de acuerdo al nivel
'de juego, esto pasa cuando se ha jugado en un nivel superior y
'luego se vuelve hacia un nivel inferior
'..................................................................
'The not necesary button are oculted
FOR I = tam_tablero * tam_tablero TO 63
principal.botones[pos].visible = FALSE
For I = tam_tablero * tam_tablero To 63
principal.botones[pos].visible = False
pos = pos + 1
NEXT
Next
'se asigna false al array boton_lleno para iniciar una nueva asignacion de foticos
'..................................................................................
'The state for each button is restored, it is for permit movement with each button
FOR I = 0 TO 63
boton_lleno[I] = FALSE
NEXT
For I = 0 To 63
boton_lleno[I] = False
Next
'Se cargan las imagenes en cada botoncito
'.........................................
'Load image for each button
repartir(tam_tablero * tam_tablero)
END
End
'Este procedimiento busca en el directorio imagenes para capturar los
@ -94,12 +94,12 @@ END
'END
PUBLIC SUB repartir(tam_tablero AS Integer)
DIM i AS Integer
DIM j AS Integer
DIM aleatorio AS Integer
DIM aleatorio1 AS Integer
DIM listo AS Boolean 'Bandera para informar cuando se encuentre un boton libre para asignacion
Public Sub repartir(tam_tablero As Integer)
Dim i As Integer
Dim j As Integer
Dim aleatorio As Integer
Dim aleatorio1 As Integer
Dim listo As Boolean 'Bandera para informar cuando se encuentre un boton libre para asignacion
'Variable for controlate the flow in nex loop
'Ciclar la mitad de la dimension para ubicar las imagenes en cada boton, se cicla la mitad ya que cada imagen
@ -108,32 +108,32 @@ PUBLIC SUB repartir(tam_tablero AS Integer)
'numero se guarda en el arreglo botones_numero_foticos[64].
'..............................................................................................................
'This For loop permit locate the images in each button
FOR i = 0 TO Int(tam_tablero - 1) / 2
For i = 0 To Int(tam_tablero - 1) / 2
aleatorio = Int(Rnd() * 40) 'se obtiene un numero entre (0, 39) que es el rango de indices del array botones_foticos
'Obtain a random number in 0-39 range (there is 40 images for use)
'IF aleatorio = 40 THEN message ("salio un numero malo")
'en cada ciclo se ubica dos veces la misma fotico en dos cuadros aleatorios
'..........................................................................
'For each loop a image is locate at two times
FOR j = 0 TO 1
listo = FALSE
WHILE listo = FALSE 'se anida este ciclo para forzar la busqueda de dos cuadritos que no hayan sido asignados
For j = 0 To 1
listo = False
While listo = False 'se anida este ciclo para forzar la busqueda de dos cuadritos que no hayan sido asignados
'This loop is nested for force the search
aleatorio1 = Int(Rnd() * tam_tablero) 'se busca un indice en el rango (0, tam_tablero)
'An index in 0,tam_table range is searched
IF (boton_lleno[aleatorio1]) = FALSE THEN 'se verifica que el boton no tenga fotico asignada
If (boton_lleno[aleatorio1]) = False Then 'se verifica que el boton no tenga fotico asignada
'Verify the button for stablish it is free
botones_numero_foticos[aleatorio1] = aleatorio
boton_lleno[aleatorio1] = TRUE
listo = TRUE
boton_lleno[aleatorio1] = True
listo = True
'ACTIVAR LA LINEA SIGUIENTE PARA DEPURACION, ENTONCES SE PODRA VER LA IMAGEN OCULTA DE LOS BOTONES
'principal.botones[aleatorio1].picture=principal.botones_foticos[aleatorio].picture
END IF
WEND
End If
Wend
NEXT
Next
NEXT
Next
'Se inicializan las variables de juego
'....................................
@ -143,18 +143,18 @@ PUBLIC SUB repartir(tam_tablero AS Integer)
aciertos = 0
num_movimiento_actual = 0
END
End
'Se hace necesario este metodo para notificar al formulario principal sobre cual imagen debe colocar en un botoncito
'al ser descubierto, esto debido a que el arreglo botones_numero_foticos[] es pridado en este modulo
PUBLIC FUNCTION devolver_indice_defotico(tag AS Integer) AS Integer
RETURN botones_numero_foticos[tag]
END
Public Function devolver_indice_defotico(tag As Integer) As Integer
Return botones_numero_foticos[tag]
End
'Devuelve un valor booleano indicando si los dos movimientos de una jugada son validos
PUBLIC FUNCTION comparar_botones_jugados(btjugado1 AS Integer, btjugado2 AS Integer) AS Boolean
RETURN botones_numero_foticos[btjugado1] = botones_numero_foticos[btjugado2]
END
Public Function comparar_botones_jugados(btjugado1 As Integer, btjugado2 As Integer) As Boolean
Return botones_numero_foticos[btjugado1] = botones_numero_foticos[btjugado2]
End

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2851)
# Compiled with Gambas 2.99.0 (r2921)
Title=GNUBoxWorld
Startup=FMain
Icon=logo.png

View file

@ -11,7 +11,7 @@
Public Game As GameBoard
Public level As Integer
Public PicturesBoxes As PictureBox[10, 11]
Public PicturesBoxes As New PictureBox[10, 11]
Public PictureBoxPlayer As PictureBox
Public PictureBoxMover As PictureBox
Public DesX As Integer

View file

@ -10,7 +10,7 @@
Public RowPlayer As Integer
Public ColPlayer As Integer
Public Cells As Cell[10, 11]
Public Cells As New Cell[10, 11]
'See below constructor

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2716)
# Compiled with Gambas 2.99.0 (r2921)
Title=Game of Life
Startup=FMain
Icon=glob2-icon-48x48.png

View file

@ -18,9 +18,9 @@ SearchComment=False
SearchString=True
[OpenFile]
Active=1
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/CGameField.class:26.12"
File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/FMain.class:23.9"
Active=2
File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/FMain.class:41.0"
File[3]="/home/benoit/gambas/3.0/link/share/gambas3/examples/Games/GameOfLife/.src/FMain.form"
Count=3

View file

@ -37,8 +37,8 @@ End
Public Sub tmrEvolution_Timer()
Dim Live As Boolean[9]
Dim Keep As Boolean[9]
Dim Live As New Boolean[9]
Dim Keep As New Boolean[9]
If Not togEvolution.Value Then Return

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2606)
# Compiled with Gambas 2.99.0 (r2921)
Title=Puzzle 1 to 8
Startup=FMain
Icon=logo.png

View file

@ -37,7 +37,7 @@
'isInvalid---> Compara un determinado casillero, segun su parametro, con sus casilleros vecinos. Devuelve true si hay conflicto
'isWin---> Verifica si todos los casilleros tienen un valor correcto, si todos son correctos y no hay ninguno vacio devuelve true.
Public Boxes As Casillero[9]
Public Boxes As New Casillero[9]
Public Sub _new()
Dim i As Integer

View file

@ -1,9 +1,9 @@
# Gambas Project File 3.0
# Compiled with Gambas 2.99.0 (r2606)
# Compiled with Gambas 2.99.0 (r2921)
Title=PDF Presentation
Startup=MMain
Icon=icon.png
Version=2.19.0
Version=2.20.2
VersionProgram=gbx2 -V
Component=gb.image
Component=gb.qt4

View file

@ -25,12 +25,12 @@ SearchComment=False
SearchString=True
[OpenFile]
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/FMain.form"
File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/MMain.module:8.7"
File[3]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/FMain.class:101.16"
File[4]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/Form1.form"
File[1]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/MMain.module:8.7"
File[2]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/FMain.class:101.16"
File[3]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/Form1.form"
File[4]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/CpdfPresentation.class:49.13"
Active=5
File[5]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/CpdfPresentation.class:236.63"
File[5]="/home/benoit/gambas/3.0/link/share/gambas3/examples/OpenGL/PDFPresentation/.src/FMain.form"
Count=5
[Watches]

View file

@ -48,7 +48,7 @@ Private ZoomFactor As Float = 1.0
Private GotoZoomFactor As Float = ZoomFactor
' flag values
Private points[45, 45, 3] As Float
Private points As New Float[45, 45, 3]
Private hold As Float
Private wiggle_count As Integer
Private DrawFlag As Boolean = False

View file

@ -2,19 +2,17 @@
{ Form Form
MoveScaled(0,0,94,64)
Text = ("")
Arrangement = Arrange.Vertical
Spacing = 8
Spacing = True
Padding = 8
{ panSelect HBox
MoveScaled(0,0,75,4)
AutoResize = True
Spacing = 8
Spacing = True
{ txtPath TextBox
MoveScaled(0,0,54,4)
Background = Color.ButtonBackground
Expand = True
Text = ("")
ReadOnly = True
}
{ btnPath Button
@ -23,11 +21,10 @@
}
}
{ glaPresentation GlArea
MoveScaled(6,9,62,43)
MoveScaled(6,9,59,39)
Expand = True
}
{ timUpdate #Timer
#X = 518
#Y = 224
#MoveScaled(78,18)
}
}

View file

@ -1,5 +1,5 @@
# Gambas Form File 3.0
{ Form1 Form
MoveScaled(0, 0, 68, 64)
{ Form Form
MoveScaled(0,0,68,64)
}

View file

@ -479,7 +479,7 @@ int CLASS_get_array_class(CLASS *class, int type, int value)
{
static char *names[] = {
NULL, "Boolean[]", "Byte[]", "Short[]", "Integer[]", "Long[]", "Single[]", "Float[]",
"Date[]", "String[]", "String[]", "Variant[]", NULL, NULL, NULL, NULL, "Object[]"
"Date[]", "String[]", "String[]", "Pointer[]", "Variant[]", NULL, NULL, NULL, "Object[]"
};
int index;

View file

@ -1,22 +1,22 @@
/***************************************************************************
gbc_class.h
gbc_class.h
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
@ -31,139 +31,140 @@
#define FUNC_INIT_DYNAMIC 1
typedef
struct {
TYPE type;
int value;
}
PACKED
CLASS_SYMBOL_INFO;
struct {
TYPE type;
int value;
}
PACKED
CLASS_SYMBOL_INFO;
typedef
struct {
SYMBOL symbol;
CLASS_SYMBOL_INFO global;
CLASS_SYMBOL_INFO local;
int class;
int unknown;
unsigned used : 1;
unsigned _reserved : 31;
}
PACKED
CLASS_SYMBOL;
struct {
SYMBOL symbol;
CLASS_SYMBOL_INFO global;
CLASS_SYMBOL_INFO local;
int class;
int unknown;
unsigned used : 1;
unsigned _reserved : 31;
}
PACKED
CLASS_SYMBOL;
typedef
TRANS_PARAM PARAM;
TRANS_PARAM PARAM;
typedef
struct {
TYPE type;
int index;
int pos;
int size;
}
VARIABLE;
struct {
TYPE type;
int index;
int pos;
int size;
}
VARIABLE;
typedef
struct {
int num;
int param;
}
VARIABLE_INIT;
struct {
int num;
int param;
}
VARIABLE_INIT;
typedef
struct {
TYPE type;
int index;
int value;
int line;
int64_t lvalue;
}
CONSTANT;
struct {
TYPE type;
int index;
int value;
int line;
int64_t lvalue;
}
CONSTANT;
typedef
struct {
TYPE type; // Return value datatype
int name; // Function name index in class symbol table
struct {
TYPE type; // Return value datatype
int name; // Function name index in class symbol table
char nparam; // Maximum number of arguments
char npmin; // Minimum number of arguments
char vararg; // If this function accepts extra arguments
char _reserved;
short nlocal; // Local variable count
short nctrl; // Control structure variable count
uint64_t byref; // Byref mask
PARAM *local; // Datatypes of local variables
PARAM *param; // Datatypes of arguments
char nparam; // Maximum number of arguments
char npmin; // Minimum number of arguments
char vararg; // If this function accepts extra arguments
char _reserved;
short nlocal; // Local variable count
short nctrl; // Control structure variable count
uint64_t byref; // Byref mask
PARAM *local; // Datatypes of local variables
PARAM *param; // Datatypes of arguments
PATTERN *start; // Starts compilation from there
int line; // ...which is this line
ushort *code; // Compile bytecode
short *pos_line; // Bytecode position of each code line
ushort ncode; // Number of instructions
ushort ncode_max; // Size of the bytecode allocation
PATTERN *start; // Starts compilation from there
int line; // ...which is this line
ushort *code; // Compile bytecode
short *pos_line; // Bytecode position of each code line
ushort ncode; // Number of instructions
ushort ncode_max; // Size of the bytecode allocation
short last_code; // Last compiled bytecode position
short last_code2; // Last last compiled bytecode position
short stack; // Needed stack
short finally; // FINALLY position
short catch; // CATCH position
short last_code; // Last compiled bytecode position
short last_code2; // Last last compiled bytecode position
short stack; // Needed stack
short finally; // FINALLY position
short catch; // CATCH position
short _reserved2;
}
PACKED
FUNCTION;
}
PACKED
FUNCTION;
typedef
struct {
TYPE type; /* type de la valeur de retour */
int name; /* index du nom de la fonction dans la table des symboles de la classe */
PARAM *param; /* Liste des param<61>res */
short nparam; /* nombre de param<61>res */
short _reserved;
}
PACKED
EVENT;
struct {
TYPE type; // Return value datatype
int name; // Function name index in class symbol table
PARAM *param; // Argument list
short nparam; // Number of arguments
short _reserved;
}
PACKED
EVENT;
typedef
struct {
TYPE type; /* type de la valeur de retour */
int name; /* function name index */
PARAM *param; /* Liste des param<61>res */
short nparam; /* nombre de param<61>res */
short _reserved;
int library; /* library name index */
int alias; /* library function name index */
}
PACKED
EXTFUNC;
struct {
TYPE type; // Return value datatype
int name; // Function name index in class symbol table
PARAM *param; // Argument list
short nparam; // Number of arguments
short _reserved;
int library; // Library name index
int alias; // Real function name index
}
PACKED
EXTFUNC;
typedef
struct {
TYPE type; /* property type */
int name; /* property name */
int line; /* the line where the property is declared */
int comment; /* property string description, added to datatype */
short read; /* read function */
short write; /* write function */
}
PACKED
PROPERTY;
struct {
TYPE type; // Property datatype
int name; // Property name index
int line; // The line where the property is declared
int comment; // Property string description, added to datatype
short read; // Read function
short write; // Write function
}
PACKED
PROPERTY;
typedef
struct {
TYPE type; /* Type du tableau */
int ndim; /* nombre de dimensions */
int dim[MAX_ARRAY_DIM]; /* dimensions du tableau */
}
CLASS_ARRAY;
struct {
TYPE type; /* Type du tableau */
int ndim; /* nombre de dimensions */
int dim[MAX_ARRAY_DIM]; /* dimensions du tableau */
}
CLASS_ARRAY;
typedef
struct {
int nfield; /* nombre de champs dans la structure */
VARIABLE *field; /* champs de la structure */
}
CLASS_STRUCT;
struct {
TYPE type;
int nfield; /* nombre de champs dans la structure */
VARIABLE *field; /* champs de la structure */
}
CLASS_STRUCT;
typedef
struct {
@ -174,32 +175,32 @@ typedef
CLASS_REF;
typedef
struct {
TABLE *table; /* symbol table */
TABLE *string; /* strings table */
char *name; /* class name */
short parent; /* parent class */
unsigned exported : 1; /* class is exported */
unsigned autocreate : 1; /* class is auto-creatable */
unsigned optional : 1; /* class is optional */
unsigned nocreate : 1; /* class cannot be instanciated */
unsigned _reserved : 12;
VARIABLE *stat; /* static variables */
VARIABLE *dyn; /* dynamic variables */
CONSTANT *constant; /* constants */
CLASS_REF *class; /* classes */
int *unknown; /* unknown symbols */
FUNCTION *function; /* functions */
int size_stat; /* static variables total size */
int size_dyn; /* dynamic variables total size */
EVENT *event; /* events */
PROPERTY *prop; /* properties */
EXTFUNC *ext_func; /* extern functions */
CLASS_ARRAY *array; /* array definitions */
CLASS_STRUCT *structure; /* structs definitions */
char **names; /* when some symbols must be created like object arrays */
}
CLASS;
struct {
TABLE *table; /* symbol table */
TABLE *string; /* strings table */
char *name; /* class name */
short parent; /* parent class */
unsigned exported : 1; /* class is exported */
unsigned autocreate : 1; /* class is auto-creatable */
unsigned optional : 1; /* class is optional */
unsigned nocreate : 1; /* class cannot be instanciated */
unsigned _reserved : 12;
VARIABLE *stat; /* static variables */
VARIABLE *dyn; /* dynamic variables */
CONSTANT *constant; /* constants */
CLASS_REF *class; /* classes */
int *unknown; /* unknown symbols */
FUNCTION *function; /* functions */
int size_stat; /* static variables total size */
int size_dyn; /* dynamic variables total size */
EVENT *event; /* events */
PROPERTY *prop; /* properties */
EXTFUNC *ext_func; /* extern functions */
CLASS_ARRAY *array; /* array definitions */
CLASS_STRUCT *structure; /* structs definitions */
char **names; /* when some symbols must be created like object arrays */
}
CLASS;
#define CLASS_get_symbol(class, ind) ((CLASS_SYMBOL *)TABLE_get_symbol((class)->table, ind))

View file

@ -198,7 +198,7 @@ static void header_module_type(void)
static bool header_event(TRANS_EVENT *event)
{
PATTERN *look = JOB->current;
TRANS_DECL ttyp;
//TRANS_DECL ttyp;
if (!PATTERN_is(*look, RS_EVENT))
return FALSE;
@ -211,12 +211,12 @@ static bool header_event(TRANS_EVENT *event)
JOB->current++;
analyze_function_desc((TRANS_FUNC *)event, HF_VOID);
if (PATTERN_is(*JOB->current, RS_AS))
/*if (PATTERN_is(*JOB->current, RS_AS))
{
if (!TRANS_type(TT_CAN_SQUARE, &ttyp))
THROW("Syntax error in return type");
event->type = ttyp.type;
}
}*/
TYPE_set_kind(&event->type, TK_EVENT);
TYPE_set_flag(&event->type, TF_PUBLIC);
@ -280,7 +280,7 @@ static bool header_property(TRANS_PROPERTY *prop)
prop->index = PATTERN_index(*JOB->current);
JOB->current++;
if (!TRANS_type(TT_CAN_SQUARE, &ptype))
if (!TRANS_type(TT_NOTHING, &ptype))
THROW("Syntax error. Bad property type");
prop->type = ptype.type;
@ -338,7 +338,7 @@ static bool header_extern(TRANS_EXTERN *trans)
if (PATTERN_is(*JOB->current, RS_AS))
{
if (!TRANS_type(TT_CAN_SQUARE, &ttyp))
if (!TRANS_type(TT_NOTHING, &ttyp))
THROW("Syntax error in return type");
trans->type = ttyp.type;
}
@ -440,7 +440,7 @@ static bool header_declaration(TRANS_DECL *decl)
save = JOB->current;
JOB->current = look;
if (!TRANS_type(((!is_const && !is_public) ? (TT_CAN_SQUARE | TT_CAN_ARRAY) : 0) | TT_CAN_NEW, decl))
if (!TRANS_type((!is_const ? TT_CAN_ARRAY | TT_CAN_STATIC : 0) | TT_CAN_NEW, decl))
{
JOB->current = save;
return FALSE;
@ -593,7 +593,7 @@ static bool header_function(TRANS_FUNC *func)
//if (!is_proc)
if (PATTERN_is(*JOB->current, RS_AS))
{
if (!TRANS_type(TT_CAN_SQUARE, &ttyp))
if (!TRANS_type(TT_NOTHING, &ttyp))
THROW("Syntax error. Invalid return type");
func->type = ttyp.type;
is_proc = FALSE;

View file

@ -322,36 +322,23 @@ __END:
}
static PATTERN *trans_square(PATTERN *look, int mode, TRANS_DECL *result)
static PATTERN *trans_static_array(PATTERN *look, int mode, TRANS_DECL *result)
{
TRANS_NUMBER tnum;
int i;
if (!(mode & TT_CAN_SQUARE))
if (!(mode & TT_CAN_STATIC))
{
if (PATTERN_is(*look, RS_LSQR))
THROW("Arrays are forbidden here");
THROW("Static arrays are forbidden here");
return look;
}
if (!PATTERN_is(*look, RS_LSQR))
return look;
/*
if (result->is_array)
THROW("Syntax error. Duplicated array declaration");
*/
look++;
/*
if (PATTERN_is(*look, RS_RSQR))
{
look++;
return look;
}
*/
if (mode && TT_CAN_ARRAY)
{
for (i = 0;; i++)
@ -440,7 +427,7 @@ bool TRANS_type(int mode, TRANS_DECL *result)
result->init = NULL;
result->array.ndim = 0;
//look = trans_square(look, mode, result);
look = trans_static_array(look, mode, result);
if (!PATTERN_is(*look, RS_AS))
{
@ -457,7 +444,7 @@ bool TRANS_type(int mode, TRANS_DECL *result)
if (PATTERN_is(*look, RS_NEW))
{
if (TYPE_get_id(result->type) == T_ARRAY)
THROW("Cannot mix NEW and array declaration");
THROW("Cannot mix NEW and static array declaration");
result->is_new = TRUE;
look++;
@ -489,7 +476,7 @@ bool TRANS_type(int mode, TRANS_DECL *result)
if ((mode & TT_CAN_NEW) && result->is_new)
{
if (TYPE_get_id(result->type) == T_ARRAY)
THROW("Cannot mix NEW and array declaration");
THROW("Cannot mix NEW and static array declaration");
//result->is_new = TRUE;
result->init = look;

View file

@ -33,7 +33,7 @@
enum {
TT_NOTHING = 0,
TT_DO_NOT_CHECK_AS = 1,
TT_CAN_SQUARE = 2,
TT_CAN_STATIC = 2,
TT_CAN_ARRAY = 4,
TT_CAN_NEW = 8
};

View file

@ -111,8 +111,8 @@ static bool TRANS_local(void)
}
f = TT_DO_NOT_CHECK_AS | TT_CAN_ARRAY | TT_CAN_NEW;
if (!many)
f |= TT_CAN_SQUARE;
//if (!many)
// f |= TT_CAN_SQUARE;
if (!TRANS_type(f, &decl))
THROW(E_SYNTAX);

View file

@ -149,8 +149,8 @@ char *TYPE_get_desc(TYPE type)
const char *TYPE_get_short_desc(TYPE type)
{
static const char *name[] = {
"", "b", "i", "i", "i", "l", "g", "f", "d",
"s", "s", "v", "?", "p", "?", "?",
"", "b", "i", "i", "i", "l", "g", "f",
"d", "s", "s", "p", "v", "?", "?", "?",
"o"
};

View file

@ -57,7 +57,6 @@ gbx3_SOURCES = \
gbx_string.h gbx_string.c \
gbx_variant.h \
gbx_date.h gbx_date.c \
gbx_array.h gbx_array.c \
gbx_c_class.h gbx_c_class.c \
gbx_c_collection.h gbx_c_collection.c \
gbx_c_error.h gbx_c_error.c \
@ -70,7 +69,6 @@ gbx3_SOURCES = \
gbx_c_string.h gbx_c_string.c \
gbx_component.h gbx_component.c \
gbx_extern.h gbx_extern.c \
gbx_print.h gbx_print.c \
gbx_c_enum.h gbx_c_enum.c \
gbx_c_timer.h gbx_c_timer.c

View file

@ -40,7 +40,7 @@ bool ERROR_backtrace = FALSE;
static int _lock = 0;
static const char *_message[66] =
static const char *_message[67] =
{
/* 0 E_UNKNOWN */ "Unknown error",
/* 1 E_MEMORY */ "Out of memory",
@ -107,6 +107,7 @@ static const char *_message[66] =
/* 62 E_BYREF */ "Argument cannot be passed by reference",
/* 63 E_OVERRIDE */ ".3'&1.&2' is badly overridden in class '&3'",
/* 64 E_NKEY */ "Void key",
/* 65 E_SARRAY */ "Static array",
NULL
};

View file

@ -97,7 +97,8 @@ enum {
E_EXTSYM,
E_BYREF,
E_OVERRIDE,
E_VKEY
E_VKEY,
E_SARRAY
};
typedef

View file

@ -46,7 +46,6 @@
#include "gbx_object.h"
#include "gbx_string.h"
#include "gbx_date.h"
#include "gbx_print.h"
#include "gbx_regexp.h"
#include "gbx_c_array.h"
#include "gbx_c_timer.h"
@ -198,9 +197,6 @@ void *GAMBAS_Api[] =
(void *)ARRAY_insert_many,
(void *)ARRAY_remove_many,
(void *)GB_PrintData,
(void *)PRINT_string,
(void *)GB_SubCollectionNew,
(void *)GB_SubCollectionAdd,
(void *)GB_SubCollectionRemove,
@ -1008,7 +1004,7 @@ void GB_Return(GB_TYPE type, ...)
{
static void *jump[16] = {
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__STRING, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__CLASS, &&__NULL
&&__STRING, &&__STRING, &&__POINTER, &&__VARIANT, &&__FUNCTION, &&__CLASS, &&__NULL
};
VALUE *ret = &TEMP;
@ -1068,6 +1064,11 @@ __OBJECT:
ret->_object.object = va_arg(args, void *);
goto __CONV;
__POINTER:
ret->_pointer.value = va_arg(args, void *);
goto __CONV;
__CLASS:
ret->_class.class = va_arg(args, CLASS *);
goto __CONV;
@ -1076,7 +1077,6 @@ __CONV:
__STRING:
__VOID:
__VARIANT:
__ARRAY:
__FUNCTION:
__NULL:
return;
@ -1843,15 +1843,6 @@ void GB_BrowseProject(GB_BROWSE_CALLBACK func)
}
void GB_PrintData(GB_TYPE type, void *addr)
{
VALUE value;
VALUE_read(&value, addr, (TYPE)type);
PRINT_value(&value);
}
const char *GB_CurrentComponent()
{
ARCHIVE *arch;

View file

@ -176,14 +176,6 @@ void GB_SubCollectionRemove(void *_object, const char *key, int len);
void *GB_SubCollectionContainer(void *_object);
void *GB_SubCollectionGet(void *_object, const char *key, int len);
void GB_PrintData(GB_TYPE type, void *addr);
/*int GB_ImageCreate(GB_IMAGE *image, void *data, int width, int height, int format);
void GB_ImageInfo(GB_IMAGE image, GB_IMAGE_INFO *info);
void GB_ImageConvert(void *dst, int dst_format, void *src, int src_format, int w, int h);
int GB_PictureCreate(GB_PICTURE *picture, void *data, int width, int height, int format);
void GB_PictureInfo(GB_PICTURE picture, GB_PICTURE_INFO *info);*/
void *GB_DebugGetClass(const char *name);
void *GB_DebugGetExec(void);

View file

@ -1,153 +0,0 @@
/***************************************************************************
gbx_array.c
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __GB_ARRAY_C
#include "gb_common.h"
#include "gb_error.h"
#include "gbx_api.h"
#include "gambas.h"
#include "gbx_class.h"
#include "gbx_exec.h"
#include "gbx_array.h"
size_t ARRAY_get_size(ARRAY_DESC *desc)
{
ssize_t size;
int i;
size = 1;
for (i = 0;; i++)
{
size *= desc->dim[i];
if (size < 0)
{
size = (-size);
break;
}
}
size *= TYPE_sizeof_memory(desc->type.id);
return (size_t)size;
}
void ARRAY_new(void **data, ARRAY_DESC *desc)
{
ALLOC_ZERO(data, ARRAY_get_size(desc), "ARRAY_new");
}
void ARRAY_free_data(void *data, ARRAY_DESC *desc)
{
ssize_t size;
intptr_t i;
char *array;
size = 1;
for (i = 0;; i++)
{
size *= desc->dim[i];
if (size < 0)
{
size = (-size);
break;
}
}
array = data;
if (desc->type.id == T_STRING)
{
for (i = 0; i < size; i++)
{
STRING_unref((char **)array);
array += sizeof(char *);
}
}
else if (desc->type.id == T_OBJECT)
{
for (i = 0; i < size; i++)
{
OBJECT_UNREF(*((void **)array), "ARRAY_free_data");
array += sizeof(void *);
}
}
else if (desc->type.id == T_VARIANT)
{
for (i = 0; i < size; i++)
{
VARIANT_free((VARIANT *)array);
array += sizeof(VARIANT);
}
}
}
void ARRAY_free(void **data, ARRAY_DESC *desc)
{
if (*data == NULL)
return;
ARRAY_free_data(*data, desc);
FREE(data, "ARRAY_free");
}
void *ARRAY_get_address(ARRAY_DESC *desc, void *addr, int nparam, int *param)
{
int max;
int i;
bool stop = FALSE;
offset_t pos = 0;
for (i = 0;; i++)
{
if (i >= nparam)
THROW(E_NDIM);
max = desc->dim[i];
if (max < 0)
{
max = (-max);
stop = TRUE;
}
if (param[i] < 0 || param[i] >= max)
THROW(E_BOUND);
pos *= max;
pos += param[i];
if (stop)
break;
}
return (char *)addr + pos * TYPE_sizeof_memory(desc->type.id);
}

View file

@ -1,41 +0,0 @@
/***************************************************************************
gbx_array.h
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#ifndef __GBX_ARRAY_H
#define __GBX_ARRAY_H
#include "gbx_type.h"
typedef
struct {
CTYPE type;
int dim[0];
}
ARRAY_DESC;
size_t ARRAY_get_size(ARRAY_DESC *desc);
void ARRAY_new(void **data, ARRAY_DESC *desc);
void ARRAY_free_data(void *data, ARRAY_DESC *desc);
void ARRAY_free(void **data, ARRAY_DESC *desc);
void *ARRAY_get_address(ARRAY_DESC *desc, void *addr, int nparam, int *param);
#endif

View file

@ -41,15 +41,27 @@
#include "gbx_class.h"
#include "gbx_object.h"
#include "gbx_api.h"
#include "gbx_print.h"
#include "gbx_c_file.h"
#include "gbx_c_array.h"
static bool _create_static_array;
static void THROW_static_array()
{
GB_Error((char *)E_SARRAY);
return;
}
static bool check_not_multi(CARRAY *_object)
{
if (THIS->dim)
if (THIS->ref)
{
THROW_static_array();
return TRUE;
}
else if (THIS->dim)
{
GB_Error("Array is multi-dimensional");
return TRUE;
@ -58,6 +70,7 @@ static bool check_not_multi(CARRAY *_object)
return FALSE;
}
static int get_dim(CARRAY *_object)
{
int d;
@ -74,10 +87,11 @@ static int get_dim(CARRAY *_object)
}
}
static int get_bound(CARRAY *_object, int d)
{
if (!THIS->dim)
return ARRAY_count(THIS);
return THIS->count;
else
{
d = THIS->dim[d];
@ -89,21 +103,41 @@ static int get_bound(CARRAY *_object, int d)
}
static CLASS *get_array_class(TYPE type)
{
CLASS *class;
if (TYPE_is_pure_object(type))
class = CLASS_get_array_class((CLASS *)type);
else
{
switch(type)
{
case GB_T_BOOLEAN: class = CLASS_BooleanArray; break;
case GB_T_BYTE: class = CLASS_ByteArray; break;
case GB_T_SHORT: class = CLASS_ShortArray; break;
case GB_T_INTEGER: class = CLASS_IntegerArray; break;
case GB_T_LONG: class = CLASS_LongArray; break;
case GB_T_SINGLE: class = CLASS_SingleArray; break;
case GB_T_FLOAT: class = CLASS_FloatArray; break;
case GB_T_STRING: class = CLASS_StringArray; break;
case GB_T_DATE: class = CLASS_DateArray; break;
case GB_T_OBJECT: class = CLASS_ObjectArray; break;
case GB_T_POINTER: class = CLASS_PointerArray; break;
default: class = CLASS_VariantArray; break;
}
}
return class;
}
void *CARRAY_out_of_bound()
{
GB_Error((char *)E_BOUND);
return NULL;
}
// static void *get_data(CARRAY *_object, int index)
// {
// if ((index < 0) || (index >= ARRAY_count(THIS->data)))
// {
// return NULL;
// }
//
// return (void *)((char *)(THIS->data) + index * TYPE_sizeof_memory(THIS->type));
// }
#define get_data_multi CARRAY_get_data_multi
#define get_data CARRAY_get_data
@ -168,7 +202,7 @@ void *CARRAY_get_data_multi(CARRAY *_object, GB_INTEGER *arg, int nparam)
index = arg->value;
if ((index < 0) || (index >= ARRAY_count(THIS->data)))
if ((index < 0) || (index >= THIS->count))
{
GB_Error((char *)E_BOUND);
return NULL;
@ -179,6 +213,51 @@ void *CARRAY_get_data_multi(CARRAY *_object, GB_INTEGER *arg, int nparam)
}
static int get_count(int *dim)
{
int i, size;
size = 1;
for (i = 0;; i++)
{
size *= dim[i];
if (size < 0)
{
size = (-size);
break;
}
}
return size;
}
size_t CARRAY_get_static_size(CLASS_ARRAY *desc)
{
return (size_t)get_count(desc->dim) * TYPE_sizeof_memory(desc->type);
}
CARRAY *CARRAY_create_static(void *ref, CLASS_ARRAY *desc, void *data)
{
CARRAY *array;
_create_static_array = TRUE;
OBJECT_create(POINTER(&array), get_array_class(desc->type), NULL, NULL, 0);
_create_static_array = FALSE;
array->type = desc->type;
array->data = data;
array->ref = ref;
array->count = get_count(desc->dim);
GB_Ref(ref);
array->dim = desc->dim;
return array;
}
static void release_one(CARRAY *_object, int i)
{
if (THIS->type == T_STRING)
@ -195,7 +274,7 @@ static void release(CARRAY *_object, int start, int end)
int i;
if (end < 0)
end = ARRAY_count(THIS->data);
end = THIS->count;
if (THIS->type == T_STRING)
{
@ -220,7 +299,7 @@ static void borrow(CARRAY *_object, int start, int end)
int i;
if (end < 0)
end = ARRAY_count(THIS->data);
end = THIS->count;
if (THIS->type == T_STRING)
{
@ -242,21 +321,29 @@ static void borrow(CARRAY *_object, int start, int end)
static void clear(CARRAY *_object)
{
if (THIS->ref)
{
THROW_static_array();
return;
}
release(THIS, 0, -1);
if (THIS->dim)
{
memset(THIS->data, 0, TYPE_sizeof_memory(THIS->type) * ARRAY_count(THIS->data));
memset(THIS->data, 0, TYPE_sizeof_memory(THIS->type) * THIS->count);
}
else
{
ARRAY_delete(&THIS->data);
ARRAY_create_with_size(&THIS->data, TYPE_sizeof_memory(THIS->type), 8);
THIS->count = 0;
}
}
static void *insert(CARRAY *_object, int index)
{
THIS->count++;
return ARRAY_insert(&THIS->data, index);
}
@ -277,41 +364,17 @@ BEGIN_METHOD(CARRAY_new, GB_INTEGER size)
GB_INTEGER *sizes = ARG(size);
int nsize = GB_NParam() + 1;
int i;
if (_create_static_array)
return;
klass = OBJECT_class(THIS);
if (klass == CLASS_IntegerArray)
type = T_INTEGER;
else if (klass == CLASS_ShortArray)
type = T_SHORT;
else if (klass == CLASS_BooleanArray)
type = T_BOOLEAN;
else if (klass == CLASS_ByteArray)
type = T_BYTE;
else if (klass == CLASS_LongArray)
type = T_LONG;
else if (klass == CLASS_SingleArray)
type = T_SINGLE;
else if (klass == CLASS_FloatArray)
type = T_FLOAT;
else if (klass == CLASS_DateArray)
type = T_DATE;
else if (klass == CLASS_StringArray)
type = T_STRING;
else if (klass == CLASS_VariantArray)
type = T_VARIANT;
else if (klass == CLASS_PointerArray)
type = T_POINTER;
else if (klass == CLASS_ObjectArray)
type = T_OBJECT;
else
type = (TYPE)klass->array_type;
if (!type)
{
type = (TYPE)klass->array_type;
if (!type)
{
GB_Error("Bad array type");
return;
}
GB_Error("Bad array type");
return;
}
//printf("CARRAY_new: type = %d nsize = %d\n", type, nsize);
@ -367,6 +430,8 @@ BEGIN_METHOD(CARRAY_new, GB_INTEGER size)
ARRAY_add_many_void(&THIS->data, (int)size);
}
THIS->count = size;
END_METHOD
@ -379,6 +444,13 @@ END_PROPERTY
BEGIN_METHOD_VOID(CARRAY_free)
release(THIS, 0, -1);
if (THIS->ref)
{
GB_Unref(&THIS->ref);
return;
}
ARRAY_delete(&THIS->data);
if (THIS->dim)
@ -403,14 +475,14 @@ END_PROPERTY
BEGIN_PROPERTY(CARRAY_count)
GB_ReturnInt(ARRAY_count(THIS->data));
GB_ReturnInt(THIS->count);
END_PROPERTY
BEGIN_PROPERTY(CARRAY_max)
GB_ReturnInt(ARRAY_count(THIS->data) - 1);
GB_ReturnInt(THIS->count - 1);
END_PROPERTY
@ -418,7 +490,7 @@ END_PROPERTY
static bool copy_remove(CARRAY *_object, int start, int length, bool copy, bool remove)
{
CARRAY *array;
int count = ARRAY_count(THIS->data);
int count = THIS->count;
void *data;
int i, nsize;
@ -450,6 +522,7 @@ static bool copy_remove(CARRAY *_object, int start, int length, bool copy, bool
if (length > 0)
{
data = ARRAY_insert_many(&array->data, 0, length);
array->count += length;
memmove(data, get_data(THIS, start), length * TYPE_sizeof_memory(THIS->type));
borrow(array, 0, -1);
}
@ -468,6 +541,7 @@ static bool copy_remove(CARRAY *_object, int start, int length, bool copy, bool
{
release(THIS, start, start + length);
ARRAY_remove_many(&THIS->data, start, length);
THIS->count -= length;
}
if (copy)
@ -513,7 +587,7 @@ END_METHOD
BEGIN_METHOD(CARRAY_resize, GB_INTEGER size)
int size = VARG(size);
int count = ARRAY_count(THIS->data);
int count = THIS->count;
if (check_not_multi(THIS))
return;
@ -528,6 +602,8 @@ BEGIN_METHOD(CARRAY_resize, GB_INTEGER size)
ARRAY_remove_many(&THIS->data, size, count - size);
}
THIS->count = size;
END_METHOD
@ -630,7 +706,7 @@ IMPLEMENT_put(variant, VARIANT)
BEGIN_METHOD(CARRAY_fill, GB_VALUE value; GB_INTEGER start; GB_INTEGER length)
int count = ARRAY_count(THIS->data);
int count = THIS->count;
int start = VARGOPT(start, 0);
int length = VARGOPT(length, count);
int i;
@ -670,14 +746,15 @@ BEGIN_METHOD(CARRAY_insert, GB_OBJECT array; GB_INTEGER pos)
return;
}
count = ARRAY_count(array->data);
count = array->count;
if (count > 0)
{
if (pos < 0)
pos = ARRAY_count(THIS->data);
pos = THIS->count;
data = ARRAY_insert_many(&THIS->data, pos, count);
THIS->count += count;
borrow(array, 0, -1);
memmove(data, array->data, count * TYPE_sizeof_memory(THIS->type));
}
@ -689,7 +766,7 @@ END_METHOD
BEGIN_METHOD_VOID(CARRAY_pop)
int index = ARRAY_count(THIS->data) - 1;
int index = THIS->count - 1;
if (check_not_multi(THIS))
return;
@ -705,6 +782,7 @@ BEGIN_METHOD_VOID(CARRAY_pop)
BORROW(&TEMP);
release_one(THIS, index);
ARRAY_remove(&THIS->data, index);
THIS->count--;
UNBORROW(&TEMP);
END_METHOD
@ -724,7 +802,7 @@ BEGIN_METHOD_VOID(CARRAY_next)
int *index = (int *)GB_GetEnum();
if (*index >= ARRAY_count(THIS->data))
if (*index >= THIS->count)
GB_StopEnum();
else
{
@ -741,10 +819,10 @@ BEGIN_METHOD(CARRAY_sort, GB_INTEGER mode)
int mode = VARGOPT(mode, 0);
void *data = THIS->data;
if (ARRAY_count(data) > 1)
if (THIS->count > 1)
{
compare = COMPARE_get(THIS->type, mode);
qsort(data, ARRAY_count(data), TYPE_sizeof_memory(THIS->type), compare);
qsort(data, THIS->count, TYPE_sizeof_memory(THIS->type), compare);
}
GB_ReturnObject(THIS);
@ -759,10 +837,10 @@ static int find(CARRAY *_object, int mode, void *value, int start)
if (start < 0)
start = 0;
else if (start >= ARRAY_count(THIS->data))
else if (start >= THIS->count)
return (-1);
for (i = start; i < ARRAY_count(THIS->data); i++)
for (i = start; i < THIS->count; i++)
{
if ((*compare)(get_data(THIS, i), value) == 0)
return i;
@ -796,10 +874,10 @@ static int find_object(CARRAY *_object, void *value, int start)
if (start < 0)
start = 0;
else if (start >= ARRAY_count(THIS->data))
else if (start >= THIS->count)
return (-1);
for (i = 0; i < ARRAY_count(THIS->data); i++)
for (i = 0; i < THIS->count; i++)
{
if (*((void **)get_data(THIS, i)) == value)
return i;
@ -873,9 +951,9 @@ BEGIN_METHOD(CARRAY_string_join, GB_STRING sep; GB_STRING esc)
if (!lesc)
{
max = 0;
for (i = 0; i < ARRAY_count(data); i++)
for (i = 0; i < THIS->count; i++)
max += STRING_length(data[i]) + lsep;
if (ARRAY_count(data))
if (THIS->count)
max -= lsep;
STRING_start_len(max);
@ -883,7 +961,7 @@ BEGIN_METHOD(CARRAY_string_join, GB_STRING sep; GB_STRING esc)
else
STRING_start();
for (i = 0; i < ARRAY_count(data); i++)
for (i = 0; i < THIS->count; i++)
{
p = data[i];
l = STRING_length(data[i]);
@ -929,7 +1007,7 @@ BEGIN_METHOD_VOID(CARRAY_reverse)
char *buffer[16];
char *pi, *pj;
count = ARRAY_count(THIS->data);
count = THIS->count;
if (count <= 1)
return;
@ -952,7 +1030,7 @@ END_METHOD
BEGIN_METHOD(CARRAY_read, GB_OBJECT file; GB_INTEGER start; GB_INTEGER length)
int count = ARRAY_count(THIS->data);
int count = THIS->count;
int start = VARGOPT(start, 0);
int length = VARGOPT(length, count);
@ -966,7 +1044,7 @@ END_METHOD
BEGIN_METHOD(CARRAY_write, GB_OBJECT file; GB_INTEGER start; GB_INTEGER length)
int count = ARRAY_count(THIS->data);
int count = THIS->count;
int start = VARGOPT(start, 0);
int length = VARGOPT(length, count);
@ -1619,6 +1697,7 @@ void CARRAY_split(CARRAY *_object, const char *str, int lstr, const char *sep, c
add_entry();
_object->count = ARRAY_count(_object->data);
_array = NULL;
}
@ -1626,7 +1705,6 @@ void CARRAY_split(CARRAY *_object, const char *str, int lstr, const char *sep, c
void GB_ArrayNew(GB_ARRAY *array, intptr_t type, int size)
{
CLASS *class;
int np;
if (size > 0)
@ -1638,34 +1716,13 @@ void GB_ArrayNew(GB_ARRAY *array, intptr_t type, int size)
{
np = 0;
}
if (TYPE_is_pure_object(type))
class = CLASS_get_array_class((CLASS *)type);
else
{
switch(type)
{
case GB_T_BOOLEAN: class = CLASS_BooleanArray; break;
case GB_T_BYTE: class = CLASS_ByteArray; break;
case GB_T_SHORT: class = CLASS_ShortArray; break;
case GB_T_INTEGER: class = CLASS_IntegerArray; break;
case GB_T_LONG: class = CLASS_LongArray; break;
case GB_T_SINGLE: class = CLASS_SingleArray; break;
case GB_T_FLOAT: class = CLASS_FloatArray; break;
case GB_T_STRING: class = CLASS_StringArray; break;
case GB_T_DATE: class = CLASS_DateArray; break;
case GB_T_OBJECT: class = CLASS_ObjectArray; break;
case GB_T_POINTER: class = CLASS_PointerArray; break;
default: class = CLASS_VariantArray; break;
}
}
OBJECT_create((void **)array, class, NULL, NULL, np);
OBJECT_create((void **)array, get_array_class(type), NULL, NULL, np);
}
int GB_ArrayCount(GB_ARRAY array)
{
return ARRAY_count(((CARRAY *)array)->data);
return ((CARRAY *)array)->count;
}
void *GB_ArrayAdd(GB_ARRAY array)

View file

@ -30,13 +30,16 @@
#include "gbx_variant.h"
#include "gbx_object.h"
#include "gbx_type.h"
#include "gbx_class.h"
typedef
struct {
OBJECT object;
TYPE type;
void *data;
int count;
int *dim;
void *ref;
}
CARRAY;
@ -68,13 +71,15 @@ void CARRAY_get_value(CARRAY *_object, int index, VALUE *value);
#define CARRAY_invert(_array) CARRAY_reverse(_array, NULL)
void *CARRAY_get_data_multi(CARRAY *_object, GB_INTEGER *arg, int nparam);
void *CARRAY_out_of_bound();
CARRAY *CARRAY_create_static(void *ref, CLASS_ARRAY *desc, void *data);
size_t CARRAY_get_static_size(CLASS_ARRAY *desc);
#define CARRAY_get_data(_array, _index) \
({ \
int __index = (_index); \
CARRAY *__array = (CARRAY *)(_array); \
void *__data; \
if ((__index < 0) || (__index >= ARRAY_count(__array->data))) \
if ((__index < 0) || (__index >= __array->count)) \
__data = CARRAY_out_of_bound(); \
else \
__data = (void *)((char *)(__array->data) + __index * TYPE_sizeof_memory(__array->type)); \

View file

@ -361,7 +361,7 @@ int GB_CollectionGet(GB_COLLECTION col, const char *key, int len, GB_VARIANT *va
var = (VARIANT *)collection_get_key((CCOLLECTION *)col, key, len);
if (var)
{
value->type = GB_T_VARIANT;
value->type = T_VARIANT;
value->value.type = var->type;
value->value.value.data = var->value.data;
return FALSE;
@ -389,7 +389,7 @@ int GB_CollectionEnum(GB_COLLECTION col, GB_VARIANT *value, char **key, int *len
if (!val)
return TRUE;
value->type = GB_T_VARIANT;
value->type = T_VARIANT;
value->value.value.data = val->value.data;
HASH_TABLE_get_last_key(hash_table, key, len);

View file

@ -239,10 +239,10 @@ GB_DESC NATIVE_Gambas[] =
GB_CONSTANT("Single", "i", T_SINGLE),
GB_CONSTANT("Date", "i", T_DATE),
GB_CONSTANT("String", "i" , T_STRING),
//GB_CONSTANT("Function", "i" , T_FUNCTION),
GB_CONSTANT("Pointer", "i" , T_POINTER),
GB_CONSTANT("Function", "i" , T_FUNCTION),
GB_CONSTANT("Variant", "i", T_VARIANT),
GB_CONSTANT("Class", "i" , T_CLASS),
//GB_CONSTANT("Void", "i", T_VOID),
GB_CONSTANT("Object", "i", T_OBJECT),
GB_CONSTANT("File", "i", GB_STAT_FILE),

View file

@ -1203,13 +1203,16 @@ void CLASS_create_array_class(CLASS *class)
void *save = TYPE_joker;
char *name_joker;
GB_DESC *desc;
CLASS *array_type;
//fprintf(stderr, "CLASS_create_array_class: create %s\n", class->name);
STRING_new(&name_joker, class->name, strlen(class->name) - 2);
TYPE_joker = class->array_type = class->global ? CLASS_find_global(name_joker) : CLASS_find(name_joker);
class->array_type->array_class = class;
array_type = class->global ? CLASS_find_global(name_joker) : CLASS_find(name_joker);
TYPE_joker = array_type;
class->array_type = (TYPE)array_type;
array_type->array_class = class;
ALLOC(&desc, sizeof(GB_DESC) * ARRAY_TEMPLATE_NDESC, "CLASS_create_array_class");
memcpy(desc, NATIVE_TemplateArray, sizeof(GB_DESC) * ARRAY_TEMPLATE_NDESC);

View file

@ -170,7 +170,7 @@ typedef
typedef
struct {
CTYPE type;
TYPE type;
int dim[0];
}
CLASS_ARRAY;
@ -276,7 +276,7 @@ typedef
short special[12]; // 100 144 special functions index (_new, _free, ...)
struct _CLASS *array_type; // 104 152 datatype of the contents if this class is an array class of objects
TYPE array_type; // 104 152 datatype of the contents if this class is an array class of objects
struct _CLASS *array_class; // 108 160 associated array class if it exists
void *instance; // 112 168 automatically created instance

View file

@ -80,10 +80,11 @@ typedef
GB_DESC *desc;
CLASS **class;
int array;
TYPE array_type;
}
CLASS_INIT;
static CLASS_INIT init_list[] =
static const CLASS_INIT init_list[] =
{
{ NATIVE_Gambas, NULL },
{ NATIVE_Param, NULL },
@ -112,18 +113,18 @@ static CLASS_INIT init_list[] =
{ NATIVE_ArrayBounds, NULL },
{ NATIVE_Array, &CLASS_Array },
{ NATIVE_BooleanArray, &CLASS_BooleanArray, CQA_ARRAY },
{ NATIVE_ByteArray, &CLASS_ByteArray, CQA_ARRAY },
{ NATIVE_ShortArray, &CLASS_ShortArray, CQA_ARRAY },
{ NATIVE_IntegerArray, &CLASS_IntegerArray, CQA_ARRAY },
{ NATIVE_FloatArray, &CLASS_FloatArray, CQA_ARRAY },
{ NATIVE_SingleArray, &CLASS_SingleArray, CQA_ARRAY },
{ NATIVE_DateArray, &CLASS_DateArray, CQA_ARRAY },
{ NATIVE_StringArray, &CLASS_StringArray, CQA_ARRAY },
{ NATIVE_ObjectArray, &CLASS_ObjectArray, CQA_ARRAY },
{ NATIVE_VariantArray, &CLASS_VariantArray, CQA_ARRAY },
{ NATIVE_LongArray, &CLASS_LongArray, CQA_ARRAY },
{ NATIVE_PointerArray, &CLASS_PointerArray, CQA_ARRAY },
{ NATIVE_BooleanArray, &CLASS_BooleanArray, CQA_ARRAY, T_BOOLEAN },
{ NATIVE_ByteArray, &CLASS_ByteArray, CQA_ARRAY, T_BYTE },
{ NATIVE_ShortArray, &CLASS_ShortArray, CQA_ARRAY, T_SHORT },
{ NATIVE_IntegerArray, &CLASS_IntegerArray, CQA_ARRAY, T_INTEGER },
{ NATIVE_FloatArray, &CLASS_FloatArray, CQA_ARRAY, T_FLOAT },
{ NATIVE_SingleArray, &CLASS_SingleArray, CQA_ARRAY, T_SINGLE },
{ NATIVE_DateArray, &CLASS_DateArray, CQA_ARRAY, T_DATE },
{ NATIVE_StringArray, &CLASS_StringArray, CQA_ARRAY, T_STRING },
{ NATIVE_ObjectArray, &CLASS_ObjectArray, CQA_ARRAY, T_OBJECT },
{ NATIVE_VariantArray, &CLASS_VariantArray, CQA_ARRAY, T_VARIANT },
{ NATIVE_LongArray, &CLASS_LongArray, CQA_ARRAY, T_LONG },
{ NATIVE_PointerArray, &CLASS_PointerArray, CQA_ARRAY, T_POINTER },
{ NATIVE_SubCollection, &CLASS_SubCollection },
@ -133,7 +134,7 @@ static CLASS_INIT init_list[] =
void CLASS_init_native(void)
{
CLASS_INIT *init;
const CLASS_INIT *init;
CLASS *class;
/* NOTE: The 'Class' class must be first in the global class table */
@ -150,6 +151,7 @@ void CLASS_init_native(void)
if (init->class != NULL)
*init->class = class;
class->quick_array = init->array;
class->array_type = init->array_type;
}
CLASS_Observer->is_observer = TRUE;

View file

@ -39,7 +39,7 @@
#include "gbx_debug.h"
#include "gb_magic.h"
#include "gbx_stream.h"
#include "gbx_c_array.h"
#include "gbx_string.h"
#include "gbx_object.h"
#include "gbx_variant.h"
@ -86,20 +86,24 @@ static int align_pos(int pos, int size)
static int sizeof_ctype(CLASS *class, CTYPE ctype)
{
//size_t size;
size_t size;
return TYPE_sizeof_memory(ctype.id);
if (ctype.id == TC_ARRAY)
{
size = CARRAY_get_static_size(class->load->array[ctype.value]);
return (size + 3) & ~3;
}
else
return TYPE_sizeof_memory(ctype.id);
//size = ARRAY_get_size((ARRAY_DESC *)class->load->array[ctype.value]);
//return (size + 3) & ~3;
}
TYPE CLASS_ctype_to_type(CLASS *class, CTYPE ctype)
{
if (ctype.id == T_OBJECT && ctype.value >= 0)
return (TYPE)(class->load->class_ref[ctype.value]);
else if (ctype.id == TC_POINTER)
return (TYPE)T_POINTER;
//else if (ctype.id == TC_POINTER)
// return (TYPE)T_POINTER;
else
return (TYPE)(ctype.id);
}
@ -107,8 +111,8 @@ TYPE CLASS_ctype_to_type(CLASS *class, CTYPE ctype)
static void conv_ctype(CTYPE *ctype)
{
if (ctype->id == TC_POINTER)
ctype->id = T_POINTER;
//if (ctype->id == TC_POINTER)
// ctype->id = T_POINTER;
}
@ -581,6 +585,7 @@ static void load_and_relocate(CLASS *class, int len_data, int *pndesc, int *pfir
#else
class->load->array[i] = (CLASS_ARRAY *)((char *)class->load->array + ((int *)class->load->array)[i]);
#endif
conv_type(class, &class->load->array[i]->type);
}
}

View file

@ -142,6 +142,7 @@ bool DEBUG_get_value(const char *sym, int len, GB_VARIANT *ret)
CLASS_VAR *var;
char *addr;
CLASS *class;
void *ref;
if (DEBUG_info->fp)
{
@ -170,14 +171,16 @@ bool DEBUG_get_value(const char *sym, int len, GB_VARIANT *ret)
{
var = &DEBUG_info->cp->load->dyn[gp->value];
addr = (char *)DEBUG_info->op + var->pos;
ref = DEBUG_info->op;
}
else
{
var = &DEBUG_info->cp->load->stat[gp->value];
addr = (char *)DEBUG_info->cp->stat + var->pos;
ref = DEBUG_info->cp;
}
VALUE_class_read(DEBUG_info->cp, &value, addr, var->type);
VALUE_class_read(DEBUG_info->cp, &value, addr, var->type, ref);
goto __FOUND;
}
else if (CTYPE_get_kind(gp->ctype) == TK_CONST)

View file

@ -36,7 +36,6 @@
#include "gbx_string.h"
#include "gbx_date.h"
#include "gbx_array.h"
#include "gbx_c_collection.h"
@ -107,7 +106,7 @@ void EXEC_borrow(TYPE type, VALUE *value)
{
static const void *jump[16] = {
&&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE,
&&__STRING, &&__NONE, &&__VARIANT, &&__NONE, &&__FUNCTION, &&__NONE, &&__NONE
&&__STRING, &&__NONE, &&__NONE, &&__VARIANT, &&__FUNCTION, &&__NONE, &&__NONE
};
goto *jump[type];
@ -135,7 +134,7 @@ void UNBORROW(VALUE *value)
{
static const void *jump[16] = {
&&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE,
&&__STRING, &&__NONE, &&__VARIANT, &&__NONE, &&__FUNCTION, &&__NONE, &&__NONE
&&__STRING, &&__NONE, &&__NONE, &&__VARIANT, &&__FUNCTION, &&__NONE, &&__NONE
};
TYPE type = value->type;
@ -171,7 +170,7 @@ void EXEC_release(TYPE type, VALUE *value)
{
static const void *jump[16] = {
&&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE,
&&__STRING, &&__NONE, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__NONE, &&__NONE
&&__STRING, &&__NONE, &&__NONE, &&__VARIANT, &&__FUNCTION, &&__NONE, &&__NONE
};
goto *jump[type];
@ -187,11 +186,6 @@ __FUNCTION:
OBJECT_UNREF(value->_function.object, "RELEASE");
return;
__ARRAY:
if (!value->_array.keep)
ARRAY_free(&value->_array.addr, (ARRAY_DESC *)value->_array.class->load->array[value->_array.index]);
return;
__STRING:
STRING_unref(&value->_string.addr);
@ -203,7 +197,7 @@ void RELEASE_many(VALUE *value, int n)
{
static const void *jump[16] = {
&&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE, &&__NONE,
&&__STRING, &&__NONE, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__NONE, &&__NONE
&&__STRING, &&__NONE, &&__NONE, &&__VARIANT, &&__FUNCTION, &&__NONE, &&__NONE
};
TYPE type;
@ -234,11 +228,6 @@ void RELEASE_many(VALUE *value, int n)
OBJECT_UNREF(value->_function.object, "RELEASE");
continue;
__ARRAY:
if (!value->_array.keep)
ARRAY_free(&value->_array.addr, (ARRAY_DESC *)value->_array.class->load->array[value->_array.index]);
continue;
__STRING:
STRING_unref(&value->_string.addr);
@ -337,7 +326,7 @@ static void set_class_default(CLASS *class, VALUE *value, CTYPE ctype)
{
static const void *jump[] = {
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT,
&&__DATE, &&__STRING, &&__STRING, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__CLASS, &&__NULL,
&&__DATE, &&__STRING, &&__STRING, &&__POINTER, &&__VARIANT, &&__FUNCTION, &&__CLASS, &&__NULL,
&&__OBJECT
};
@ -372,6 +361,10 @@ __VARIANT:
value->_variant.vtype = T_NULL;
return;
__POINTER:
value->_pointer.value = NULL;
return;
__DATE:
value->_date.date = 0;
value->_date.time = 0;
@ -386,14 +379,6 @@ __OBJECT:
value->_object.object = NULL;
return;
__ARRAY:
value->_array.class = class;
value->_array.keep = FALSE;
value->_array.index = ctype.value;
ARRAY_new(&value->_array.addr, (ARRAY_DESC *)class->load->array[ctype.value]);
return;
__FUNCTION:
__CLASS:
__NULL:
@ -1256,7 +1241,7 @@ void EXEC_object(VALUE *val, CLASS **pclass, OBJECT **pobject, bool *pdefined)
{
static const void *jump[] = {
&&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR,
&&__ERROR, &&__ERROR, &&__VARIANT, &&__ERROR, &&__FUNCTION, &&__CLASS, &&__NULL,
&&__ERROR, &&__ERROR, &&__ERROR, &&__VARIANT, &&__FUNCTION, &&__CLASS, &&__NULL,
&&__OBJECT
};

View file

@ -33,7 +33,6 @@
#include "gbx_string.h"
#include "gbx_object.h"
#include "gbx_variant.h"
#include "gbx_array.h"
#include "gbx_c_enum.h"
@ -190,7 +189,7 @@ void EXEC_release(TYPE type, VALUE *val);
void RELEASE_many(VALUE *val, int n);
#define BORROW(_value) \
{ \
do { \
VALUE *_v = (_value); \
TYPE type = _v->type; \
if (TYPE_is_object(type)) \
@ -201,7 +200,7 @@ void RELEASE_many(VALUE *val, int n);
STRING_ref(_v->_string.addr); \
else \
EXEC_borrow(type, _v); \
}
} while (0)
#define RELEASE(_value) \
do { \

View file

@ -1416,6 +1416,7 @@ _PUSH_EXTERN:
{
CLASS_VAR *var;
char *addr;
void *ref;
_PUSH_DYNAMIC:
@ -1424,6 +1425,7 @@ _PUSH_DYNAMIC:
if (OP == NULL)
THROW(E_ILLEGAL);
ref = OP;
addr = &OP[var->pos];
goto __READ;
@ -1431,11 +1433,12 @@ _PUSH_STATIC:
var = &CP->load->stat[GET_7XX()];
addr = (char *)CP->stat + var->pos;
ref = CP;
goto __READ;
__READ:
VALUE_class_read(CP, SP, addr, var->type);
VALUE_class_read(CP, SP, addr, var->type, ref);
PUSH();
goto _NEXT;

View file

@ -26,7 +26,6 @@
#include "gbx_string.h"
#include "gbx_object.h"
#include "gbx_array.h"
#include "gbx_c_array.h"
#include "gbx_c_collection.h"
#include "gbx_api.h"

View file

@ -27,7 +27,6 @@
#include "gbx_api.h"
#include "gbx_string.h"
#include "gbx_array.h"
#include "gbx_c_array.h"
#include "gbx_c_collection.h"
#include "gbx_api.h"

View file

@ -225,7 +225,7 @@ void EXTERN_call(void)
{
static const void *jump[17] = {
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__STRING, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__CLASS, &&__NULL, &&__OBJECT
&&__STRING, &&__STRING, &&__POINTER, &&__VARIANT, &&__FUNCTION, &&__CLASS, &&__NULL, &&__OBJECT
};
static const int use_temp[17] = { 0, 0, 0, 0, 0, 0, sizeof(float), 0, 0, sizeof(char *), sizeof(char *), 0, 0, 0, 0, 0, sizeof(void *) };
static char temp[4 * sizeof(void *)];
@ -316,6 +316,10 @@ void EXTERN_call(void)
}
continue;
__POINTER:
args[i] = &value->_pointer.value;
continue;
__NULL:
args[i] = &null;
continue;
@ -323,7 +327,6 @@ void EXTERN_call(void)
__DATE:
__VARIANT:
__VOID:
__ARRAY:
__CLASS:
__FUNCTION:

View file

@ -1,243 +0,0 @@
/***************************************************************************
gbx_print.c
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#define __GBX_PRINT_C
#include "gb_common.h"
#include "gb_common_buffer.h"
#include "gb_common_case.h"
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include "gbx_exec.h"
#include "gbx_local.h"
#include "gbx_date.h"
#include "gbx_print.h"
static PRINT_FUNCTION _print;
static bool _trace = FALSE;
static void to_string(VALUE *value, char **addr, int *len)
{
static void *jump[16] = {
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__STRING, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__CLASS, &&__NULL
};
VALUE conv;
//*more = FALSE;
__CONV:
if (TYPE_is_object(value->type))
goto __OBJECT;
else
goto *jump[value->type];
__NULL:
*addr = "NULL";
*len = 4;
return;
__BOOLEAN:
if (value->_boolean.value)
{
*addr = "TRUE";
*len = 4;
}
else
{
*addr = "FALSE";
*len = 5;
}
return;
__BYTE:
__SHORT:
__INTEGER:
*len = sprintf(COMMON_buffer, "%d", value->_integer.value);
*addr = COMMON_buffer;
return;
__LONG:
*len = sprintf(COMMON_buffer, "%" PRId64, value->_long.value);
*addr = COMMON_buffer;
return;
__DATE:
LOCAL_format_date(DATE_split(value), LF_STANDARD, NULL, 0, addr, len);
return;
__SINGLE:
__FLOAT:
LOCAL_format_number(value->_float.value, LF_STANDARD, NULL, 0, addr, len, TRUE);
return;
__STRING:
{
int i;
char *d;
const char *s;
uchar c;
s = value->_string.addr + value->_string.start;
d = COMMON_buffer;
*d++ = '"';
for (i = 0; i < value->_string.len; i++)
{
if (i > 128)
{
strcat(d, "...");
*len += 3;
break;
}
c = s[i];
if (c < 32)
{
*d++ = '\\';
if (c == 10)
*d++ = 'n';
else if (c == 13)
*d++ = 'r';
else if (c == 9)
*d++ = 't';
else
d += sprintf(d, "x%02X", c);
}
else if (c == '\"')
{
*d++ = '\\';
*d++ = c;
}
else
{
*d++ = c;
}
}
*d++ = '"';
*addr = COMMON_buffer;
*len = d - COMMON_buffer;
}
return;
__OBJECT:
if (VALUE_is_null(value))
goto __NULL;
//*more = !CLASS_is_native(OBJECT_class(value->_object.object));
*len = sprintf(COMMON_buffer, "(%s %p)", OBJECT_class(value->_object.object)->name, value->_object.object);
*addr = COMMON_buffer;
return;
__VARIANT:
conv = *value;
value = &conv;
VARIANT_undo(value);
goto __CONV;
__VOID:
*addr = "(void)";
*len = 6;
return;
__CLASS:
{
CLASS *class = value->_class.class;
//*more = (!CLASS_is_native(class) && class->load->n_stat > 0);
*len = sprintf(COMMON_buffer, "%s %p", class->name, class);
*addr = COMMON_buffer;
return;
}
__ARRAY:
*len = sprintf(COMMON_buffer, "(ARRAY %p)", value->_array.addr);
*addr = COMMON_buffer;
return;
__FUNCTION:
THROW(E_TYPE, TYPE_get_name(T_STRING), TYPE_get_name(value->type));
}
void PRINT_init(PRINT_FUNCTION func, bool trace)
{
_print = func;
_trace = trace;
}
void PRINT_value(VALUE *value)
{
char *addr;
int len;
/*if (TYPE_is_object(value->type))
{
void *object = value->_object.object;
CLASS *class = OBJECT_class(object);
if (!EXEC_spec(SPEC_PRINT, class, object, 0, TRUE))
return;
}*/
if (_trace)
to_string(value, &addr, &len);
else
VALUE_to_string(value, &addr, &len);
(*_print)(addr, len);
}
void PRINT_string(char *addr, int len)
{
(*_print)(addr, len);
}

View file

@ -1,37 +0,0 @@
/***************************************************************************
gbx_print.h
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
***************************************************************************/
#ifndef __GBX_PRINT_H
#define __GBX_PRINT_H
#include "gb_common.h"
#include "gbx_value.h"
typedef
void (*PRINT_FUNCTION)(char *, int);
void PRINT_init(PRINT_FUNCTION func, bool trace);
void PRINT_value(VALUE *value);
void PRINT_string(char *addr, int len);
#endif

View file

@ -35,7 +35,7 @@ void SUBR_is_type(void)
{
static void *jump[] = {
&&__BAD, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__BAD, &&__VARIANT, &&__BAD, &&__BAD, &&__BAD, &&__NULL,
&&__STRING, &&__BAD, &&__POINTER, &&__VARIANT, &&__BAD, &&__BAD, &&__NULL,
&&__OBJECT, &&__NUMBER
};
@ -55,6 +55,7 @@ __LONG:
__SINGLE:
__FLOAT:
__DATE:
__POINTER:
VARIANT_undo(PARAM);

View file

@ -73,7 +73,7 @@ void SUBR_alloc(void)
}
RETURN->type = T_POINTER;
RETURN->_pointer.value = (intptr_t)ptr;
RETURN->_pointer.value = ptr;
SUBR_LEAVE();
}
@ -116,7 +116,7 @@ void SUBR_realloc(void)
REALLOC(&ptr, size * count, "SUBR_realloc");
RETURN->type = T_POINTER;
RETURN->_pointer.value = (intptr_t)ptr;
RETURN->_pointer.value = ptr;
SUBR_LEAVE();
}
@ -207,7 +207,7 @@ void SUBR_varptr(void)
THROW(E_ILLEGAL);
RETURN->type = T_POINTER;
RETURN->_pointer.value = (intptr_t)ptr;
RETURN->_pointer.value = ptr;
SUBR_LEAVE();
}

View file

@ -33,7 +33,6 @@
#include "gbx_regexp.h"
#include "gbx_string.h"
#include "gbx_c_file.h"
#include "gbx_print.h"
typedef
struct _stream {
@ -163,12 +162,8 @@ void SUBR_open(void)
if (EXEC_code & 0x3F)
{
if (TYPE_is_integer(PARAM->type))
addr = (void *)PARAM->_integer.value;
#ifdef OS_64BITS
else if (TYPE_is_long(PARAM->type))
addr = (void *)PARAM->_long.value;
#endif
if (TYPE_is_pointer(PARAM->type))
addr = (void *)PARAM->_pointer.value;
else
THROW(E_TYPE, "Pointer", TYPE_get_name(PARAM->type));

View file

@ -455,8 +455,7 @@ void SUBR_comp(void)
{
static void *jump[17] = {
&&__VARIANT, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__STRING, &&__ERROR, &&__ERROR, &&__ERROR, &&__ERROR,
&&__NULL, &&__OBJECT
&&__STRING, &&__STRING, &&__POINTER, &&__ERROR, &&__ERROR, &&__ERROR, &&__NULL, &&__OBJECT
};
static void *test[] = { &&__EQ, &&__NE, &&__GT, &&__LE, &&__LT, &&__GE };
@ -547,6 +546,14 @@ __FLOAT:
result = fsgn(P1->_float.value - P2->_float.value);
goto __END;
__POINTER:
VALUE_conv(P1, T_POINTER);
VALUE_conv(P2, T_POINTER);
result = P1->_pointer.value > P2->_pointer.value ? 1 : P1->_pointer.value < P2->_pointer.value ? -1 : 0;
goto __END_RELEASE;
__OBJECT:
result = OBJECT_comp_value(P1, P2);

View file

@ -36,35 +36,14 @@
void *TYPE_joker = NULL;
const size_t TYPE_sizeof_memory_tab[16] = { 0, 1, 1, 2, 4, 8, 4, 8, 8, sizeof(void *), sizeof(void *), sizeof(VARIANT), 0, 0, 0, 0 };
/* Permet de simplifier les tables de sauts associ<63>s aux types de donn<6E>s */
#if 0
short TYPE_Index[] =
{
0, /* T_NULL */
1, /* T_BOOLEAN */
2, /* T_BYTE */
2, /* T_SHORT */
2, /* T_INTEGER */
3, /* T_LONG */
4, /* T_FLOAT */
5, /* T_DATE */
6, /* T_STRING */
6, /* T_CSTRING */
7, /* T_FUNCTION */
8, /* T_ARRAY */
9 /* T_CLASS */
};
#endif
const size_t TYPE_sizeof_memory_tab[16] = { 0, 1, 1, 2, 4, 8, 4, 8, 8, sizeof(void *), sizeof(void *), sizeof(void *), sizeof(VARIANT), 0, 0, 0 };
/* taille n<>essaire au stockage des variables globales d'une classe */
size_t TYPE_sizeof(TYPE type)
{
static size_t size[16] = { 0, 4, 4, 4, 4, 8, 8, 8, 8, sizeof(void *), sizeof(void *), sizeof(VARIANT), 0, 0, 0, 0 };
static size_t size[16] = { 0, 4, 4, 4, 4, 8, 8, 8, 8, sizeof(void *), sizeof(void *), sizeof(void *), sizeof(VARIANT), 0, 0, 0 };
if (TYPE_is_object(type))
return sizeof(void *);
@ -72,22 +51,6 @@ size_t TYPE_sizeof(TYPE type)
return size[type];
}
#if 0
size_t TYPE_sizeof_native(TYPE type)
{
static size_t size[16] =
{
0, 4, 4, 4, 4, 8, 8, 8, 8,
sizeof(GB_STRING), sizeof(GB_STRING), 12, 0, 0, 0, 0
};
if (TYPE_is_object(type))
return sizeof(void *);
else
return size[type];
}
#endif
const char *TYPE_get_name(TYPE type)
{
@ -104,8 +67,8 @@ const char *TYPE_get_name(TYPE type)
"Date",
"String",
"String",
"Pointer",
"Variant",
"Array",
"Function",
"Class",
"Null",
@ -133,6 +96,7 @@ const char *TYPE_to_string(TYPE type)
case T_FLOAT: return "f";
case T_DATE: return "d";
case T_STRING: return "s";
case T_POINTER: return "p";
case T_VARIANT: return "v";
case T_OBJECT: return "o";
@ -274,11 +238,7 @@ TYPE TYPE_from_string(const char **ptype)
case 's': return T_STRING;
case 'v': return T_VARIANT;
case 'o': return T_OBJECT;
#ifdef OS_64BITS
case 'p': return T_LONG;
#else
case 'p': return T_INTEGER;
#endif
case 'p': return T_POINTER;
default:

View file

@ -87,11 +87,9 @@ EXTERN const size_t TYPE_sizeof_memory_tab[];
#define TYPE_is_function(type) ((type) == T_FUNCTION)
#define TYPE_is_null(type) ((type) == T_NULL)
#define TYPE_is_object_null(type) ((type) >= T_OBJECT || (type) == T_NULL)
#define TYPE_is_pointer(type) ((type) == T_POINTER)
size_t TYPE_sizeof(TYPE type);
//size_t TYPE_sizeof_native(TYPE type);
//size_t TYPE_sizeof_memory(TYPE type);
#define TYPE_sizeof_memory(_type) (TYPE_is_object(_type) ? sizeof(void *) : TYPE_sizeof_memory_tab[_type])
const char *TYPE_get_name(TYPE type);

File diff suppressed because it is too large Load diff

View file

@ -70,7 +70,7 @@ typedef
typedef
struct {
TYPE type;
intptr_t value;
void *value;
}
PACKED
VALUE_POINTER;
@ -159,6 +159,7 @@ typedef
float _single;
double _float;
char *_string;
void *_pointer;
void *_object;
int64_t data;
}
@ -182,17 +183,6 @@ typedef
}
VALUE_CLASS;
typedef
struct {
TYPE type;
CLASS *class;
void *addr;
short index;
unsigned keep : 1;
unsigned _reserved : 15;
}
VALUE_ARRAY;
typedef
union value {
TYPE type;
@ -205,13 +195,12 @@ typedef
VALUE_FLOAT _float;
VALUE_DATE _date;
VALUE_STRING _string;
VALUE_POINTER _pointer;
VALUE_FUNCTION _function;
VALUE_VARIANT _variant;
VALUE_CLASS _class;
VALUE_OBJECT _object;
VALUE_ARRAY _array;
VALUE_VOID _void;
VALUE_POINTER _pointer;
}
VALUE;
@ -236,7 +225,7 @@ void VALUE_free(void *addr, TYPE type);
void VALUE_to_string(VALUE *value, char **addr, int *len);
void VALUE_from_string(VALUE *value, const char *addr, int len);
void VALUE_class_read(CLASS *class, VALUE *value, char *addr, CTYPE ctype);
void VALUE_class_read(CLASS *class, VALUE *value, char *addr, CTYPE ctype, void *ref);
void VALUE_class_write(CLASS *class, VALUE *value, char *addr, CTYPE ctype);
void VALUE_class_constant(CLASS *class, VALUE *value, int ind);

View file

@ -42,6 +42,7 @@ typedef
GB_DATE_VALUE _date;
char *_string;
void *_object;
void *_pointer;
int64_t data;
}
value;

View file

@ -161,7 +161,7 @@ static void print_value(VALUE *value)
{
static void *jump[16] = {
&&__VOID, &&__BOOLEAN, &&__BYTE, &&__SHORT, &&__INTEGER, &&__LONG, &&__SINGLE, &&__FLOAT, &&__DATE,
&&__STRING, &&__STRING, &&__VARIANT, &&__ARRAY, &&__FUNCTION, &&__CLASS, &&__NULL
&&__STRING, &&__STRING, &&__POINTER, &&__VARIANT, &&__FUNCTION, &&__CLASS, &&__NULL
};
VALUE conv;
@ -258,9 +258,9 @@ __CLASS:
goto __RETURN;
}
__ARRAY:
__POINTER:
fprintf(_where, "ARRAY %p", value->_array.addr);
fprintf(_where, "(%p)", value->_pointer.value);
goto __RETURN;
__FUNCTION:

View file

@ -77,8 +77,8 @@
#define GB_T_DATE 8
#define GB_T_STRING 9
#define GB_T_CSTRING 10
#define GB_T_VARIANT 11
#define GB_T_POINTER 13
#define GB_T_POINTER 11
#define GB_T_VARIANT 12
#define GB_T_NULL 15
#define GB_T_OBJECT 16
@ -154,6 +154,7 @@ typedef
}
GB_LONG;
/* Gambas POINTER datatype definition */
typedef
@ -243,6 +244,7 @@ typedef
double _float;
GB_DATE_VALUE _date;
char *_string;
intptr_t _pointer;
void *_object;
int64_t data;
}
@ -274,6 +276,7 @@ typedef
GB_FLOAT _float;
GB_DATE _date;
GB_STRING _string;
GB_POINTER _pointer;
GB_OBJECT _object;
GB_VARIANT _variant;
}
@ -868,9 +871,6 @@ typedef
void *(*Insert)(void *, int, int);
void (*Remove)(void *, int, int);
void (*PrintData)(GB_TYPE, void *);
void (*PrintString)(char *, int);
struct {
void (*New)(GB_SUBCOLLECTION *, GB_SUBCOLLECTION_DESC *, void *);
void (*Add)(void *, const char *, int, void *);
@ -984,6 +984,7 @@ typedef
STRING s
VARIANT v
OBJECT o
POINTER p
Any class ClassName;
*/

View file

@ -72,7 +72,7 @@ void MEMORY_exit(void)
if (MEMORY_count)
{
fprintf(MEMORY_log, "\n*************************************************\n");
fprintf(MEMORY_log, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
fprintf(MEMORY_log, "warning: %d allocation(s) non freed.\n", MEMORY_count);
while (_alloc)
{
fprintf(MEMORY_log, "<%d>\n", _alloc->id);
@ -82,7 +82,7 @@ void MEMORY_exit(void)
fclose(MEMORY_log);
#else
if (MEMORY_count)
fprintf(stderr, "WARNING: %d allocation(s) non freed.\n", MEMORY_count);
fprintf(stderr, "warning: %d allocation(s) non freed.\n", MEMORY_count);
#endif
}

View file

@ -366,12 +366,13 @@ SUBR_INFO COMP_subr_info[] =
{ "IsFloat", 37, 7, 1 },
{ "IsDate", 37, 8, 1 },
{ "IsString", 37, 9, 1 },
{ "IsVariant", 37, 11, 1 },
{ "IsPointer", 37, 11, 1 },
{ "IsVariant", 37, 12, 1 },
{ "IsNull", 37, 15, 1 },
{ "IsObject", 37, 16, 1 },
{ "IsNumber", 37, 17, 1 },
{ "Boolean?", 37, 1, 1 },
/*{ "Boolean?", 37, 1, 1 },
{ "Byte?", 37, 2, 1 },
{ "Short?", 37, 3, 1 },
{ "Integer?", 37, 4, 1 },
@ -382,7 +383,7 @@ SUBR_INFO COMP_subr_info[] =
{ "String?", 37, 9, 1 },
{ "Null?", 37, 15, 1 },
{ "Object?", 37, 16, 1 },
{ "Number?", 37, 17, 1 },
{ "Number?", 37, 17, 1 },*/
{ "TypeOf", 38, 0, 1 },
@ -400,8 +401,8 @@ SUBR_INFO COMP_subr_info[] =
{ "CDate", 39, 8, 1 },
{ "CStr", 39, 9, 1 },
{ "CString", 39, 9, 1 },
{ "CVar", 39, 11, 1 },
{ "CVariant", 39, 11, 1 },
{ "CVar", 39, 12, 1 },
{ "CVariant", 39, 12, 1 },
{ "Bin$", 40, 0, 1, 2 },
{ "Bin", 40, 0, 1, 2 },

View file

@ -53,9 +53,9 @@ enum {
T_DATE = 8,
T_STRING = 9,
T_CSTRING = 10,
T_VARIANT = 11,
T_ARRAY = 12,
T_POINTER = 13,
T_POINTER = 11,
T_VARIANT = 12,
T_ARRAY = 13,
T_STRUCT = 14,
T_NULL = 15,
T_OBJECT = 16
@ -75,20 +75,14 @@ enum {
T_DATE = 8,
T_STRING = 9,
T_CSTRING = 10,
T_VARIANT = 11,
//T_ARRAY = 12, To be replaced by T_POINTER
T_POINTER = 11,
T_VARIANT = 12,
T_FUNCTION = 13,
T_CLASS = 14,
T_NULL = 15,
T_OBJECT = 16,
#if __WORDSIZE == 64
T_POINTER = T_LONG,
#else
T_POINTER = T_INTEGER,
#endif
TC_ARRAY = 12,
TC_POINTER = 13,
TC_ARRAY = 13,
TC_STRUCT = 14
};