[FR] [EN]
  [INFO] [COMRPA] [MAPPA] [RISORSE]

QUICK ACCESS

CONVERTING FROM FBII
SINFUL SYNTAX FROM FBII
PREFERENCES

[return to FAQs page]
[next FAQsheet]
[previous FAQsheet]

Ultimo aggiornamento:
21 Gen 2000

FAQsheet #4 :: FROM FBII TO FB^3
CONVERTING FROM FBII

[Q]: Opening an FBII project, the order of includes in the project window is alphabetical. Isn't it better to place the includes in the order in which they appear in the code?
[A]: You can (and probably should) move the includes to any order you want; I would assume that the autoconverter has no idea what order you want the files in, so it uses alphabetical, just as they would have appeared in the FBII project manager.

[Q]: In a FutureBASIC project, the "DIM ALL VARS" option doesn't detect any un-DIMed variables! I narrowed down to there isn't any GLBL file in the project. Also all FNs in the .INCL are self contained but that doesn't seem to be a factor. When I took all of the GLOBALS out of the main file and put them into a .GLBL file, the compiler detects this error.
[A]:  You probably have an old compile line in the project that needs to be removed.

[Q]:  I replaced the runtime.INCL and filters for my project with the new ones, but still got 15 warnings like this:
"Warning: This toolbox call does not return a result.
The compiler has forced a result of zero.
in file Studio Manager.*:RUNTIME.INCL at line 219 in PGREPLACERES
OSErr = FN HNOPURGE(resHndl&)"
[A]:  Some of these toolbox calls have no return value give this warning now to let you know that OSErr will not have any actual usable value. If you change your call to CALL HNOPURGE() (the CALL can be optional of course), then you won't get the warning.

[Q]:  I can't find an easy way to open and convert a single include. I have opened and saved includes in FB3 which retain their FBII icon, and start FBII when double clicked.
[A]:  If I understand what you want to do you just need to change the creator of the file from FBII (ZBAS) to FB^3 (FB^e). I use Snitch to do this but you can also do this with ResEdit or Resourcerer.

[Q]:  I have a data acquisition program that talks to National Instruments A/D cards. This is done through 20 or 30 small functions provided by Nat. Instruments for FBII. They all use the CALL F&(...) structure, which FB^3 doesn't seem to like.
[A]:  I think that the functions provided by National Instruments are at fault. They only worked in a haphazard manner in FBII. Programs would often fail through no fault of the programmer because of the way NI arranged things. We are working with them to modernise the code [...]
???
Try This
LOCAL MODE
DIM f&,longVal&
LOCAL FN Lab_ISCANCheck(devNum&, ¬
  bdstatus&, retrieved&, scanOrder&)
  _xParams=_Pascalstk_rtnLong_p1long_p2Long_p3Long_P4Long
f&=[FN libraryResource&] + _LabISCANCheck
longVal&=universalfn(f&,_xParams,devNum&,¬
  bdstatus&,retrieved&,scanOrder&)
END FN=LongVal&
Untested but should work in general PPC & 68k
???  

