FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» Une calculatrice en une ligne de programme
Adr(Array%(0)) ? Emptypar jean_debord Aujourd'hui à 8:01

» Gestion d'un système client-serveur.
Adr(Array%(0)) ? Emptypar Pedro Hier à 19:31

» Les maths du crocodile
Adr(Array%(0)) ? Emptypar jean_debord Hier à 10:37

» Naissance de Crocodile Basic
Adr(Array%(0)) ? Emptypar jean_debord Hier à 8:45

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Adr(Array%(0)) ? Emptypar Froggy One Mer 24 Avr 2024 - 18:38

» Dessine-moi une galaxie
Adr(Array%(0)) ? Emptypar jjn4 Lun 22 Avr 2024 - 13:47

» Erreur END_SUB
Adr(Array%(0)) ? Emptypar jjn4 Lun 22 Avr 2024 - 13:43

» Bug sur DIM_LOCAL ?
Adr(Array%(0)) ? Emptypar papydall Dim 21 Avr 2024 - 23:30

» Form
Adr(Array%(0)) ? Emptypar leclode Dim 21 Avr 2024 - 18:09

» trop de fichiers en cours
Adr(Array%(0)) ? Emptypar Marc Dim 21 Avr 2024 - 2:41

» 2D_fill_color(résolu)
Adr(Array%(0)) ? Emptypar leclode Sam 20 Avr 2024 - 8:32

» Consommation gaz électricité
Adr(Array%(0)) ? Emptypar leclode Mer 17 Avr 2024 - 11:07

» on_key_down (résolu)
Adr(Array%(0)) ? Emptypar leclode Mar 16 Avr 2024 - 11:01

» Sous-programme(résolu)
Adr(Array%(0)) ? Emptypar jjn4 Jeu 4 Avr 2024 - 14:42

» Bataille-navale
Adr(Array%(0)) ? Emptypar jjn4 Mer 3 Avr 2024 - 14:08

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Avril 2024
LunMarMerJeuVenSamDim
1234567
891011121314
15161718192021
22232425262728
2930     
CalendrierCalendrier
Le Deal du moment : -39%
Ordinateur portable ASUS Chromebook Vibe CX34 Flip
Voir le deal
399 €

 

 Adr(Array%(0)) ?

Aller en bas 
+2
Klaus
d.j.peters
6 participants
AuteurMessage
d.j.peters

d.j.peters


Nombre de messages : 77
Age : 59
Localisation : Germany
Date d'inscription : 31/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyJeu 5 Aoû 2010 - 6:18

Code:
dim array%(100)
dim pointer%
pointer% = adr(array%(0))
Comment puis-je obtenir le destinataire du tableau?

Merci DJ

(if array%(0) is 100 then adr(array%(0)) is 100 too not the address!)
Revenir en haut Aller en bas
http://shiny3d.de
Klaus

Klaus


Nombre de messages : 12274
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyDim 8 Aoû 2010 - 19:37

Aujourd'hui, ce n'est PAS possible ! Mais cela a été demandé déjà.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
d.j.peters

d.j.peters


Nombre de messages : 77
Age : 59
Localisation : Germany
Date d'inscription : 31/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyLun 9 Aoû 2010 - 4:40

hello klaus
fine you are back Very Happy

i know about this:
DLL_CALL0(), DLL_CALL1(), DLL_CALL2(), DLL_CALL3(), DLL_CALL4(), DLL_CALL5(), DLL_CALL6()

do you have more infos about this commands, i saw inside of panoramic_editor.exe ?

note the "%"
DLL_CALL0%(), DLL_CALL1%(), DLL_CALL2%(), DLL_CALL3%(), DLL_CALL4%(), DLL_CALL5%(), DLL_CALL6%()

and "$" too
DLL_CALL0$(), DLL_CALL1$(), DLL_CALL2$(), DLL_CALL3$(), DLL_CALL4$(), DLL_CALL5$(), DLL_CALL6$()

