BBS: Inland Empire Archive Date: 03-24-92 (03:24) Number: 199 From: DARYL POSNETT Refer#: NONE To: DUANE BURRIS Recvd: NO Subj: DOS Prompt 3/ Conf: (2) Quik_Bas
>>> Continued from previous message MESeg% = GetMasterEnvSeg% DEF SEG = MESeg% ' ' Save rest of enviroment in string ' DO rest$ = rest$ + CHR$(PEEK(EnvAdr%)) EnvAdr% = EnvAdr% + 1 LOOP UNTIL PEEK(EnvAdr%) = 0 AND PEEK(EnvAdr% + 1) = 0 rest$ = rest$ + CHR$(0) + CHR$(0) IF (LEN(rest$) + VarBeg%) < (GetMasterEnvSize% + 2) THEN DEF SEG = MESeg% FOR EnvAdr% = 1 TO LEN(rest$) POKE VarBeg% + EnvAdr% - 1, ASC(MID$(rest$, EnvAdr%, 1)) NEXT EnvAdr% DEF SEG SetMasterEnvVar% = 0 EXIT FUNCTION END IF ELSE ' ' If we get here, it is a new variable ' MESeg% = GetMasterEnvSeg% DEF SEG = MESeg% EnvAdr% = 0 DO EnvAdr% = EnvAdr% + 1 LOOP UNTIL PEEK(EnvAdr%) = 0 AND PEEK(EnvAdr% + 1) = 0 EnvAdr% = EnvAdr% + 1 rest$ = rest$ + CHR$(0) VarBeg% = EnvAdr% IF (LEN(rest$) + EnvAdr%) < (GetMasterEnvSize% + 2) THEN DEF SEG = MESeg% FOR EnvAdr% = 1 TO LEN(rest$) POKE VarBeg% + EnvAdr% - 1, ASC(MID$(rest$, EnvAdr%, 1)) NEXT EnvAdr% DEF SEG SetMasterEnvVar% = 0 EXIT FUNCTION END IF END IF DEF SEG SetMasterEnvVar% = -1 END FUNCTION ============================ Cut Here ================================== And now a couple of examples using the above code: ============================ Cut Here ================================== '$INCLUDE: 'qb.bi' '$INCLUDE: 'mstenv.bi' DEFINT A-Z ' ' Set a master enviroment variable ' PRINT PRINT "QBSET - Copyright 1992 Applied Design Group" c% = INSTR(COMMAND$, "=") IF c% > 0 THEN setvar$ = LEFT$(COMMAND$, c% - 1) setdef$ = RIGHT$(COMMAND$, LEN(COMMAND$) - c%) IF SetMasterEnvVar(setvar$, setdef$) THEN PRINT "Out of enviroment space" PRINT ELSE PRINT PRINT GetMasterEnv$ END IF PRINT "Done!" ============================ Cut Here ================================== >>> Continued to next message ___ X SLMR 2.0 X Have you tried an Applied Design Group product today ? --- Maximus 2.00 * Origin: Inland Empire Archive (1:346/10)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET