Announcement

Collapse
No announcement yet.

A few questions...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jeffrey Morris
    replied
    Randi, About filenames and pathnames, if you are writing a 32-bit Windows program, it can use long filenames and long pathnames such as "C:\My Documents\Letter to Mommy.doc" but if you are writing a 16-bit program for DOS or Windows, you have to use short filenames and short pathnames such as "C:\MYDOCU~1\LETTER~1.DOC"


    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Originally posted by Randi Dertzo:
    Hello everyone,

    We are attempting to convert a program from Basic to PB and we are having a few problems that I hope you will have some answers to...
    The program has been in use for a long time and has grown quite a lot over the years. It now has near 1000 sources files (Basic & Assembly). So the following questions might have simple solutions but keep in mind that the less we have to significantly modify, the better considering the size of this program.

    1 - Compile errors
    I'm currently converting a small part of the program (it uses about 100 of the 1000 units) to PB and VISION. I created five forms with the help of Workshop to give it a new look (it has to remain a « pure » DOS program, no 32 bit).

    When I compile only the code generated from Workshop (no code behind buttons, etc), it compiles OK.

    However, when I add the original code (converted to PB format of course) then the problems begin. Now, when I attemp to compile, my computer locks up and the reset button is the only thing I can use. Once, the compilation got throught without freezing the computer, but gave me the following error:
    "String too big"
    (There was no error number)
    What does this mean? How can I know what "String" it's referring to?

    Another compilation gave me an error 517 so I tried compiling my program to a pure DOS machine but resulted in the same ending(freeze). Whatever I use, (Win 95 console, DOS mode in WIN95, pure DOS environment with more exp/ext memory) it freezes most of the time or gives me this "string too big" error message.

    I would like to hear your thoughts on the source of this problem as I’m out of ideas...

    2 - Segments
    We are using CODE SEG in all our units as it exceeds the 64K limitations(Error 408). When the compilation is done, it gives us how many segments and how much space they use. Is there a way to know what CODE SEG statement is associated with what segment size? Also, is there a way to know how many space takes our variables so we can know how far/close we are to the 64K variable limitation (error 409)?

    3 - Parameters in fct/sub
    Is there any way to pass more than 16 parameters to a function or sub? Our current program have a number of sub that passes much more that 16 parameters (a few one have as much as 40 or more wich Basic allowed). The only solution that we thought about is to make all those variables PUBLIC/EXTERNAL but we would like to know if there is another way of doing this so we can leave all the parameters as is...

    4 - TYPE and Strings in subs
    I'm trying to pass a variable member of a TYPE into a sub like this:
    In the main program
    TYPE TestA
    Var1 AS STRING
    Var2 AS STRING * 8
    END TYPE

    In a unit:
    DIM TypeA AS TESTA

    call MySub (TypeA.Var1, TypeA.Var2, Var3$)

    In another unit:
    SUB MYSUB (SubVar1$, SubVar2$, SubVar3$) PUBLIC
    […treatment…]
    END SUB

    Var1/SubVar1$ and Var2/SubVar2 both gives me a parameter mismatch when I try to pass them BYREF. How can this be? True the string is part of a TYPE but it's still a string right? Does the language considers a varialble in a TYPE an expression? Passing it BYVAL generates no errors but we can’t pass those variables this way as the value has to change wihtin the called sub. We can’t exactly redefine the parameter in the sub either because it’s not always a TYPE variable that is passed. Most of the time, it’s a variable-lenght string. Passing a fixed-lenght string also generates a parameter mistmatch. Is it possible to declare the parameter in the sub definition so it can accept strings defined in TYPE, fixed-lenght and variable-lenght?

    Any input on any of the above questions would be a tremendous help to us.
    Thank you for your time,
    Randi

    Hi Randi,

    I'm very interesting in your project.
    Can you please me email the source code and the forms created in
    PBVISION.
    Do like it PBVISION or PBWORKSHOP?
    Have you have experence in this tools?

    Kind regards,

    Can you please me now email it to me?
    Thanks

    email : [email protected]

    Kind regards,
    stephane




    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Originally posted by Randi Dertzo:
    Stephane,

    I'm using Workshop to build my interface. The main menu and the five sub-menus with all buttons, lables and textboxes are created. Then, I use the Application Generation to create my souorce code (all inline code).
    Finally, I complete the looks and feel of the applicaiton using regular Vision routines and funcitons. (Cutomizing the desktop adding exit keys, etc)

    Jeffrey,

    Pardon my ignorance but why do you ask? The program is working fine with Basic 2 and 7. As for the 32k+ string limitaiton, it is very unlikle that a string varialbe in the part of program I'm compiling is taking that much caracters. They are mostly used in this case to store paths and file names...

    Alan,
    ASM:
    Althought the main program has object files in it (yet to be converted), I didn'T include any in this program. I create a dummy sub to replace the ASM code for now.

    $SEGMENT:
    As for $SEGMENT, I don't use those, I use $CODE SEG and have units.

    Parameters:
    I was afraid you were going to say that about TYPE passed byref...
    This will involve major changes in the prog as I mentionned before, different TYPEs, fixed and variable lenght string are currently passed in the same variable BYREF...

    XMS:
    In a win95 console, XMS & EMS is maxed out. I don't remember in the DOS machine. You said that you had no memory problems when compiling (at least it didn't freeze) How many XMS and EMS did you have available? Where you using a DOS console?

    Thanks again for all your input.


    Hi Randi

    Can you please send the source code en the templates created with
    with PBVISION/WORKSHOP then have I an idee to look out the code and
    can you please send me an exe-application to my emailadres
    email: [email protected]

    Best regards,
    stephane




    ------------------

    Leave a comment:


  • Alan Earnshaw
    replied
    Randi,

    As far as my EMS and XMS settings, my main computer is running Windows 95 with 32 MB RAM (I really need to upgrade this box).

    PowerBASIC can use up to 4 MB of expansion memory. It prefers EMS, but will use XMS or disk if necessary. In my case, I have up to 16 MB free EMS and up to 31 MB free XMS.

    Alan

    ------------------
    Alan C. Earnshaw
    Information Management Systems, Inc.
    http://www.infoms.com

    Leave a comment:


  • Jeffrey Morris
    replied
    Randi, How long are the paths and filenames being stored by the string variables? I think that the maximum number of characters at the DOS prompt is about 128 bytes and the strings held in variables are too long. Jeffrey.


    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Stephane,

    I'm using Workshop to build my interface. The main menu and the five sub-menus with all buttons, lables and textboxes are created. Then, I use the Application Generation to create my souorce code (all inline code).
    Finally, I complete the looks and feel of the applicaiton using regular Vision routines and funcitons. (Cutomizing the desktop adding exit keys, etc)

    Jeffrey,

    Pardon my ignorance but why do you ask? The program is working fine with Basic 2 and 7. As for the 32k+ string limitaiton, it is very unlikle that a string varialbe in the part of program I'm compiling is taking that much caracters. They are mostly used in this case to store paths and file names...

    Alan,
    ASM:
    Althought the main program has object files in it (yet to be converted), I didn'T include any in this program. I create a dummy sub to replace the ASM code for now.

    $SEGMENT:
    As for $SEGMENT, I don't use those, I use $CODE SEG and have units.

    Parameters:
    I was afraid you were going to say that about TYPE passed byref...
    This will involve major changes in the prog as I mentionned before, different TYPEs, fixed and variable lenght string are currently passed in the same variable BYREF...

    XMS:
    In a win95 console, XMS & EMS is maxed out. I don't remember in the DOS machine. You said that you had no memory problems when compiling (at least it didn't freeze) How many XMS and EMS did you have available? Where you using a DOS console?

    Thanks again for all your input.

    Leave a comment:


  • Alan Earnshaw
    replied
    Randi,

    I have not had the compiler lock up during compilation (and I have written some very large programs), so I do not know what is causing the problem for you. Are you trying to link in any .OBJ files? If you type MEM /C/P at the console prompt, how much EMS and XMS is there (total amount and unused amount)? Have you tried using PBC.EXE (the command line compiler)?

    When you use $SEGMENT to break your program into segments, PowerBASIC uses internal segment names. You can access the Compile menu and select Get Info to see the size of each segment; generally, the last segment listed is the last section of your program (after the last $SEGMENT metastatement). If you are using Units or .OBJ files, it is not quite so simple.

    PowerBASIC cannot accept more than 16 parameters per procedure or function. If you need to pass more data, you can pass an array or combine the parameters into a single TYPE variable. I have done both with good results.

    When you define a string in a TYPE variable, it is a fixed length string, not a dynamic string. If your TYPE is defined as:

    Code:
    TYPE UserType
      UserName AS STRING * 15
      Password AS STRING * 8
    END TYPE
    I believe you can pass the individual members of the TYPE to a procedure or function, but you must make sure the parameters are the same:

    Code:
    SUB CheckPassword(UserName AS STRING * 15, _
      Password AS STRING * 8)
      ' check the password
    END SUB
    
    DIM x AS UserType
    x.UserName = "Alan"
    x.Password = "password"
    CALL CheckPassword(x.UserName, x.Password)
    Finally, it is not trivial to convert code from one Basic dialect to another, especially assembler code. PowerBASIC's string engine is different from every other Basic ever made (and much better, in my opinion), so if the assembler code accesses dynamic strings, your assembler code is guaranteed to fail under PowerBASIC. There are also a number of other differences at the assembler level (for example, MS Basic uses DGROUP for the name of its data segment, PowerBASIC does not).

    I recommend you post a short assembler routine here (original and your conversion to PowerBASIC). I'm sure many of us would be happy to offer suggestions, point out pitfalls, etc. (Shameless plug alert) My company publishes BASICally Speaking, a newsletter for PowerBASIC programmers. You might wish to order some back issues to help you get started on the process. A list of available issues is at http://www.infoms.com/backiss.htm , and you can download the source code from every issue at http://www.infoms.com/archives.htm .

    In any case, good luck with your project!

    Alan


    ------------------
    Alan C. Earnshaw
    Information Management Systems, Inc.
    http://www.infoms.com

    Leave a comment:


  • Jeffrey Morris
    replied
    Randi, Which BASIC compiler or interpreter were you using to write the program before trying to port the program to Power BASIC? If you use BASIC interpreter, all of the code must fit within 64 KB of memory. If you use BASIC compiler, each subroutine and function must fit within 64 KB of memory. Strings can't have more than 32,767 characters. Jeffrey.


    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Hi,

    I'm very interesting in your project.
    Can you please me email the source code and the forms created in
    PBVISION.
    Do like it PBVISION or PBWORKSHOP?
    Have you have experence in this tools?

    Kind regards,

    Can you please me now email it to me?
    Thanks

    email : [email protected]

    Kind regards,
    stephane



    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest started a topic A few questions...

    A few questions...

    Hello everyone,

    We are attempting to convert a program from Basic to PB and we are having a few problems that I hope you will have some answers to...
    The program has been in use for a long time and has grown quite a lot over the years. It now has near 1000 sources files (Basic & Assembly). So the following questions might have simple solutions but keep in mind that the less we have to significantly modify, the better considering the size of this program.

    1 - Compile errors
    I'm currently converting a small part of the program (it uses about 100 of the 1000 units) to PB and VISION. I created five forms with the help of Workshop to give it a new look (it has to remain a « pure » DOS program, no 32 bit).

    When I compile only the code generated from Workshop (no code behind buttons, etc), it compiles OK.

    However, when I add the original code (converted to PB format of course) then the problems begin. Now, when I attemp to compile, my computer locks up and the reset button is the only thing I can use. Once, the compilation got throught without freezing the computer, but gave me the following error:
    "String too big"
    (There was no error number)
    What does this mean? How can I know what "String" it's referring to?

    Another compilation gave me an error 517 so I tried compiling my program to a pure DOS machine but resulted in the same ending(freeze). Whatever I use, (Win 95 console, DOS mode in WIN95, pure DOS environment with more exp/ext memory) it freezes most of the time or gives me this "string too big" error message.

    I would like to hear your thoughts on the source of this problem as I’m out of ideas...

    2 - Segments
    We are using CODE SEG in all our units as it exceeds the 64K limitations(Error 408). When the compilation is done, it gives us how many segments and how much space they use. Is there a way to know what CODE SEG statement is associated with what segment size? Also, is there a way to know how many space takes our variables so we can know how far/close we are to the 64K variable limitation (error 409)?

    3 - Parameters in fct/sub
    Is there any way to pass more than 16 parameters to a function or sub? Our current program have a number of sub that passes much more that 16 parameters (a few one have as much as 40 or more wich Basic allowed). The only solution that we thought about is to make all those variables PUBLIC/EXTERNAL but we would like to know if there is another way of doing this so we can leave all the parameters as is...

    4 - TYPE and Strings in subs
    I'm trying to pass a variable member of a TYPE into a sub like this:
    In the main program
    TYPE TestA
    Var1 AS STRING
    Var2 AS STRING * 8
    END TYPE

    In a unit:
    DIM TypeA AS TESTA

    call MySub (TypeA.Var1, TypeA.Var2, Var3$)

    In another unit:
    SUB MYSUB (SubVar1$, SubVar2$, SubVar3$) PUBLIC
    […treatment…]
    END SUB

    Var1/SubVar1$ and Var2/SubVar2 both gives me a parameter mismatch when I try to pass them BYREF. How can this be? True the string is part of a TYPE but it's still a string right? Does the language considers a varialble in a TYPE an expression? Passing it BYVAL generates no errors but we can’t pass those variables this way as the value has to change wihtin the called sub. We can’t exactly redefine the parameter in the sub either because it’s not always a TYPE variable that is passed. Most of the time, it’s a variable-lenght string. Passing a fixed-lenght string also generates a parameter mistmatch. Is it possible to declare the parameter in the sub definition so it can accept strings defined in TYPE, fixed-lenght and variable-lenght?

    Any input on any of the above questions would be a tremendous help to us.
    Thank you for your time,
    Randi
Working...
X