thank you

DJ


Revenir en haut Aller en bas
http://shiny3d.de
Klaus

Klaus


Nombre de messages : 12274
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyLun 9 Aoû 2010 - 9:14

Hello d.j.peters,

1. there is only dll_callx(), but no dll_callx%() and no dll_callx$().

2. Panoramic can only call functions in a DLL, no procedures.

3. all function called by the call_dllx(à routines return a, integer value.

4. the general syntax is:
result% = dll_calln("DllFunctionName",par1%,...,parn%
As you can see, the first parameter must be a string with the name of the
function to be called, followed by n parameters for the function.

5. all function parameters must be passed as integer values.

6. all function parameters are passes BY VALUE.

7. if the DLL function requires an address, the Panoramic adr() function must be uses.

8. adr() may be used with simple variable of integer, string or float type.

9. no array can be passed, neither by value nor by reference via adr().

10. passing strings to a DLL requires some precautions. Strings are stored zero byte terminated, and adr(s$) passes a pointer to the first data byte of the string. You can write back into the string, but you must NEVER overwrite or write past the zero byte.

11. the called DLL function must use the stdcall convention.

12. the DLL function names are case sensitive and must therefore be specified with the exact case of their name.

I hope this will help you a bit further...
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
d.j.peters

d.j.peters


Nombre de messages : 77
Age : 59
Localisation : Germany
Date d'inscription : 31/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyLun 9 Aoû 2010 - 14:51

Hello Klaus
i know about DLL's i'm an advanced programmer :-)

My questions was about this 12 prototypes 6 x DLL_CALLX%() and this 6 x DLL_CALLX$()
it's not dokumented but i saw it with an hex editor inside of "parametric_editor.exe".

So i was in hope you know more about it but it's ok.

Can be an feature currently disabled but for the near future may be. Smile

thank you

currently i write an compiler for Linux and Windows with the syntax near to panoramic
this is why i searched all aviable commands and objects inside of "panoramic_editor.exe"

here is what i found so far and you can see the DLL_CALL%/$ i'm talking about.
Code:

objects:

ALPHA
BUTTON
COMBO
DLIST
EDIT
FORM
Front
GRID
MAIN_MENU
MEMO
MOVIE
PICTURE
PROGRESS_BAR
SCENE2D
SCENE3D
SOUND
SPIN
SPRITE
SUB_MENU
TIMER
TRACK_BAR
3D_TORUS
3D_LINE
3D_ACTOR
3D_BOX
3D_DODECAHEDRON
3D_CONE
3D_CUBE
3D_CYLINDER
3D_MESH
3D_PLANE
3D_SKYBOX
3D_SPHERE
3D_TEAPOT
3D_TEXT

comands:

2D_CIRCLE
2D_CLEAR
2D_FILL_COLOR
2D_FLOOD
2D_LINE
2D_PEN_COLOR
2D_PEN_WIDTH
2D_POINT
2D_POLY_FROM
2D_POLY_TO
2D_RECTANGLE
2D_TARGET_IS

3D_CHAIN
3D_CHAIN_BREAK
3D_COLLISION_AS_CUBE
3D_COLLISION_AS_ELLIPSOID
3D_COLLISION_AS_FACES
3D_COLLISION_AS_POINT
3D_COLLISION_AS_SPHERE
3D_COLOR

3D_DELETE
3D_DELETE_ALL

3D_HIDE

3D_LINE_WIDTH
3D_LOAD_OBJECT
3D_LOAD_TEXTURE
3D_LOAD_TEXTURE_BACK
3D_LOAD_TEXTURE_BOTTOM
3D_LOAD_TEXTURE_FRONT
3D_LOAD_TEXTURE_LEFT
3D_LOAD_TEXTURE_RIGHT
3D_LOAD_TEXTURE_TOP

3D_MOVE


3D_POSITION
3D_ROTATE
3D_SCALE
3D_SHOW

3D_TARGET_IS
3D_POINT_OBJECT
3D_TEXT_CHANGE
3D_TRANSPARENT
3D_U_TILE
3D_V_TILE

3D_X_POSITION
3D_X_ROTATE
3D_X_SCALE

3D_Y_POSITION
3D_Y_ROTATE
3D_Y_SCALE

3D_Z_POSITION
3D_Z_ROTATE
3D_Z_SCALE

CAM_POSITION
CAM_X_POSITION
CAM_Y_POSITION
CAM_Z_POSITION

POINT_POSITION
POINT_X_POSITION
POINT_Y_POSITION
POINT_Z_POSITION

LIGHT_POSITION
LIGHT_X_POSITION
LIGHT_Y_POSITION
LIGHT_Z_POSITION

O3D_ANIMATION_FRAME_END
O3D_COLLISION

O3D_X_POSITION
O3D_X_ROTATE
O3D_X_SCALE

O3D_Y_POSITION
O3D_Y_ROTATE
O3D_Y_SCALE

O3D_Z_POSITION
O3D_Z_ROTATE
O3D_Z_SCALE

ABS
ACOS
ACTIVE
ACTIVELIST
ADR
AIN
ALPHA
ASC
ASIN
ATN
AXES_HIDE
AXES_SHOW

BAR_BOTH
BAR_HORIZONTAL
BAR_NONE
BAR_VERTICAL

BEEP

BIN_AND
BIN_OR
BIN_XOR

BORDER_HIDE
BORDER_NORMAL
BORDER_SMALL

BRIGHTNESS

CAPTION
CAPTION$
CARET_POSITION
CASE
CHAIN
CHECK
CHECKED
CHR$
CLEAR
CLICKED
CLIPBOARD_COPY
CLIPBOARD_CUT
CLIPBOARD_PASTE
CLIPBOARD_STRING_COPY
CLIPBOARD_STRING_PASTE$
Close
CLS
COLOR
COLOR_PIXEL_BLUE
COLOR_PIXEL_GREEN
COLOR_PIXEL_RED
COMMAND_TARGET_IS
CONTAINER_OPTION
CONTRAST
COS
COUNT
CURSOR_ARROW
CURSOR_BEAM
CURSOR_CROSS
CURSOR_DEFAULT
CURSOR_HELP
CURSOR_HIDE
CURSOR_HOURGLASS
CURSOR_NOPARKING
CURSOR_POINT

DATA
DATE$
DELETE
DIM
DIR_CHANGE
DIR_CURRENT$
DIR_DIALOG
DIR_EXISTS
DIR_MAKE
DIR_REMOVE
DISPLAY
DLL_CALL
DLL_CALL0
DLL_CALL0$
DLL_CALL0%
DLL_CALL1
DLL_CALL1$
DLL_CALL1%
DLL_CALL2
DLL_CALL2$
DLL_CALL2%
DLL_CALL3
DLL_CALL3$
DLL_CALL3%
DLL_CALL4
DLL_CALL4$
DLL_CALL4%
DLL_CALL5
DLL_CALL5$
DLL_CALL5%
DLL_CALL6
DLL_CALL6$
DLL_CALL6%
DLL_OFF
DLL_ON

ELSE
END
END_IF
END_SELECT
END_WHILE
ERROR_ENGLISH
ERROR_FRENCH
ERROR_LINE
ERROR_NUMBER
ERROR_TYPE$
EVEN
EXCEL_FILE_CLOSE
EXCEL_FILE_NEW
EXCEL_FILE_OPEN
EXCEL_READ$
EXCEL_START
EXCEL_STOP
EXCEL_WRITE
EXECUTE
EXECUTE_WAIT
EXIT_FOR
EXIT_REPEAT
EXIT_WHILE
EXP

FILE_ADD
FILE_CLOSE
FILE_DELETE
FILE_EOF
FILE_EXISTS
FILE_FIND_CLOSE
FILE_FIND_FIRST
FILE_FIND_FIRST$
FILE_FIND_NEXT$
FILE_LOAD
FILE_NAME$
FILE_OPEN_APPEND
FILE_OPEN_READ
FILE_OPEN_WRITE
FILE_READ
FILE_READBUF
FILE_READLN
FILE_RENAME
FILE_SAVE
FILE_WRITE
FILE_WRITEBUF
FILE_WRITELN
FILEBIN_BLOCK_READ
FILEBIN_BLOCK_WRITE
FILEBIN_CLOSE
FILEBIN_HEXA_READ
FILEBIN_HEXA_WRITE
FILEBIN_OPEN_READ
FILEBIN_OPEN_WRITE
FILEBIN_POS
FILEBIN_POSITION
FILEBIN_READ
FILEBIN_SIZE
FILEBIN_WRITE
FILTER
FOG_COLOR
FOG_DISTANCE
FOG_OFF
FOG_ON
FONT_BOLD
FONT_BOLD_OFF
FONT_COLOR
FONT_ITALIC
FONT_ITALIC_OFF
FONT_NAME
FONT_NAMES_ADD
FONT_NAMES_LOAD
FONT_SIZE
FONT_STRIKE
FONT_STRIKE_OFF
FONT_UNDERLINE
FONT_UNDERLINE_OFF
FOR
FRAC
FULL_SPACE

GAMMA
GOSUB
GOTO
GRID_COLUMN
GRID_COLUMN_FIXED
GRID_COLUMN_WIDTH
GRID_FIXED_COLOR
GRID_RAW
GRID_RAW_FIXED
GRID_RAW_HEIGHT
GRID_WRITE

HANDLE
HANDLE_CANVAS
HCOS
HEIGHT
HIDE
HINT
HINT_HIDE
HORIZONTAL
HSIN
HTAN

IF
INACTIVE
INKEY$
INPUT
INPUT_MARK_OFF
INPUT_MARK_ON
INPUT_REDO_OFF
INPUT_REDO_ON
INPUT_SOURCE_IS
INPUT_VISIBLE_OFF
INPUT_VISIBLE_ON
INSERT$
INSTR
INT
ITEM_ADD
ITEM_DELETE
ITEM_INDEX
ITEM_INDEX$
ITEM_INSERT
ITEM_READ$

KEY_DOWN_CODE
KEY_DOWN_SPECIAL
KEY_UP_CODE
KEY_UP_SPECIAL

LABEL
LE
LEFT
LEFT$
LEN
LIST
LOG
LOG10
LOG2
LOWER$
LTRIM$

MARK_OFF
MARK_ON
MAX
MESSAGE
MESSAGE_CONFIRMATION_OK
MESSAGE_CONFIRMATION_YES_NO
MESSAGE_ERROR_OK
MESSAGE_ERROR_YES_NO
MESSAGE_INFORMATION_OK
MESSAGE_INFORMATION_YES_NO
MESSAGE_INPUT
MESSAGE_INPUT$
MESSAGE_TEXT$
MESSAGE_WARNING_OK
MESSAGE_WARNING_YES_NO
MID$
MIDI_OFF
MIDI_ON
MIDI_PLAY
MIDI_VOLUME
MIN
MOUSE_LEFT_DOWN
MOUSE_LEFT_UP
MOUSE_RIGHT_DOWN
MOUSE_RIGHT_UP
MOUSE_X_LEFT_DOWN
MOUSE_X_LEFT_UP
MOUSE_X_POSITION
MOUSE_X_RIGHT_DOWN
MOUSE_X_RIGHT_UP
MOUSE_Y_LEFT_DOWN
MOUSE_Y_LEFT_UP
MOUSE_Y_POSITION
MOUSE_Y_RIGHT_DOWN

NEXT
NOT
NUMBER_3D_OBJECTS
NUMBER_CHANGE
NUMBER_CLICK
NUMBER_EVENTS
NUMBER_KEY_DOWN
NUMBER_KEY_UP
NUMBER_OBJECTS
NUMBER_SPRITES
NUMBER_VARIABLES
NUMERIC

ODD
OFF_CHANGE
OFF_CLICK
OFF_ERROR_GOTO
OFF_KEY_DOWN
OFF_KEY_UP
ON_CHANGE
ON_CLICK
ON_CLOSE
ON_ERROR_GOTO
ON_KEY_DOWN
ON_KEY_UP
ON_TIMER
OPEN_DIALOG
OPTION

PARALLEL_INP
PARALLEL_OFF
PARALLEL_ON
PARALLEL_OUT
PARAM_NUMBER
PARAM_VALUE$
PARENT
PLAY
PLAY_WAIT
PLAY_WAIT
POSITION
POWER
PRINT
PRINT_LOCATE
PRINT_TARGET_IS
PRINT_X_LOCATE
PRINT_Y_LOCATE

READ
REM
REPEAT
RESTORE
RETURN
RIGHT$
RMDIR
RND
RTRIM$

SAVE_DIALOG
SCANCODE
SCENE2D
SCENE3D
SCREEN_X
SCREEN_Y
SCROLL_BAR
SECRET_OFF
SECRET_ON
SELECT
SELECT_READ$
SELECT_TEXT
SET_FOCUS
SGN
SHOW
SIN
SORT
SORT_OFF
SORT_ON
SPRITE_DELETE
SPRITE_DELETE_ALL
SPRITE_FILE_LOAD
SPRITE_HEIGHT
SPRITE_HIDE
SPRITE_POSITION
SPRITE_SCALE
SPRITE_SHOW
SPRITE_TARGET_IS
SPRITE_WIDTH
SPRITE_X_POSITION
SPRITE_X_SCALE
SPRITE_Y_POSITION
SPRITE_Y_SCALE
SQR
STEP
STOP
STR$
STRETCH_OFF
STRETCH_ON
STRING$

TAN
TERMINATE
TEXT
TEXT$
THEN
TIME$
TIMER_INTERVAL
TIMER_OFF
TIMER_ON
TO
TO_BACKGROUND
TO_FOREGROUND
TOP
TRIM$

UNTIL
UPPER$

VAL
VERTICAL

WAIT
WHILE
WIDTH

Revenir en haut Aller en bas
http://shiny3d.de
jean_debord

jean_debord


Nombre de messages : 1249
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyLun 9 Aoû 2010 - 15:40

Klaus' summary may be redundant for an advanced programmer but should be excellent for an introductory article on the subject of DLLs Smile

BTW, I did not find how to use with PANORAMIC a DLL written in FreeBASIC. An example is here:

http://www.unilim.fr/pages_perso/jean.debord/lang/ranmt_fb.zip

It is in fact the FreeBASIC translation of my Delphi DLL (which works):

http://www.unilim.fr/pages_perso/jean.debord/lang/ranmt.zip

It would be nice if we could mix FreeBASIC and PANORAMIC Smile
Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
Klaus

Klaus


Nombre de messages : 12274
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyLun 9 Aoû 2010 - 19:17

@d.j.peters:
I'm wondering about those keywords. They do not appear in any Panoramic documentation. Il will do some testing about that. May be a planned future extension, or e code rest of some testing - I don't know, but I will find out.

@jean_debord:
Merci pour ton encouragement concernant les infos sur les DLL's. Ca fait plaisir.
Quant à Freebasic que je ne connais pas, je ne peux pas dire grand-chose. Et ne connaissant pas ce langage, je ne peux pas non plus dire quel serait l'intérêt de mixer Panoramic avec un autre Basic. Bonjour les confusions de syntaxe...
En fait, Panoramic évolue constamment, et même rapidement, selon l'envie de Jack, son créateur, et sous l'influence des suggestions et demandes des usagers. Je trouve que c'est une excellente formule et ai toute confiance qu'à terme, Panoramic réunira toutes les fonctions dont nous pourrions avoir besoin.
Quant à l'interface avec des DLL's d'autres langages, c'est compliqué. Ca marche avec des DLL's écrites en Delphi (Delphi 6 pour ma part), mais j'ai essayé différentes version de Fortran que je connaissais, mais rien à faire, malgré l'utilisation explicite de stdcall. Il doit y avoir une autre particularité qui n'est pas spécifiquement documéntée et qui joue. D'après mes infos, Panoramic est, au moins pour une large part, écrit en Delphi, ce qui prédestine peut-être Delphi comme outil de création de DLL's. C'est ce que je dirais après mes vains essais avec différentes versions de Fortran.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
Klaus

Klaus


Nombre de messages : 12274
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMar 10 Aoû 2010 - 11:11

@d.j.peters:
I checked about those "hidden" keywords. Panoramic colors them, as if they were official keyword, indeed. But during execution, they dont work but generate an invalid string expression message for dll_call0$, for instance.

So, just wait for future evolutions...
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
d.j.peters

d.j.peters


Nombre de messages : 77
Age : 59
Localisation : Germany
Date d'inscription : 31/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMar 10 Aoû 2010 - 11:17

Klaus@
thank you for testing and now you know what i was meaning :-)

