PB/CC Conversion


PB/CC equivalence was a key design parameter for LJ-CC, to enable any program written for PB/CC to be modified to compile with PB/Win + LJ-CC. A one-to-one equivalence of functionality has been retained wherever possible, leading to some duplication of functionality in some cases to support different versions of PB/CC.


There is one PB/CC command (INPUT) that has no direct equivalent in LJ-CC. There is another PB/CC command (PRINT) which is incompletely emulated in LJ-CC. In both cases, the PB/CC functionality can be emulated using multiple statements.


PB/Win+LJ-CC alone cannot inherit a parent console when the program is started from a command line. Only a true "console application" can do this. Utilities exist to convert a PB/Win+LJ-CC executables to a true console application if necessary. See Console Concepts for more details if this is required.


Within the constraints of functional equivalence, LJ-CC breaks free of the DOS BASIC naming legacy of some of the PB/CC commands and functions to implement its own naming strategy.


Since PB/CC 6 added new syntax for console statements, we must now call the older PB/CC syntax the "legacy" syntax, valid for versions 4, 5 and 6 (PB/CC 6 still supports the legacy syntax in addition to the new "psuedo-object" syntax). The naming strategy of LJ-CC is closer to (but not the same as) the new syntax of PB/CC 6 than it is to the legacy syntax.


The LJ-CC names are not designed to be represented in all upper case (or all lower case). The user of PB does not have the luxury afforded to the compiler writer of including spaces or arbitrary periods in command names, so we have to resort to case changes to make composite names readable. Even if we were to implement the commands and functions as methods and properties it would not be possible to exactly simulate all the syntax of PB/CC 6, which is why it is referred to as pseudo-object syntax.


If converting existing PB/CC code to LJ-CC, it is worth considering retaining the ability to compile the code with PB/CC by enclosing the conversions in conditional compilation blocks. The one-to-one equivalency of functionality of LJ-CC enables this.


To introduce this concept, the following conditional block may be inserted at the beginning of the program:


#IF %DEF(%PB_CC32)






Note that #CONSOLE ON is optional but #INCLUDE "LJ-CC.BAS" is not. If the code contains #CONSOLE OFF, see the Console Concepts section.


The description of each command and function includes one or more conditional blocks like the above to illustrate how the command or function is converted. For example:


#IF %DEF(%PB_CC32)






CON.CLS or CONSOLE.CLS may be substituted for CLS in programs written for PB/CC6.


The index contains the PB/CC statements and functions so that they may be found easily. The example conversions normally use the legacy syntax with a note below to describe the new syntax, as above. The head of each description also notes both the legacy PB/CC syntax and the pseudo-object syntax equivalent to the LJ-CC command or function being described.


There are a couple of areas in which the defaults of LJ-CC differ from those of PB/CC. The first of these is startup color attributes. The initial console of PB/CC has the default colors set by the user, but the internal default color attributes, affecting the first PRINT statements, are always set to low intensity white on black. LJ-CC sets the internal attributes to the received default attributes. If desired, LJ-CC can be set to the same behavior as PB/CC by entering the following command into your program before any output command:


ConColor 7, 0


Or a PB/CC program can be made to respect the default attribute assignments, like LJ-CC, by entering the following lines at the start of the program:


CellAttr = SCREENATTR(1, 1)

CellFg = CellAttr AND &H0F

CellBg = (CellAttr AND &HF0) / &H10

COLOR CellFg, CellBg


The other area of difference is character scrolling. In PB/CC, SCROLL DOWN moves a block of text UP, SCROLL UP, moves a block of text DOWN, SCROLL LEFT moves a block of text LEFT, and SCROLL RIGHT moves a block of text RIGHT. The opportunity has been taken to reverse the counter-intuitive usage of UP and DOWN, which is inconsistent with the more logical LEFT and RIGHT.


There are a few LJ-CC commands that have no direct equivalent in PB/CC. It is hoped that these will increase in number as time goes on and LJ-CC moves beyond the limits of simple support for PB/CC functionality. There are also one or two functions included in LJ-CC.BAS that are intended to be used only internally and are not documented here.