Announcement

Collapse
No announcement yet.

Compile error question?

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

  • Paul Panks
    replied
    Hello,

    I'll be doing this shortly. Thanks everyone!

    Sincerely,

    Paul Panks
    [email protected]


    ------------------
    Few cats act their age, while
    most just cough up furballs.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    From an earlier post, I know that Paul already upgraded to PBCC 3.0, so he only needs to change his old SCRNIO include file for the updated include file above posted. Easier impossible!


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

    Leave a comment:


  • Lance Edmonds
    replied
    The "reliability" problem is with [some versions of] Windows, not PB/CC. The problem can arise with certain console screen sizes, where the screen buffer may not 100% "linear" and thus those routines will fail to work correctly as they do not take that aspect into consideration.

    However, if your program is not using such screen sizes (and your program has been around for long enough that it's likely to have been tested thoroughly on a wide range of Windows versions), so you should be fine to continue using the routines (suitably adapted to PB/CC 3.0).

    PowerBASIC discontinued supplying those routines because some of our customers may use such screen sizes, and and as such, it's not really in our best interests to offer a set of routines that may not work reliably in all circumstances, hence SCRNIO.INC was dropped from the PB/CC 3.0 distribution set.

    So, there would appear to be be very little stopping you from upgrading to 3.0... for example, the CUR member conflict (?) should be solved with a simple search+replace operation, and you'll be away laughing (leaving the "Out Of Main Memory" error far behind).

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Guest's Avatar
    Guest replied
    paul,

    scrnio.inc doesn't compile in pbcc 3.x because uses the reserved word cur as a member of the screenbufferdata type. i have changed cur for curdat and it works. however, tom said to you that this routine is unreliable, see:
    http://www.powerbasic.com/support/pb...ad.php?t=15807

    here is the modified scrnio.inc (tested with pbcc 3.02):
    Code:
    '===============================================================================
    '
    '  rudimentary "window" routines for pb/cc
    '  copyright (c) 1998,1999 powerbasic, inc.
    '  all rights reserved.
    '
    '  requires win32api.inc
    '
    '  does not clip output to the screen buffer.  if you overwrite the screen
    '  buffer, a gpf can occur.
    '
    '===============================================================================
    
    %maxscreens = 15    'change this if you want to save more screens
    
    type cursordata
      x    as integer
      y    as integer
      info as console_cursor_info
    end type
    
    type screenbufferdata
      curdat    as cursordata
      hbuffer as long
    end type
    
    global pbcc_csbd() as screenbufferdata
    global pbcc_curwin as long
    global pbcc_buffer as long
    
    '------------------------------------------------------------------------------
    '
    sub getcur(c as cursordata, byval stat as long)
    
      getconsolecursorinfo getstdout, c.info
    
      c.x    = cursorx
      c.y    = cursory
    
      if stat then
        cursor off
      end if
    
    end sub
    
    '------------------------------------------------------------------------------
    '
    sub setcur(c as cursordata)
    
      locate c.y, c.x
      setconsolecursorinfo getstdout, c.info
    
    end sub
    
    '------------------------------------------------------------------------------
    '
    function getscreenbuffer() as long
    
      local screensize as long
      local h          as long
      local r          as small_rect
    
      screensize = (screenx * screeny) * 4
    
      r.xleft = 0
      r.xtop  = 0
      r.xright = screenx - 1
      r.xbottom = screeny - 1
    
      ' allocate a buffer to save the screen
      h = globalalloc(%gmem_fixed, screensize)
    
      ' save the screen to the buffer
      readconsoleoutput getstdout, byval h, byval maklng(screenx, screeny), byval 0, r
    
      function = h
    
    end function
    
    
    '------------------------------------------------------------------------------
    
    sub putscreenbuffer(byval h as long)
    
      local r as small_rect
    
      r.xleft = 0
      r.xtop  = 0
      r.xright = screenx - 1
      r.xbottom = screeny - 1
    
      ' restore the buffer to the screen
      writeconsoleoutput getstdout, byval h, byval maklng(screenx, screeny), byval 0, r
    
    end sub
    
    '------------------------------------------------------------------------------
    '
    sub beginbuffer()
    
      if pbcc_buffer then
        exit sub
      end if
    
      pbcc_buffer = getscreenbuffer
    
    end sub
    
    
    '------------------------------------------------------------------------------
    '
    sub endbuffer()
    
      if pbcc_buffer then
        putscreenbuffer pbcc_buffer
        globalfree pbcc_buffer
        pbcc_buffer = %null
      end if
    
    end sub
    
    
    '------------------------------------------------------------------------------
    '
    sub qpush()
    
      if pbcc_curwin = 0 then
    
        erase pbcc_csbd()
        dim pbcc_csbd(1 to %maxscreens) as global screenbufferdata
    
      elseif pbcc_curwin = %maxscreens then
    
        exit sub
    
      end if
    
      incr pbcc_curwin
    
      ' save the cursor position and size
      getcur pbcc_csbd(pbcc_curwin).curdat, %false
    
      ' save the screen to the buffer
      pbcc_csbd(pbcc_curwin).hbuffer = getscreenbuffer
    
    end sub
    
    '------------------------------------------------------------------------------
    '
    sub qpop()
    
      if isfalse pbcc_curwin then
        exit sub
      end if
    
      ' restore the screen to the buffer
      putscreenbuffer pbcc_csbd(pbcc_curwin).hbuffer
    
      ' free the memory buffer
      globalfree pbcc_csbd(pbcc_curwin).hbuffer
    
      ' restore the cursor position and size
      setcur pbcc_csbd(pbcc_curwin).curdat
    
      decr pbcc_curwin
    
    end sub
    
    '------------------------------------------------------------------------------
    '
    sub qprint(byval row as long, byval col as long, byval text as string, byval attr as long)
    
      #register none
    
      local o as long
      local h as long
      local l as long
    
      if isfalse len(text) then
        exit sub
      end if
    
      decr row
      decr col
    
      o = ((row * screenx) + col) * 4
      l = len(text)
    
      if pbcc_buffer then
        h = pbcc_buffer
      else
        h = getscreenbuffer
      end if
    
      ! push edi
    
      ! mov  edi, h         ; put 'screen segment' in edi
      ! mov  ebx, o
      ! add  edi, ebx       ; add offset to location of text
      ! mov  esi, text      ; address of text buffer
      ! mov  ecx, l         ; length of the text string
    
      ! mov  eax, attr      ; attribute
      ! shl  eax, 16
    
    writechar:
      ! lodsb
      ! stosd
      ! loop writechar
    
      ! pop  edi
    
      if isfalse pbcc_buffer then
        ' restore the screen buffer
        putscreenbuffer h
    
        ' release the temporary buffer
        globalfree h
      end if
    
    end sub
    
    '------------------------------------------------------------------------------
    ' qprintc - print a string centered between two columns on the specified
    '           row.
    '
    ' row   = screen row to display text
    ' coll  = starting column to center displayed text
    ' colr  = ending column to center displayed text
    ' text$ = text string to display on screen
    ' attr  = color attribute to display characters
    '
    sub qprintc(byval row  as long, byval coll as long, _
                byval colr as long, byval text as string, _
                byval attr as long)
    
      dim temp as long
    
      temp = coll + (((colr - coll) + len(text)) \ 2)
    
      qprint row, temp, text$, attr
    
    end sub
    
    
    '------------------------------------------------------------------------------
    '
    sub qbox(byval row as long, byval col as long, byval rows as long, byval cols as long, byval attr as long)
    
      #register none
    
      local h          as long
      local ofst       as long
      local nextline   as long
    
      cols = cols - 2
      if cols <= 0 then
        exit sub
      end if
    
      rows = rows - 2
      if rows <= 0 then
        exit sub
      end if
    
      decr row
      decr col
    
      nextline = screenx * 4
      ofst     = ((row * screenx) + col) * 4
    
      if pbcc_buffer then
        h = pbcc_buffer
      else
        h = getscreenbuffer
      end if
    
      ' draw the box
    
      ! push edi
    
      ! mov  edi, h         ; put 'screen segment' in edi
      ! mov  ebx, ofst
      ! add  edi, ebx       ; offset to location of the box
    
      ! mov  ebx, nextline
      ! mov  ecx, cols
      ! mov  edx, rows
    
      ! mov  eax, attr      ; attribute
      ! shl  eax, 16
      ! push edi
    
      ' top line
      ! mov  ax, 218        ; top left character
      ! stosd
    
      ! mov  ecx, cols
      ! mov  ax, 196        ; horizontal character
      ! rep  stosd
    
      ! mov  ax, 191        ; top right character
      ! stosd
      ! pop  edi
    
      ' center lines
    center:
      ! add  edi, ebx
      ! push edi
    
      ! mov  ax, 179        ; vertical character
      ! stosd
    
      ! mov  ax, 32         ; space
      ! mov  ecx, cols
      ! rep  stosd
    
      ! mov  ax, 179        ; vertical character
      ! stosd
    
      ! pop  edi
      ! dec  edx
      ! loopnz center
    
      ' bottom line
      ! add  edi, ebx
    
      ! mov  ax, 192        ; bottom left character
      ! stosd
    
      ! mov  ax, 196        ; bottom center character
      ! mov  ecx, cols
      ! rep  stosd
    
      ! mov  ax, 217        ; bottom right character
      ! stosd
    
      ' finished
    done:
      ! pop  edi
    
      if isfalse pbcc_buffer then
        ' restore the screen buffer
        putscreenbuffer h
    
        ' release the temporary buffer
        globalfree h
      end if
    
    end sub

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

    Leave a comment:


  • Michael K. Dealey
    replied
    Paul,

    There is definitely more than one post of source code on this forum for fast printing functions to make up for the speed loss in the win9x family without resorting to odd screen sizes or PCOPY and the like. So there is *no* reason to not upgrade.

    I cannot remember exactly right now, but do a search for "fastprint" or "fprint" and follow the trail. I found that on my win 98 system it was dramaticaly faster....I mean *dramaticaly*. And it was built around of couple of API Calls.

    A very small amount of code to add to an existing program. Add the function once, do a search and replace for your print routines. Although, I know from reading many of your posts, that may be thousands of "find and replaces". (I lurk. hardly ever post).

    I'll look and see if I have it (them) saved on zip disc or or CD.

    -Michael.

    P.S. that said with regards to not upgrading (and someone correct me if I'm stupid), but could you not just save the Qprint source in version 2.0 as an INCLUDE file and then incorporate that into the later versions of PBCC programs you write, or has something changed in version 3.02 that is incompatable with that code?

    Originally posted by Paul Panks:
    Hello Lance,

    PB/CC Version: 2
    Operating System: Windows XP, 512MB of RAM, 1.8ghz processor

    I'm only using 2 because version 3 won't compile with Scrnio.inc.
    I am only using Scrnio.inc because it has the QPRINT function.

    Unfortunately, I have found nothing comparable to the QPRINT function yet.

    Sincerely,

    Paul Panks
    [email protected]

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




    [This message has been edited by Michael K. Dealey (edited July 11, 2003).]

    Leave a comment:


  • Paul Panks
    replied
    Hello Lance,

    PB/CC Version: 2
    Operating System: Windows XP, 512MB of RAM, 1.8ghz processor

    I'm only using 2 because version 3 won't compile with Scrnio.inc.
    I am only using Scrnio.inc because it has the QPRINT function.

    Unfortunately, I have found nothing comparable to the QPRINT function yet.

    Sincerely,

    Paul Panks
    [email protected]



    ------------------
    Few cats act their age, while
    most just cough up furballs.

    Leave a comment:


  • Lance Edmonds
    replied
    Paul, unfortunately there is still a slight lack of crucial information in your message... for example, which OS version are you using, which version of PB/CC are you using, etc?

    If it's anything <U>less</U> then 3.02, then you should update to the latest version before you do anything else. Also, if you are using Win95/98/ME then there could simply be a lack of 16-bit process memory available to the compiler as some may be in use by other process(es)... try rebooting in Safe Mode and see if the same problem occurs.

    Next, try using the INCLEAN utility to trim the WIN32API.INC and related files down (ie, to shrink the size of the symbol table which takes up most space during compilation). You program may be 5547 lines long, but if it uses WIN32API.INC then the program is really almost 60,000 lines long.

    Otherwise, please zip and email the entire source code (ie, be sure to include any #INCLUDE files that your 5547-line program is also using). To make this task easier, try using the Bundler utility http://www.powerbasic.com/files/pub/...SCBundle11.zip

    Thanks!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Paul Panks
    replied
    Hello Tom,

    When I compile WF.BAS (5,547 program lines), it stops at Error 406: Out of Main Memory.
    But when I use pbcc.exe, it compiles fine (2.1 second compile time).

    Sincerely,

    Paul Panks
    [email protected]




    ------------------
    Few cats act their age, while
    most just cough up furballs.

    Leave a comment:


  • Tom Hanlin
    replied
    What gives you an out-of-memory error? The IDE or your application?
    Likewise, what stops midway through the program?


    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Paul Panks
    started a topic Compile error question?

    Compile error question?

    Hello,

    I have a weird compile-error problem...

    When I compile using CCedit.exe from PB/CC, it gives me an Out of Memory error.
    It then stops mid-way through the program.

    However, when I command-line compile using Pbcc.exe, it compiles fine.

    Is this an error?

    Sincerely,

    Paul Panks
    [email protected]


    ------------------
    Few cats act their age, while
    most just cough up furballs.

    [This message has been edited by Paul Panks (edited July 09, 2003).]
Working...
X