jean_debord a écrit:
...BTW, I did not find how to use with PANORAMIC a DLL written in FreeBASIC. An example is here: ...

hello jean_debord@
i will take a look on your freebasic code
here are an example of:

how to get/return a string
how to get/return double (real in panoramic)
how to word,byte ...

All params in panoramic are 32 bit integers
so if you will read or write a REAL floating point number
you must use adr(MyValue) same for strings

note:
panoramic will call a DLL method as function
you should use only FUNCTIONS in your FB DLL never SUB.

You can see i use zstring ptr ptr as string param
this is what adr(txt$) returns

if you don't like this you can change it too
MyFunction (byref strParam as zstring ptr) as integer

in the sample GetDir() you can see how to get the size of an panoramic string

Tip:
put all your FB code inside of an EXTERN block.

extern "Windows-MS"
...
end extern


this is the key to use your dll functions with the same name

without the extern "Windows-MS" pragma

function MyFunction(byval param1 as integer,byvap param2 as double ptr) as integer

becomes the name "MYFUNCTION@8"

with it you can use "MyFunction" directly in panoramic

DJ
Code:
extern "Windows-MS"

' file
function SetDir(p as zstring ptr ptr) as integer export

  dim as zstring ptr pChars = p[0]
  dim as integer ptr pSize  = cptr(integer ptr,pChars)-1
  dim as integer l = *pSize
  dim as string path
  if l>0 then
    path = space(l)
    for i as integer = 0 to l-1
      path[i]=pChars[i]
    next
    return chdir(path)
  end if
  return 1
