Announcement

Collapse
No announcement yet.

C2PB

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

  • C2PB

    Has anyone updated the C2PB program for PBwin ? And does it
    work very well ?

    The c2pb.exe gives me an error and since I dont have pb35
    i cant compile it. (Could type it in line by line i guess in
    trypb32).

    I could try it in QB45 but i'd have to convert the inline assembly
    code to call absolute and im not an expert on asm.

    I've got that unzip.c program (from the zlib site) and wanted
    to convert it to pb. Supposedly it doesnt need a dll like zlib
    to work (but if im all wet about that let me know). Thanks

    ------------------
    Client Writeup for the CPA


    mailto:[email protected][email protected]</A>
    Client Writeup for the CPA

    buffs.proboards2.com

    Links Page

  • #2
    ..updated the C2PB program for PBwin
    ..
    I could try it in QB45 but i'd have to convert the inline assembly code to call absolute and im not an expert on asm.
    Do you mean converted the c2pb program to run as a Windows application, or do you mean changed it to convert Windows 'C' to Windows 'PB'?

    If the former and you have the PB/DOS source code, I'm sure someone can compile it for you and you can run it as a DOS application. Post a link to the PB-DOS source code and an email address and I'll bet a ZIP archive shows up in your inbox in a day or so.

    If the latter, I think I'd eschew anything automated and just write the PB/Windows code from scratch.

    MCM


    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I have the pbdos source code and i am attempting to convert it
      to pbcc now. (It's available on the PowerBasic downloads).

      It included the exe but gives an error when I try to run it
      on ME.Perhaps it needs a runtime module.

      ------------------
      Client Writeup for the CPA


      mailto:[email protected][email protected]</A>
      Client Writeup for the CPA

      buffs.proboards2.com

      Links Page

      Comment


      • #4
        It included the exe but gives an error when I try to run it on ME.
        Perhaps it needs a runtime module.
        Perhaps it has an error <U>message?</U>




        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Michael, none that I can find. It does have an errmsg$(E$) sub
          but as far as I can tell it is never called. No on error or if
          err statements, etc.


          ------------------
          Client Writeup for the CPA


          mailto:[email protected][email protected]</A>
          Client Writeup for the CPA

          buffs.proboards2.com

          Links Page

          Comment


          • #6
            I downloaded the package and ran "C2PB.EXE" from command line and got...
            Code:
            Error 64 at pgm-ctr: 1281
            D:\Work>
            So I looked up error 64:
            Code:
            Error 64:  Bad file name
            
            The file name specified in a FILES, KILL, or NAME statement contains
            invalid characters.
            Then I looked in source code for FILES, KILL or NAME (via Ultra-Edit regular expression) and found these lines:

            Code:
            IF DIR$(PbFile$) <> "" THEN KILL PbFile$
            IF DIR$("Temp248.bas") <> "" THEN KILL "Temp248.bas"
            IF DIR$("Temp249.bas") <> "" THEN KILL "Temp249.bas"
            The only one with any possibility of invalid characters is the first one.

            So I did compile, find error on the source and it told me the error was
            at the statement following:
            Code:
            IF DIR$(PbFile$) <> "" THEN KILL PbFile$
            So I found the error. For all the good it does.

            Looking at the source code, it looks like it wants a filename or something on the command line and manufactures PBFile$ from that. But you'd never guess that from either the readme or the comments at the start of the program.

            The readme also says..
            C2PB is a beta version.
            Gee, I wonder why. For sure the doc ain't done and the error handling is incomplete.

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              I agree. I got past that after a conversion to cc.
              Im having to put so many print statements to tell where the
              error(s) come up. Im afraid once i get one fixed the next step
              will give me an error.

              As I said in the first message i wanted to convert unzip.c so
              that it could be put in a program (hopefully without a dll).
              I have used zlib in the past and it works fine just wanted something
              i could include in one program.
              ------------------
              Client Writeup for the CPA


              mailto:[email protected][email protected]</A>

              [This message has been edited by Fred Buffington (edited August 27, 2006).]
              Client Writeup for the CPA

              buffs.proboards2.com

              Links Page

              Comment


              • #8
                Something doesn't make sense here.

                If C2PB.EXE is designed to convert MS-DOS C to MS-DOS BASIC (I think that is what it was designed to to do, but then again the doc is a little short on trivialities such as this), and you don't use the PB-DOS compiler, why are you even bothering to convert from C to MS-DOS BASIC?

                About all I can guess is that you have some kind of 'no user interface' (batch) 'C' program. What does this program do? You sure there isn't already an alternative to this C program posted here...written using <U>Windows</U> BASIC?

                What does this 'C' program do?

                Ok, I found it..should have re-read this whole thread again, sooner)
                I've got that unzip.c program (from the zlib site) and wanted to convert it to pb [Windows].
                Hmm, found this:

                http://www.powerbasic.com/support/forums/Archives/Archive-000003/HTML/20020808-6-0 00644.html

                And then I found six or seven more doing a search on 'zip unzip', any of these words, Source Code Forum, message subject, all dates.

                Just a couple of quick glances at those, looks like those refer to a free DLL, and others have already created the header files for you.

                No, it doesn't look like source code, but it sure looks like an API for your Windows program.

                Supposedly it doesnt need a dll like zlib to work (but if im all wet about that let me know).
                These all appear to require a DLL, but you can stay dry even using DLLs. DLLs are nothing to be afraid of, and probably something every serious Windows programmer needs to master anyway. ('Probably' is an understatement).

                MCM



                [This message has been edited by Michael Mattias (edited August 28, 2006).]
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  the unzip.c is a part of the free zip-unip stuff which is where zlib
                  comes from too. As i said, I've used zlib.dll in the past and it
                  works just fine. What I wanted was to put the unzip code
                  into a program like a setup program -- all in one. Currently i
                  use a self extracting exe that calls my setup program that does
                  some extra things necessary to set up the program. That works fine
                  too. Just really wanted to get the unzip code (I still have the
                  calls to zlib in my setup source though i am not currently using
                  it because the self extracting exe unzips it.)

                  You are correct that the c2pb is a pbdos program. I thought i would
                  be able to port it to pbcc or pbwin and run it with some modification.
                  Actually got the pbcc to compile but get a gpf at some point.

                  It talks about the cpp program which I ran that apparently takes out
                  the remarks /* to */ and inserts the code from the hearder files.
                  into a 'preprocessor' file. but even running this on the c2pb gets
                  an error. So....

                  Thanks for looking into it anyway, michael. I dont know if unzip.c
                  really replaces the zlib unzip portion or not but have been looking
                  for something that would for some time. I thought others could use it too.




                  ------------------
                  Client Writeup for the CPA


                  mailto:[email protected][email protected]</A>
                  Client Writeup for the CPA

                  buffs.proboards2.com

                  Links Page

                  Comment


                  • #10
                    what i wanted was to put the unzip code into a program like a setup program -- all in one
                    ah, ye olde 'i only want one file so ye olde usere can download conveniently tricke?"

                    you could do what i did at one from column a, one from column b...

                    what that was was to store the zlib dll as a program resource, extract it to disk at run time, and call the required functions after doing a loadlibrary on the temp file. works good.


                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      That sounds like a great idea Michael. Not sure i understand
                      exactly how to put the dll into the userdefined resource.

                      I could then delete the dll from the disk when done with it
                      i presume, if i wanted to.

                      I do understand loadlibrary though I seldom, if ever, use it.

                      As far as resource files pbrs all i've ever used them for
                      was icons and bitmaps although i have seen code of people using
                      them for dialogs and such..

                      I assume the script is just a sample and you "change the name to
                      protect the innocent".LOL.



                      ------------------
                      Client Writeup for the CPA


                      mailto:[email protected][email protected]</A>
                      Client Writeup for the CPA

                      buffs.proboards2.com

                      Links Page

                      Comment


                      • #12
                        Links to everything you need are in the post. But it's really pretty simple:
                        Code:
                        // myprog.rc
                        
                        ZLIB    STUFF   "zlib.dll"
                        In your program use the "ResourceAsString" function (linked via above) to get the zlib.dll file as a string and save it a file. (I think that takes, what, four-five lines of code?).

                        Sure, you'll have to call the zlib functions with CALL DWORD, but what are you actually using, two or three of 'em?


                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Well actually im not using zlib right now,

                          I use PowerZip to make a self extracting exe that puts the files
                          where i want them then calls my setup.exe which is one of the
                          files in the archive along with the others.

                          I tried using inno and it wrote the files fine but when I access
                          my menu from the desktop link it puts a bunch of stuff (links to
                          data files) on the desktop so i know i've got something screwy
                          defined there but...

                          ... but what are you actually using, two or three of 'em?
                          Two or three of what ? Not clear on what you meant there.

                          ------------------
                          Client Writeup for the CPA


                          mailto:[email protected][email protected]</A>

                          [This message has been edited by Fred Buffington (edited August 28, 2006).]
                          Client Writeup for the CPA

                          buffs.proboards2.com

                          Links Page

                          Comment


                          • #14
                            In your program use the "ResourceAsString" function (linked via above) to get the zlib.dll file as a string and save it a file. (I think that takes, what, four-five lines of code?).
                            Sorry to be off topic but I wanted to say thanks for that little trick. That's a pretty cool way to pack DLL's (or any binary data really) with an EXE file. I've only messed around with the resource compiler to have icons and things like that. Looks like I'll have to revisit it.

                            Thanks again,
                            Flick


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

                            Comment


                            • #15
                              >Two or three of what ?

                              Functions. i.e., you don't have to set up the [CALL DWORD] USING prototypes (DECLARE statements) for the entire set of functions in the DLL, just for the functions you are actually using. The Tour application referenced in my linked post uses exactly one (1) function from ZLIB.DLL.

                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                oh ok michael. I think all i used to call was the extract to
                                a particular path.

                                Well i had taken out the unzipit code but found it in an older
                                version and there are four functions called but they are all declared
                                in the zlib include file. So, it should be a snap to use it like
                                that. Thanks Michael.

                                ------------------
                                Client Writeup for the CPA


                                mailto:[email protected][email protected]</A>
                                Client Writeup for the CPA

                                buffs.proboards2.com

                                Links Page

                                Comment


                                • #17
                                  Amazing how "Has anyone updated the C2PB program for PBwin?" was solved simply by stating the application requirements.

                                  Simply Amazing.

                                  Michael Mattias
                                  Tal Systems (retired)
                                  Port Washington WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment

                                  Working...
                                  X