[ritorna all'inizio]

[Q]:
  In FBII, I used to have many statements as:
TEXT _monaco,9,,
with two terminal commas indicating no change in face and copy mode.
In FB3, I get an error "A Numeric or String value expected here".

[A]:  Inserting values (e.g. zeros) eliminates the error: TEXT _monaco,9,0,0

[Q]:  The following Toolbox calls are missing:
• UpperText
• LowerText
• StripText
• StripUpperText
• UprString
Is it possible to have them added?
[A]:  These are considered obsolete by Apple. They have become
• UppercaseText
• LowercaseText
• StripDiacritice
• UppercaseStripDiacritics
• UpperString

The Tlbx Standard.Incl Header file has all of these, and at the very end of the file a LOCAL FN UprString is defined which you can call like any local function. To make use of this and the new TOOLBOX calls include this file in the headers of your project. The first four of these have a third argument not present in the older calls I believe. I think the following will work to get started:
window 1
dim a$
a$ =3D "Hello2You"
LowercaseText(@a$, len(a$),0)
print a$
fn UprString(@a$)
print a$
do
until fn button


[Q]:  OK, I give up! What are the constants for the Apple Menu when it's in a resource...?
[A]:  Print _AppleResMenu, _AppleMenu
FBII: 127,255
FB3: 127,254

[Q]:  Just a note to suggest that the fact that FB^3 is not case sensitive might be mentioned in the conversion docs. I could not find it there and the issue was unclear to me as it is apparently to others.
[A]:  OK

[Q]:  I believe we need to know when and where rounding occurs. I tried the following:
When you do: You get:
a% = 99.49 a% contains 99
a% = 99.5 a% contains 100
a% = 199/2 a% contains 99
a% = 199\2 a% contains 100

a# = 199/2
a% = a# a% contains 100

a$ = USING"###.#";100.54 a$ contains 100.5
a$ = USING"###.#";100.55 a$ contains 100.5
a$ = USING"###.#";100.555 a$ contains 100.6
a$ = USING"###.#";100.56 a$ contains 100.6

a# = 0.1234567895
a& = a# * 1000000000 a& contains 123456790
(non-project, FBII emulation) Hope this may be useful.
[A]:  OK, Thanks

[Q]:  Why does the beach ball stop spinning?
[A]:  The delay happens after the compiler has finished and has saved everything to disk and sublaunches the new application. At this point, the system has to purge the file cache before the sublaunch and then open the new app. That is where the ball stops spinning.

[Q]:  Under FBII a DEF FN had to use USING and then have that FN globalised. The new way eliminated the need of the USING and the Global that followed. All of my widows must be available for a "Btn Click Call" by/in each others Dialogue .. So, in FBII, I used this "Clustered" Window Global and its Constant
DIM gB1ContntWIND&
_contnt1WIND = 1
DIM gB2ContntWIND&
_contnt2WIND = 2
etc.
As I Understand it .. Now the DEFed FN is, (For practical purposes) a combined Global and defined FN .. Therefore, by using the below "Clustered" Window Constant & DEFed Window FN, I eliminate the need of the window FN being Globalised .. The DEFed FN will be available regardless of where in the project it is called just as if it was Globalised
_contnt1WIND = 1
DEF FN B1ContntWIND
_contnt2WIND = 2
DEF FN B2ContntWIND
etc.
If the above is true .. Then it would be practical to use Globalised Variables and DEFed FNs as a component of several FNs
[A]:  Not exactly right. FBII used the global address to recall the function. In other words, it jumped to the DEF FN USING line which in turn jumped to the real FN. FB^3 only wants a prototype. It need to know, when you used a function, if the parameter "x" (or whatever) is supposed to be passed as a long on an int. FB^3 does not jump to the DEF FN, it just uses it to see how parameters are arranged. And it is only required when the function is called before it is defined.

[Q]:  BLOCKMOVE (ptr1&,ptr2&,blkSize&)
When I use that in my FB^3 code, it doesn't like the parentheses. I looked at my old code, and of course, there are no parentheses.
[A]:  BLOCKMOVE is both a Toolbox and a (redundant) FB^3 Runtime call. The Editor always hilites it as though it is Runtime, but the compiler can tell the difference if you precede the Toolbox version with CALL.
DIM ptr1&,ptr2&,blkSize&
CALL BLOCKMOVE (ptr1&,ptr2&,blkSize&)
or
BLOCKMOVE ptr1&,ptr2&,blkSize&
The Runtime version just calls the Toolbox BLOCKMOVE, and incurs a tiny penalty of a few extra instructions compared with the direct call. The functionality of the two versions is identical.
The situation with hiliting of LINE and CALL LINE is similar. But the Runtime FB^3 LINE works very differently from the Toolbox CALL LINE.  

[ritorna all'inizio]

SINFUL SYNTAX FROM FBII

[Q]:  Not allowing declared handles to have the "&" suffix requires some fairly extensive changes to avoid confusion. And what about the BUTTON& function, that returns a handle? Should it be renamed? (In FBII example files, Many variables acting as pointers (even though they're often called addresses) also had the "&" suffix.
[A]:  A handle is a long, but a long is not necessarily a handle.
DIM something.8 could be a rectangle or something else
DIM something AS RECT is a rectangle.  

[ritorna all'inizio]

PREFERENCES

[Q]:  Once you have chosen match FBII with the new match FBII button, how do you unchoose it?
[A]:  Press the cancel button.

  © 2000 Pix&Mix
  Tutti i diritti riservati
INFO  |  ACQUISIRE  |  MAPPA  |  RISORSE

  FutureBASIC è un marchio registrato di Staz Software, Inc ed è usato previa autorizzazione.