end function

function GetDir(p as zstring ptr ptr) as integer export
  dim as string f = CurDir()
  dim as integer lPath=len(f)
  dim as zstring ptr pChars = p[0]
  dim as integer ptr pSize = cptr(integer ptr,pChars)-1
  dim as integer l,lChars=*pSize
  if lChars>0 then
    if lChars<lPath then
      l=lChars
    else
      l=lPath
    end if
    for i as integer =0 to l-1
      pChars[i]=f[i]
    next
  end if
  return l
end function

function OpenFileRead(f as zstring ptr ptr) as integer export
  dim as integer hFile = freefile
  if open(*f[0],for binary,access read,as #hFile) then
    beep:return 0
  end if
  return hFile
end function

function OpenFileWrite(f as zstring ptr ptr) as integer export
  dim as integer hFile = freefile
  if open(*f[0],for binary,access write,as #hFile) then
    beep:return 0
  end if
  return hFile
end function

function CloseFile(hFile as integer) as integer export
  return close(#hFile)
end function

function FileSize(hFile as integer) as integer export
  return lof(hFile)
end function

function GetFilePos(hFile as integer) as integer export
  return seek(hFile)
end function

function SetFilePos(hFile as integer,bytepos as integer) as integer export
  function = seek(hfile)
  seek hFile,bytepos
end function

' read
function ReadByte(hfile as integer,byref v as integer) as integer export
  dim as ubyte b
  function = get(#hFile,,b)
  v=b
end function
function ReadWord(hfile as integer,byref v as integer) as integer export
  dim as ushort s
  function = get(#hFile,,s)
  v=s
end function
function ReadInteger(hfile as integer,byref v as integer) as integer export
  return get(#hFile,,v)
end function
function ReadFloat(hfile as integer,byref d as double) as double export
  dim as single s
  function = get(#hFile,,s)
  d=s
end function
function ReadDouble(hfile as integer,byref d as double) as double export
  return get(#hFile,,d)
end function
' write
function WriteByte(hfile as integer, v as integer) as integer export
  dim as ubyte b = v
  return put(#hFile,,b)
end function
function WriteWord(hfile as integer, v as integer) as integer export
  dim as ushort s = v
  return put(#hFile,,s)
end function
function WriteInteger(hfile as integer, v as integer) as integer export
  return put(#hFile,,v)
end function
function WriteFloat(hfile as integer,byref v as double) as integer export
  dim as single s = v
  return put(#hFile,,s)
end function
function WriteDouble(hfile as integer,byref v as double) as integer export
  return put(#hFile,,v)
end function

end extern
Revenir en haut Aller en bas
http://shiny3d.de
d.j.peters

d.j.peters


Nombre de messages : 77
Age : 59
Localisation : Germany
Date d'inscription : 31/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMar 10 Aoû 2010 - 11:47

hello jean_debord i'm back Smile

the problem with your FB dll it is exactly what i wrote
you have to use extern "Windows-MS" and end extern

and you have to change in your DLL test program

dll_on ranmt

to

dll_on "ranmt.dll"

thats all

DJ
FreeBASIC ranmt.bas
(fbc -dll ranmt.bas)
Code:
extern "Windows-MS"
function InitMT(Seed as integer) as integer export
  randomize Seed
  InitMT = 0
end function

function IRanMT as integer export
  IRanMT = int((rnd - 0.5) * 4294967296.0)
end function

function IRanMT1(N as integer) as integer export
  IRanMT1 = int(rnd * (N + 1))
end function

function IRanMT2(A as integer, B as integer) as integer export
  IRanMT2 = A + int(rnd * (B - A + 1))
end function

end extern


panoramic: test_ranmt.bas
Code:
dim f%, nt%, i%, d%, n%(6), khi2, diff

f% = 100      : ' Expected frequency for each number
nt% = 6 * f%  : ' Total number of runs

dll_on "ranmt.dll"

' Initialize random number generator
' (try different values)

i% = dll_call1("InitMT", 123456789)

' Do nt% runs
' Each number should appear about f% times

for i% = 1 to nt%
  d% = dll_call2("IRanMT2", 1, 6)
  n%(d%) = n%(d%) + 1
next i%

dll_off

' Compute khi2

khi2 = 0
for i% = 1 to 6
  diff = n%(i%) - f%
  khi2 = khi2 + diff * diff / f%
next i%

' Display results

print "Simulation of dice game"
print "-----------------------"
print
for i% = 1 to 6
  print "Frequency of "; i%; " = "; n%(i%)
next i%
print
print "khi2 = "; khi2

end
Revenir en haut Aller en bas
http://shiny3d.de
Klaus

Klaus


Nombre de messages : 12274
Age : 74
Localisation : Ile de France
Date d'inscription : 29/12/2009

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMar 10 Aoû 2010 - 17:34

Interresting ... I'll hava a look on this.
Revenir en haut Aller en bas
http://klauspanoramic.comxa.com/index.html
jean_debord

jean_debord


Nombre de messages : 1249
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 8:34

Yes, it works. Thank you very much !
Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
jean_debord

jean_debord


Nombre de messages : 1249
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 11:16

I have another question. How do you call these functions from PANORAMIC ?

Code:

function ReadFloat(hfile as integer, byref d as double) as double export
  dim as single s
  function = get(#hFile,,s)
  d=s
end function

function ReadDouble(hfile as integer, byref d as double) as double export
  return get(#hFile,,d)
end function
Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
Invité
Invité




Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 13:16

Désolé de poser cette question, mais est-ce que sur les sites américains, on intervient en français.
Que provisoirement on explique à un étranger, dans sa langue ou une langue qu'il comprend, un problème, je trouve cela normal, mais qu'un français fasse dorénavant ses commentaires en anglais, c'est un peu abuser!

Depuis quelques temps, ce forum me prend la tête!
ET qu'on ne vienne pas me dire que pour faire de l'informatique, il faut parler anglais, comme je l'ai entendu mainte fois!, et nous prendre pour des imbéciles, que l'on ne comprenne pas cela!
Les étrangers ont bien de la chance. Moi pour le GFA Basic, je n'ai eu que des explications en allemand ou en ANGLAIS. Les étrangers se foutent de vouloir exporter leurs explications en français, mais veulent qu'on leur servent à leurs pieds ce qu'ils désirent.

Je boude ce forum quelque temps, et voir ensuite ce qu'il devient! Je ne me relis , même si il y a plein de fautes, cela m'énerve


Dernière édition par cosmos70 le Mer 11 Aoû 2010 - 22:07, édité 1 fois
Revenir en haut Aller en bas
JL35




Nombre de messages : 7095
Localisation : 77
Date d'inscription : 29/11/2007

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 14:26

Il faut bien reconnaître que cosmos n'a pas entièrement tort, d'autant plus qu'il existe une version en langue anglaise du forum où tout ceci serait peut-être plus approprié.
Revenir en haut Aller en bas
Nardo26

Nardo26


Nombre de messages : 2294
Age : 55
Localisation : Valence
Date d'inscription : 02/07/2010

Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 21:26

Heu...
s'cusez moi...
c'est bien le forum de panoramic ou de freebasic ?
svp,
comme ça ....
là, pour voir..... Question




PS: bien que ça m'arrive de mettre quelques lignes de C ou de Delphi...
Mais il faut bien s'auto-critiquer... n'est-ce pas ? Wink


Revenir en haut Aller en bas
http://nardo26.lescigales.org
jjn4

jjn4


Nombre de messages : 2689
Date d'inscription : 13/09/2009

Adr(Array%(0)) ? Empty
MessageSujet: +++   Adr(Array%(0)) ? EmptyMer 11 Aoû 2010 - 22:40

Il est vrai que les critiques
de cosmos et nardi
sont finalement assez justes
et qu'on aurait tendance
un peu à s'égarer, ces temps-ci.
Bon, on pourra toujours dire
qu'on peut tout simplement passer,
si on n'aime pas, ce que je fais.
La question est :
est-ce un enrichissement
ou une sorte de dérive ?
Je laisse la question à débattre...
scratch
Revenir en haut Aller en bas
http://jjn4.e-monsite.com
Contenu sponsorisé





Adr(Array%(0)) ? Empty
MessageSujet: Re: Adr(Array%(0)) ?   Adr(Array%(0)) ? Empty

Revenir en haut Aller en bas
 
Adr(Array%(0)) ?
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Array
» Effacement d'un Tableau ( Array )

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: PANORAMIC :: A l'aide!-
Sauter vers: