No announcement yet.

time slices & CPU resource utilization

  • Filter
  • Time
  • Show
Clear All
new posts

  • time slices & CPU resource utilization

    Found the following snippet of code in the help file of a
    vendor's product. I tried it and it works very well under
    Windows 9X. However, my application still appears to run
    the CPU to 100% under NT. Some folks who use my software use
    NT thin clients - the CPU timing utilization resulting from my
    software brings their network to its knees. I asked the vendor
    for support (since they had included the solution in their help
    file) they said, "sorry - this is a PB question" - which is

    Know of an NT solution?

    'handle user keystroke here
    'Windows is being used, so
    'give up a time slice...
    asm push DS
    asm mov AX, &H1680
    asm int &H2F
    asm pop DS
    END IF

    Greg H.

  • #2
    Yup! The interrupt works fine in NT/2000, but BIT(pbvHost,8) does not return TRUE for NT/2000. You'll need to check that condition separately.

    Something *simple* like this works for me:

    IF BIT(pbvHost,8) OR IsNT% THEN
    END IF

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


    • #3
      The "%" type-specifier tells the compiler the numeric literal value is to be treated as an integer, however, the compiler will interpret the plain 8 as an integer anyway (in this particular context).

      In summary, either way works fine, and there is no particular need to use one or the other.

      However, in some other circumstances you may prefer to add a type-specifier to a numeric-literal, so that the compiler casts the value to the correct precision.

      For example:
      x## = 1.1   ' single-precision value assigned to a extended-precision float
      x## = 1.1## ' extended-precision value

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


      • #4
        Lance ..

        For the record on this thread, as well as the other that had a
        reference to time slice work:

        DOS-VDM's and your suggestions as to how to release time slices
        for this sort of thing does work fine for compiled executables
        running in DOS-VDM's in OS/2. It is possible to trap and ID
        the OS/2 instance and handle it just fine for the 3.5 compiled

        More important, I've been able to find and document something else
        that is related to this which ought to be posted in this thread
        for the few OS/2 afficiandos here.

        The F0 Bug fix code for OS/2 was distributed as a driver file in
        the following file:

        cmpxchg8.sys 2,634 5-03-99 6:53p

        This driver was released as part of FP 6, and would have been
        automatically added to your system directories in any fixpack
        of this date level or later. With a few rare exceptions, the
        fixpacks are cumulative. FP 6 was not widely installed, as I
        know it, in comparison to, for example FP 5, or later, especially
        until FP 8. FP 8 and FP 9 were perceived to be quite stable and
        were installed by a significant number of users, if the published
        comment text is any example.

        The current FP for Warp 4.0 is now FP 15 .. which would have that
        file in it, even if you went directly from no fixes to FP 15.

        It is important to note that FP 8 didn't show up until well into the
        year 2000, I think. Thus many, many people can have the needed
        driver for the system, but be totally un-aware that it is needed,
        and isn't installed. OS/2 does have a CPU sniffer for install
        purposes, but recall we are still dealing with an OP system which
        was introduced in 1996 which is still solidly viable even 5 years

        That after what I think is over 30,000 fixes at
        removing bugs ...

        All code has them.

        The mark of excellence is how you handle them
        and your attitude about both admitting them,
        sharing full disclosure about what they were
        and what got fixed.

        Virtually all of the MASSIVE amount of work for
        every one of these resolved fixes is admitted
        in the public database that IBM maintains on
        all this.

        The dirty linen's most all there .. in contrast
        to some organizations which do not post the
        whole details.

        Like 'em or not you have to respect IBM ..

        And Version 3 is STILL working and solid for a lot longer than
        1996 as well. I can't be sure, but it seems that as long as
        the latest FP 40 for Version 3.0 is in use, the above driver may
        perhaps work there too. That's significant, because version 3.0
        is still on a lot of boxes which are servers. Curiously, because
        of the efficiency of OS/2 (and LINUX), even a 486 server with only
        about 64MB of memory makes a fine HTTP, TELNET, FPT and firewall
        server as just a throw-away box. Thus many low level boxes are
        put into service for things which are cast off's and .. here comes
        the older CPU problem with them!

        The important thing is that even if that file *IS* on your system.
        the driver is *NOT* installed by the fix routines. It must be
        added to your CONFIG.SYS file by hand, or by some form of smart
        took which can modify your CONFIG.SYS coherently on its own. The
        correct line in the CONFIG.SYS file for it is:


        I've seen it installed right after the TIMER.SYS loader, but the
        OS2LDR re-arranges the load order of CONFIG.SYS to suit itself
        over what may be a hundred or more lines of goodies (or worse!)
        For those of you whom are reading along here still, you need to
        know that one other thing still haunts the operating system schema.
        There are still programs which both place the EOF character at the
        end of a text file, and also, sadly, those that can't handle it
        there when found! If you are modifying any of these or other
        control files from text operations in OS/2, you need to be sure
        that your editor does *NOT* leave the EOF character at the end of
        it. Curiously, even the standard texte editor for OS/2, "E", still
        leaves the infernal thing in there!!!

        Oh yes, OS/2 has its share of misery, just like every other what
        we might call 'near-relgious' experience.. chuckle.

        There are millions and millions of these old Classic Pentiums out
        there. From my experience, anyone using code on or producing it
        for use by others must look at this issue of time slicing and do
        what can be done to clean up the code.

        Part of the reason I post all this is to let others know that
        this issue is very real. It explains why, I suspect, a fair
        number of folks have odd instability problems for which they
        really do not know the cause .. or at least a probable one.

        A mule is kinda like a Packard.

        Ask the man who owns one.

        Mike Luther
        [email protected]
        Mike Luther
        [email protected]


        • #5

          Please do not shoot the mule!

          Attached is a modification of SNOOZE I wrote a long time ago to
          cure some of the problems that Ben Baker's tiny WAIT utility
          gave us in the OS/2 DOS-VDM BBS world. WAIT is another horrible
          polling CPU trasher that had to be shot .. some way or other.

          I've added in Lance's suggestion on using the ENVIRON string to
          attempt to detect WIN-NT, to enable time slice releasing, but at
          the moment have no time to verify it that game works or not. Too
          much else to do right now...

          The reason I post this is to demonstrate what *CAN* be done by
          thoughtfully applying time slice releasing where practical. At
          the same time it illustrates how to break it up in keyboard I/O
          sections of a program.

          I don't have convenient access to any WIN-NT box to test this at
          the moment. So if someone else wants to to it please do and
          let me know what happens:

          10 ' COPYRIGHT (C) 1981-2001 BY H.A.M. LUTHER * SNOOZE.BAS * REV 08-Aug-01
          	' ---
                  ' Released into the Public Domain for free use without restrictions.
          	' Command line argument routine adapted from example in Microsoft
                  ' PD7 Developer's example routines
          	' --- PB 3.5 directives below are for compilation with it. ---
          	' This is not a surgical time tool - just a rough example utility.
                  '   Your 'clock' might not agree to the second with when SNOOZE
                  '   thinks that second should display depending on the speed
                  '   of your system and other factors.
                  ' If used with OS/2 for spawning native OS/2 sessions you must have
                  '   the utility ORUN.EXE in your path.  It's available on HOBBS.
                  '   If you have some other one you prefer just substitute that name.
                  ' Makes no provision for days, this mule only plows for 24 hours  
          	$OPTION GOSUB
          	$STRING 4
          	$COMPILE EXE "SNOOZE"
          	$DIM ARRAY
          	' Followed by declarations as needed in PB 3.5 for DOS
          	DECLARE SUB Comline(NumArgs%, A$(), MaxArgs%)
              	$STACK 2048
              	DEFINT A-Z '				Define integers
              	REVDATE$ = "08-Aug-01"  '		Revision date
          	' ---
          	%FALSE = 0 '				Needs to be added
          	%TRUE  = NOT %FALSE '			Needs to be added
          	' ---
          	DIM A$(10) '				Can't fumble that many!  
          	' Get what was typed on the command line
          	' Argument list is COMPORT #, ID PARAMETER REQUEST STRING
          	' Prepare for interrupt calls
                  MaxArgs% = 10 '				Surely not more than this?
                  NumArgs% = N% '				And so on
          	CALL Comline(NumArgs%, A$(), MaxArgs%) '	Get command line args
          	' Enable any below as a test call here like to see program work
                  '           A$(1) = "TEST"
                  '           A$(1) = "+06:23:01"
                  '           A$(1) = "10"
                  '           A$(1) =  "5": A$(2) = "C:\ZIPLOG"
                  '           A$(1) =  "5": A$(2) = "C:\Q\QO": A$(3) = "/2"
                  ' For test if the I/O string was "TEST" or mixed case varient
                     IF UCASE$(A$(1)) = "TEST" THEN
                        A$(1) = "10" '			Set sample ten second pass
                        DTS% = 1 '			Set test flag
                     END IF
          	' You can't use just a plain "Q" here as there is a demo program
                  '   for QEDIT which is around called "Q.EXE" which needs protection
                  IF UCASE$(A$(2)) = "/Q" OR _ '		Some folks do 'dis
                   UCASE$(A$(2)) = "-Q" THEN '		Some folks do 'dis
                     A$(2) = "" '				Remove erroroneous progname
                     A$(3) = "/Q" '			Move it to required place
                  END IF
                  IF UCASE$(A$(3)) = "Q" OR _ '		Simplest way if by accident
                   UCASE$(A$(3)) = "/Q" OR _ '		Some folks do 'dis
                   UCASE$(A$(3)) = "-Q" THEN '		Some folks do 'dis
                     NODIS% = 1 '				Set no display flag
                  END IF
                  DMO% = 0 '				Null OS/2 .CMD flag
                  IF UCASE$(A$(3)) = "2" OR _ '		Simplest way if by accident
                   UCASE$(A$(3)) = "/2" OR _ '		Some folks do 'dis
                   UCASE$(A$(3)) = "-2" THEN '		Some folks do 'dis
                     DMO% = 1 '				Set OS/2 native progname flag
                  END IF
          	BCC% = 1 '				Set bad command line flag
          	DMYP$ = TIME$ '				Get current time
          	   IF A$(1) <> "" THEN '		There was a command argument
          	      DMYS$ = A$(1) '			Separate the first one
          	      DMY% = LEN(DMYS$) '		Check for valid length
                        DMYR$ = "" '			Null collector string
                        FOR NJ% = 1 TO DMY% '		For length of it
                           DMYQ$ = MID$(DMYS$, NJ%, 1) '	Sample a byte in string
                           IF ASC(DMYQ$) < 48 OR _ '	< "0"
                            ASC(DMYQ$) > 57 THEN '	> "9"
                              DMYR$ = "" '		Cancel building string
                              EXIT FOR '			No usable parameter
                           ELSE '				Valid digit possihle
                              DMYR$ = DMYR$ + DMYQ$ '	Add to collector
                           END IF
                        IF DMYR$ <> "" THEN '		Valid pure second prompt
                           WTM& = VAL(DMYR$) '		Convert to raw seconds delay
                           BCC% = 0 '			Kill bad I/O flag
                           DMYS$ = DMYP$ '		But use raw time as init $
                           DMY% = 8 '			Fudge length here
                        END IF
          	      IF DMY% < 8 OR _			< 01:01:01
          		 DMY% > 9 THEN '		>+01:01:01
          		 GOTO PLOW '			Bad argument
          	      END IF
          	      IF DMY% = 9 AND _ '		Wait for option here
          	         LEFT$(DMYS$, 1) <> "+" THEN '	Bad symbol
          		 GOTO PLOW '			Bad argument
          	      END IF
          	      IF DMY% = 9 THEN '		Wait for format in use
          		 LOAD% = 1 '			Set LOAD flag
          		 DMYS$ = RIGHT$(DMYS$, 8) '	Trucate off load mark
          	      END IF
          	      IF MID$(DMYS$, 3, 1) <> ":" THEN
          		 GOTO PLOW '			Bad argument
          	      END IF
          	      IF MID$(DMYS$, 6, 1) <> ":" THEN
          		 GOTO PLOW '			Bad argument
          	      END IF
          	      ' By here we have verified + and 00:00:00:
          	      HRS% = VAL(LEFT$(DMYS$, 2)) '	Pick off hours
          	      MNS% = VAL(MID$(DMYS$, 4, 2)) '	Pick off minutes
          	      SCS% = VAL(RIGHT$(DMYS$, 2)) '	Pick off seconds
          	      IF HRS% + MNS% + SCS% = 0 AND _ '	No time specified
          		LOAD% = 0 THEN '		Was an invalid wait deal
          		 GOTO PLOW '			Bad argument
          	      END IF
          	      ' Convert the time to wait to all seconds
          	        WTM& = WTM& + SCS% + (MNS% * 60) + (HRS% * 60 * 60) '	All done
                          BCC% = 0 '			Null bad I/O flag
          	   END IF
          	' Mule starts plowing here if BCC% is null.  Note we could have used
          	'   a much shorter routine for time ending, but that wouldn't have 
                  '   provided an time ending string for raw seconds I/O so might as 
                  '   well go through the entire excercise of recreating it ...
          	EXT% = 0 '				Null special exit flag
          	HRSN% = VAL(LEFT$(DMYP$, 2)) '		Pick off hours
          	MNSN% = VAL(MID$(DMYP$, 4, 2)) '	Pick off minutes
          	SCSN% = VAL(RIGHT$(DMYP$, 2)) '		Pick off seconds
          	WTMN& = (HRSN% * 60 * 60) + (MNSN% * 60)  + SCSN% '	Calculate current time
          	WTMD& = WTM& - WTMN& '			Subtract it from end time
          	   IF WTMD& < 0 THEN '			We've rolled through midNight
          	      WTMD& = WTMD& + 86400& '		Recast this
          	   END IF
                  WTM& = WTMD& '				Becomes new time here
          	' Which translates to
          	SCSE& = WTMN& + WTM& '			Total seconds
          	   IF SCSE& > 86400 THEN '		Past midnight
          	      SCSE& = SCSE& - 86400 '		Recast it into new day
          	   END IF
                  HRSE% = FIX(SCSE& / 3600) '		Divide by 360 to get hours
          	   IF HRSE% > 0 THEN '			Had one or two here or so
          	      SCSE& = SCSE& - (HRSE% * 3600) '	Take away those seconds
          	   END IF '				Leaving seconds as a block
          	MNSE% = FIX(SCSE& / 60) '		Divide by 60 to get minutes
          	   IF MNSE% > 0 THEN '			Had one or two here or so
                        SCSE& = SCSE& - (MNSE% * 60) '	Take away those seconds
          	   END IF '				Leaving final seconds
                  ERSE$ = RIGHT$(STR$(HRSE%), LEN(STR$(HRSE%)) - 1) '	Ending HR$
                     IF HRSE% < 10 THEN '			Add a zero
          	      ERSE$ = "0" + ERSE$ '		Now we have the hours
          	   END IF
          	EMNE$ = RIGHT$(STR$(MNSE%), LEN(STR$(MNSE%)) - 1) '	Ending MIN$
          	   IF MNSE% < 10 THEN '			Add a zero
          	      EMNE$ = "0" + EMNE$ '		Now we have the minutes
          	   END IF
                  ESCE$ = RIGHT$(STR$(SCSE&), LEN(STR$(SCSE&)) - 1) '	Ending MIN$
          	   IF SCSE& < 10 THEN '			Add a zero
          	      ESCE$ = "0" + ESCE$ '		Now we have the seconds
          	   END IF
          	ETME$ = ERSE$ + ":" + EMNE$ + ":" + ESCE$ '	End time is near!
                     IF NODIS% = 0 AND _ '		Print OK
                        A$(1) <> "" THEN '		No I/O justs prints exit data
                        PRINT "   SNOOZING from "; DMYP$; " to "; ETME$
          	   END IF
          	   IF BCC% = 0 THEN '			Command line argument valid
                        IF DTS% = 1 THEN '		test flag is set
          	         PRINT "   Test SNOOZING 10 seconds at "; DMYP$
                        END IF
          	      IF A$(2) <> "" THEN '		A program is here to run
          		 IF NODIS% = 0 THEN '		Print OK
          		    PRINT "   "; UCASE$(A$(2)); " runs on SNOOZE exit at: "; ETME$
                           END IF
          	      END IF
                        IF UCASE$(ENVIRON$("OS")) = "WINDOWS_NT" THEN '	NT!
          		 IsNT% = -1 '			Flag this
          	      END IF
          	      TIMEU& = 0 '			Null step counter
          	      TIMEV& = 0 '			Null step counter
          	      TIMEY& = TIMEX& '			Set back flag
          	      TIMEZ& = 0 '			Null incremental
          	      TIME1& = WTM& '			Bump time required seconds
                        ' Yes I know - mule ain't perfect - he may take two extra steps
                        '  more or less to get him to 'match' your 'clock' ..
          	      WHILE TIMEU& < TIME1& + 1 '	Change delay to suit
          		 '  When in trouble, when in doubt
                           '    plow in circles scream and shout!
          		 ' But do *NOT* bash the CPU if you are polite!
                           IF ISTRUE BIT(pbvHost, 8%) OR IsNT% THEN '	In WIN environment
                              ! push DS
                              ! mov AX, &H1680
                              ! int &H2F
                              ! pop DS
                           ELSE '				Not WIN but DV or OS/2
                              ! push DS		; Save DS for PowerBASIC
                              ! mov AX, &H8600	; Place function $AH68in AX
                              ! mov CX, &H00	; Use less than 1000 MS delay
                              ! mov DX, &H0A00	; Try &H0A00 for a delay in DX
                              ! int &H15		; Call timer interrupt
                              ! pop DS
                           END IF
          	         C9P$ = INKEY$ '		See what is at keyboard
          		 IF C9P$ = "" THEN '		Nothing to see
          		    GOTO MNWA2 '		Run in circles, mule!
          		 END IF
          		 ' Demonstrates how to get key hit data for other uses
          	         C9% = ASC(C9P$) '		Get ascii code of item
          		 IF C9% = 27 THEN '		Complete escape needed
          		    PRINT "                           Bye Bye SNOOZE!"
          		    TIMEU& = TIME1& '		Patch time outup to cap
          		    ' Yes jumping out of loops isn't nice but this isn't
          		    '  a Steiger tractor - it's a mule and a godevil plow!
          		    GOTO MNESC '		Whoa mule!
          		 END IF
          		 IF C9% < 32 OR C9% > 126 THEN '	Not useful
          		    GOTO MNWA1 '		Is not useful item
          	 	 END IF
          		 IF C9% > 90 THEN '		Lower case we guess
          		    C9% = C9% - 32 '		Convert to upcase
          		 END IF
          		 '  For example ...   <N>ewnumber e<X>it <T>alk
          		 '    which can be passed as an exit parameter number
                           '    in the END statement or otherwise..
          		 IF C9% = 78 OR _ '		<N> will appear in exit
          		  C9% = 88 OR _ '		<X> will appear in exit
          	          C9% = 84 THEN '		<T> will appear in exit
          		    TIMEU& = TIME1& '		Patch time outup to cap
          		    EXT% = 1 '			Set special exit flag
          		    EXIT LOOP '			Whoa mule!
          		 END IF
          	         C9% = 0 '			Null key response value
                           ' Say TIMEY& was 20
          	         TIMEX& = VAL(RIGHT$(TIME$, 2)) + TIMEZ&
                           IF TIMEV& <> TIMEX& THEN '	We have rolled past a second
          		    TIMEU& = TIMEU& + 1 '	Bump second counter
          		 END IF
          		 TIMEV& = TIMEX& '		Store rotor here
          		 IF TIMEX& < TIMEY& THEN
          		    TIMEZ& = 60 '		Has rolled thru top
          		 END IF
          	       ' You can get a trace run here by uncommenting this line
                         ' PRINT "TIMEU& = "; TIMEU&; " TIME1& "; TIME1&
                         IF C9% = 27 THEN '		Escape exit
                            GOTO MNWA4 '			Skip the formalities
                         END IF
                         IF DTS% = 1 THEN '		In test mode
                            PRINT "   We're gone after testing at "; TIME$
          	       END IF
          	       IF A$(2) <> "" THEN '		Program to run?
                         	  DMYP$ = UCASE$(A$(2)) '	Don't even ask why extra step
          		  DMY% = LEN(DIR$(DMYP$)) '	Is it here?
                            IF DMY% = 0 THEN '		Full path was not there
                               DMQ% = INSTR(DMYP$, " ") '	Look for first space
                               IF DMQ% = 0 THEN '		Only one command word here
                                  DMQ% = LEN(DMYP$) '	So use that string only
                               END IF '			Now check if it might run
                               IF DMQ% > 0 THEN '		Possible complex load line
                                  DMYR$ = LEFT$(DMYP$, DMQ%) '	Pick off left item
                                  DMY% = LEN(DIR$(DMYR$ + ".COM")) '	First .COM
                                  IF DMY% = 0 THEN '	Is .EXE file here?
          			   DMY% = LEN(DIR$(DMYR$ + ".EXE")) '      .EXE
                                  END IF '		If no .EXE may yet be hope
                                  ' First call DOS-VDM batch file if present
                                  IF DMY% = 0 THEN '	Is .BAT file here?
          			   DMY% = LEN(DIR$(DMYR$ + ".BAT")) '      .BAT
                                     IF DMY% = 0 THEN '	Is .CMD file here?
          			      DMY% = LEN(DIR$(DMYR$ + ".CMD")) '      .CMD
                                        DMO% = 1 '	Set OS/2 in use flag
                                     END IF
                                  END IF '		If no .BAT may yet be hope
                                  ' But if not and we are running DOS in OS/2 try .CMD
                               END IF
                            END IF
          		  IF DMY% > 0 THEN '		Mule has a companion!
                               IF DMO% = 0 THEN '		Not an OS/2 issue
          		        EXECUTE A$(2) '		Hitch mule to the wagon!
                               ELSE '			Jato rocket the wagon!
                                  EXECUTE "ORUN " + A$(2) '	Instance OS/2 session
                               END IF
                            ELSE '			Error
                               PRINT "   Sorry, "; DMYP$; " won't run as called!"
          		  END IF
          	       END IF
          	     END IF '				End valid command line
          	  ' Maybe we wanted a directed flag for batch exits ..
          	     IF EXT% = 1 THEN '			Special exit needed
          		END C9% '			For example
          	     END IF
          	  ' Closing instuctions print to screen
                       IF NODIS% = 0 THEN '		No exit text wanted
          		PRINT " SNOOZE Rev: "; REVDATE$; " * (c) H.A.M. Luther - Program name + three arguments "
          	        PRINT "    Released into the Public Domain for free use without restrictions.
          		PRINT "        HH:MM:SS to wait OR +HH:MM:SS wait to a set time!"
          		PRINT "              SNOOZE <test> demos 10 second nap!"
          		PRINT "          SNOOZE <time> <PROGNAME> executes it on exit!"
                          PRINT "   SNOOZE <time> <PROGNAME> </Q>  executes it on exit w/no video!"
          		PRINT "   SNOOZE <time> <PROGNAME> </2>  calls OS/2 progs on exit w/ORUN"
          		PRINT "            If ORUN is used it *MUST* be in your path!"
                          PRINT "             The PROGNAME must include the full path"
          		PRINT "       Hitting the <ESC>ape key will break out of program."
                      END IF
          SUB Comline(NumArgs%, A$(), MaxArgs%) STATIC PUBLIC
          	  TRUE% = -1
                    FALSE% = 0 '				Define constants
          	  NumArgs% = 0 '                        Null argument count register
          	  Inf = FALSE% '			Initialize argument flag
          	  Emb = FALSE% '			Initialize embedded quote flag
          	  Cl$ = COMMAND$ '                      Get command string using function
          	  L% = LEN(Cl$) '                       Set length of command string
          	     FOR I% = 1 TO L% '                 For length of command string
          		C$ = MID$(Cl$, I%, 1) '         Snip a byte
          		' Test for character being " designating embedded string
          		IF C$ = CHR$(34) AND NOT Emb THEN Emb = TRUE% '  Start quote
          		IF (C$ <> CHR$(34)) AND Emb THEN ' Not embedded quotes
          		   ' Test if already inside an argument
          		   IF NOT Inf THEN '		Start of a new argument
          		      ' Test for too many arguements
          		      IF NumArgs% = MaxArgs% THEN EXIT FOR '    Too many arguments
          			 NumArgs% = NumArgs% + 1 '      Increment argument counter
          			 Emb = TRUE%
          			 Inf = TRUE% '		At least one argument set flag
          		      END IF '                  End test for max arguments
          		      ' Add character to current argument
          		      A$(NumArgs%) = A$(NumArgs%) + C$ '  Add this byte
          		   ELSE '                       Found a blank or tab
          		      IF C$ = CHR$(34) AND Emb = TRUE% AND Inf = TRUE% THEN
          		      ' Set "Not in argument flag to FALSE%
          			 Emb = FALSE%
          			 Inf = FALSE%
          			 C$ = " "
          		      END IF
          		END IF '                        End this argument segment
          		IF NOT Emb THEN '               Not working on embedded quote
          		   ' Test for character being blank or a tab
          		   IF (C$ <> " " AND C$ <> CHR$(9)) THEN ' Neither blank or tab
          		      ' Test if already inside an argument
          		      IF NOT Inf THEN '		Start of a new argument
          			 ' Test for too many arguements
          			 IF NumArgs% = MaxArgs% THEN EXIT FOR ' Too many arguments
          			    NumArgs% = NumArgs% + 1 '   Increment argument counter
          			    Inf = TRUE% '	At least one argument so set flag
          			 END IF '               End test for max arguments
          			 ' Add character to current argument
          			 A$(NumArgs%) = A$(NumArgs%) + C$ '       Add this byte
          		      ELSE '                    Found a blank or tab
          			 ' Set "Not in argument flag to FALSE%
          			 Inf = FALSE%
          		   END IF '                     End this argument segment
          		END IF '                        End not embedded string check
          	     NEXT I%
          	  END SUB

          If this is of any value it can go into the source forum, and the
          compiled execuatable can go into the other one. I'm interesting
          in building bridges, not burning them.....

          Mike Luther
          [email protected]
          Mike Luther
          [email protected]


          • #6
            Err... you can't both claim a copyright and put a work into the public domain.
            They're mutually exclusive.

            Tom Hanlin
            PowerBASIC Staff


            • #7
              "Oh dear, said the White Rabbit"

              Well, we may have not done that quite correctly. Perhaps the
              correct way was to release it for any use whatsover. If that's
              the position we need to take we should. Lesse - released
              for unlimited Public Use.

              Want to suggest a better correction phrase that needs to be used?

              The intent is to vector the thinking source to the proper places
              yet release the use of the code completely.

              I think I did this to bring forth another side vector ..

              If, if you look closely, the entire example code set forth by
              PowerBASIC in its examples carries the notice, and it carries no
              notice of right to use whatsoever!

              Code block after code block is in there, technically, with no way
              for any of your customers, technically, to even incorporate it
              into their code! Thus, as an interesting vector to this, is the
              idea that absolutely nothing that PB has furnished by way of example
              has any right to be used in any code that their users might write.

              To my awareness, there is no statement to that right anywhere in
              the PowerBASIC documentation or literature, even though we,
              the paid-in customers do expect, and suspect do use it and
              the licensed property for which we contracted use for.

              I'm no guru.

              I'm fully aware that what's posted is expected to be used. I'm
              also aware that portions of code are also used under similar
              chain of authority rights, as was the Microsoft code in it
              for the command line I/O sniffing.

              Now I want to be honest! I have to give M/S credit! In a way,
              chuckle, that was the obligation! So .. any way I go, or
              perhaps, almost any way any of us really go, we're trapped
              in how we honestly give credit where it's due, even if we

              I'll be perfectly happy to release it for unlimited Public
              Use, if that will fix it! But in the long run, I have to also
              honor where the other part, to which I, as I understand it,
              *DO* have the right to incorporate it, came from.

              Which I did!

              Now do we want to plow dirt and plant some crops that a
              lot of us could use and flowers for all to see, or what?

              And .. what are we all to do with what you kind folks have
              furnished for examples, just between us very pious and holy
              folks we all are here?

              Mike Luther
              [email protected]
              Mike Luther
              [email protected]


              • #8
                In your Samples directory, you will find a file called Samples.txt that describes
                the usage and distribution rules. If you have questions, feel free to ask.


                In brief, a copyright is a intellectual property right that gives the owner legal
                control over how/whether/when/etc the property may be duplicated. In most countries,
                a copyright is automatically granted to any published text, although your legal
                recourse is greatly strengthened if you include a copyright notice following certain
                specific rules, and if you file a copyright claim with the authorities. So, you
                should generally assume that a work is copyrighted unless it contains specific notice
                that it is in the "public domain": that is, that no copyright is asserted.

                An item in the public domain is not owned by an individual. Anyone can do anything
                they like with it.

                "Freeware" does not imply "public domain". It is copyrighted software with a broad
                distribution license.

                I am not a lawyer. These are my personal observations. If intellectual ownership
                issues are important to you, check with a lawyer and/or do your own research. A
                good source for information is Nolo Press:

                Tom Hanlin
                PowerBASIC Staff