Hello
First the question. When a sub is call when the end sub or exit sub is encountered does it return to the next statement after the call
memory leak i am going to post my code here. I use rem statement to an excess do to my eyes so the code will not run together so please dont pound on me about the clutter ok just look at the prompt area and tell me if i left any memory leaks
thanks in advance
Badger
if this is not allowed sorry please delete and let me know how to post code
REM ***************************************************************************
REM **** Program Bridal Store *************************************************
REM ***************************************************************************
REM ***************************************************************************
REM **** Author Philip King **************************************************
REM ***************************************************************************
REM ***************************************************************************
REM ***************************************************************************
REM **** Includes go here *****************************************************
REM ***************************************************************************
REM ***************************************************************************
REM ***************************************************************************
REM **** Sreen statements here ************************************************
REM ***************************************************************************
$COLOR:32
REM ***************************************************************************
REM ***************************************************************************
REM **** Listing of subs and funtions *****************************************
REM ***************************************************************************
REM ***************************************************************************
REM ***************************************************************************
REM **** arrays decleared here ************************************************
REM ***************************************************************************
imenu = 4
DIM SHARED smenu(imenu) AS STRING
REM ***************************************************************************
REM ***************************************************************************
REM **** arrays set to data here **********************************************
REM ***************************************************************************
smenu(1) = "1) Edit Customer Info": smenu(2) = "3) Edit Inventory Data "
smenu(3) = "2) Edit Sales ": smenu(4) = "4) System Maintenance "
REM ***************************************************************************
REM **** variables declares go here *******************************************
REM ***************************************************************************
DIM SHARED sr AS STRING
CONST null = ""
REM ***************************************************************************
REM ***************************************************************************
REM **** customer info record type ********************************************
REM ***************************************************************************
TYPE customer
id AS LONG
sfirst_name AS STRING * 25
slast_name AS STRING * 25
saddress AS STRING * 30
scity AS STRING * 25
sstate AS STRING * 2
szip AS STRING * 5
sphone AS STRING * 10
END TYPE
REM ***************************************************************************
REM ***************************************************************************
REM **** inventory record type ************************************************
REM ***************************************************************************
TYPE inventory
ienventory AS LONG
sdesc AS STRING * 250
sdate_bought AS STRING * 8
sdate_sold AS STRING * 8
fcost AS _FLOAT
fretail AS _FLOAT
ssize AS STRING * 2
ssold AS STRING * 1
END TYPE
REM ***************************************************************************
REM ***************************************************************************
REM **** point of sale type ***************************************************
REM ***************************************************************************
TYPE spos
lposid AS LONG
END TYPE
REM ***************************************************************************
DIM SHARED custinforec AS customer
custinforeclen = LEN(custinforec)
CLS
REM ***************************************************************************
REM **** defines for quick use data types *************************************
REM ***************************************************************************
_DEFINE I AS INTEGER : _DEFINE S AS STRING : _DEFINE D AS DOUBLE :
_DEFINE F AS _FLOAT : _DEFINE L AS LONG
REM ***************************************************************************
REM ***************************************************************************
REM **** main modual **********************************************************
REM ***************************************************************************
SCREEN _NEWIMAGE(640, 400, 32)
COLOR LightCyan, MidnightBlue
iflag2 = 0
iflag3 = 1
CLS
'SCREEN 12
_FULLSCREEN
IF se = "X" THEN END
GOSUB menuloop:
IF saction = "X" THEN END
'if se ="1" then call that prompt
'LINE INPUT siy: END
REM ***************************************************************************
REM **** main menu loop *******************************************************
REM ***************************************************************************
menuloop:
CALL systemheader
CALL printmain
CALL mainmenuchoice
IF sr = "" OR sr = CHR$(13) THEN GOTO menuloop
IF sr = "X" THEN END
'IF sr = "1" THEN CALL custinfo: 'GOSUB custinfo1
IF sr = "1" THEN
CALL promptid
CALL promptfname
CALL promptlname
CALL promptaddress
CALL promptcity
CALL promptsstate
CALL promptszip
CALL promptphone
RETURN
END IF
REM ***************************************************************************
REM ***************************************************************************
REM **** customer input modual ************************************************
REM ***************************************************************************
's0:
SUB custinput
CALL systemheader
LOCATE 10, 1: PRINT "Customer ID ";: PRINT custinforec.id
LOCATE 11, 1: PRINT "Customer First Name ";: PRINT custinforec.sfirst_name
LOCATE 12, 1: PRINT "customer Last Name ";: PRINT custinforec.slast_name
LOCATE 13, 1: PRINT "Customer Address ";: PRINT custinforec.saddress
LOCATE 14, 1: PRINT "Customer City ";: PRINT custinforec.scity
LOCATE 15, 1: PRINT "customer State ";: PRINT custinforec.sstate
LOCATE 16, 1: PRINT "customer Zip ";: PRINT custinforec.szip
LOCATE 17, 1: PRINT "Customer Phone Number ";
PRINT LEFT$(custinforec.sphone, 3) + "/"; MID$(custinforec.sphone, 4, 3) + "/"; RIGHT$(custinforec.sphone, 4)
'RETURN
END SUB
REM ********************************************************************
's1:
SUB promptid
CALL custinput
saction = "Enter Customer ID X to Exit "
ib = 9
ilow = 1
ihigh = 999999999
iflag1 = 1
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
RETURN
END IF
IF sr = "X" THEN
iflag1 = 0
EXIT SUB
RETURN
END IF
custinforec.id = VAL(sr): CALL custinput
END SUB
REM ********************************************************************
's2:
SUB promptfname
CALL custinput
saction = "Enter First Name X to Exit - To Backup "
ib = 25
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptid
END IF
IF sr = "X" THEN
EXIT SUB
END IF
custinforec.sfirst_name = sr: CALL custinput
END SUB
REM ***************************************************************************
's3:
SUB promptlname
CALL custinput
saction = "Enter Last Name X to Exit To Back up "
ib = 25
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
' IF sr = "-" THEN
' EXIT SUB
' CALL promptfname
' END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.slast_name = sr
CALL custinput
END SUB
REM ***************************************************************************
's4:
SUB promptaddress
CALL custinput
saction = "Enter Address X to Exit - To Back up "
ib = 30
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptlname
END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.saddress = sr
CALL custinput
END SUB
REM ***************************************************************************
's5:
SUB promptcity
CALL custinput
saction = "Enter City Name X to Exit - To Back up "
ib = 25
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptaddress
END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.scity = sr
CALL custinput
END SUB
REM ***************************************************************************
's6:
SUB promptsstate
CALL custinput
saction = "Enter State X to Exit - To Back up "
ib = 2
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptcity
END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.sstate = sr
CALL custinput
END SUB
REM ***************************************************************************
's7:
SUB promptszip
CALL custinput
saction = "Enter Zip Code Name X to Exit - To Back up "
ib = 5
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptsstate
END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.szip = sr
CALL custinput
END SUB
REM ***************************************************************************
's8:
SUB promptphone
CALL custinput
saction = "Enter Phone Number X to Exit - To Back up "
ib = 30
ilow = 99
ihigh = 99
iflag1 = 0
IF iflag2 = 1 THEN
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
ELSE
CALL clearprompt
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END IF
IF sr = "-" THEN
EXIT SUB
CALL promptszip
END IF
IF sr = "X" THEN
EXIT SUB
RETURN
END IF
custinforec.sphone = sr
CALL custinput
LINE INPUT sr
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** set custinforrec variables to zero or null ***************************
REM ***************************************************************************
SUB custinforec_null
custinforec.id = 0
custinforec.sfirst_name = null
custinforec.slast_name = null
custinforec.saddress = null
custinforec.scity = null
custinforec.sstate = null
custinforec.szip = null
custinforec.sphone = null
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** Sytem Header *********************************************************
REM ***************************************************************************
SUB systemheader
COLOR White, Blue
CLS
LOCATE 1, 1: PRINT CHR$(201): LOCATE 1, 80: PRINT CHR$(187)
LOCATE 1, 2: PRINT STRING$(78, 205):
FOR ix = 2 TO 7
LOCATE ix, 1: PRINT CHR$(186)
LOCATE ix, 80: PRINT CHR$(186)
NEXT ix
LOCATE 7, 2: PRINT STRING$(78, 205)
LOCATE 7, 1: PRINT CHR$(200): LOCATE 7, 80: PRINT CHR$(188)
LOCATE 4, 30: PRINT "Main System Menu"
LOCATE 4, 63: PRINT "Date ": LOCATE 4, 68: PRINT DATE$
LOCATE 4, 4: PRINT "Virsion 1.0"
END SUB
REM ***************************************************************************
REM **** printes in system erros **********************************************
REM ***************************************************************************
SUB sprintserrors (se)
CLS
SCREEN 0
IF se = "" THEN se = "INVALID RESPONSE"
itemp = LEN(se)
itemp1 = 40 - (itemp / 2)
BEEP
COLOR 16, 7
'COLOR Yellow, Blue
LOCATE 25, itemp1: _BLINK ON: PRINT se;
Delay 1.5
_BLINK OFF
$COLOR:0
iflag2 = 1
END SUB
REM ***************************************************************************
REM *****************************************************************************
REM **** numeric input sub ******************************************************
REM *****************************************************************************
SUB snumeric (sr, ilow, ihigh)
ftemp = VAL(sr)
IF ftemp < ilow OR ftemp > ihigh THEN
se = "INPUT OUT OF BOUNDS"
CALL sprintserrors(se)
END IF
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** alpha input sub ******************************************************
REM ***************************************************************************
SUB salphainput (saction, ib, ilow, ihigh, iflag1)
iflag2 = 0
ilength1 = LEN(sr)
ilength2 = LEN(saction) + 2
LOCATE 23, 1: PRINT saction; ' prints action menu
LOCATE 23, ilength2 ' set prompt one space after action menu print
COLOR Yellow, Black: PRINT SPC(ib); ' changes color and prints ib spaces to screen for input lenght
LOCATE 23, ilength2 ' sets curser at the begining of input space from previouse line
LINE INPUT sr: sr = UCASE$(sr) ' inputs data from user changes it to upper case
IF LEN(sr) > ib THEN
se = "ENVALID INPUT LENGTH"
CALL sprintserrors(se)
sr = ""
iflag2 = 1
END IF
IF iflag1 = 1 AND sr = "X" THEN iflag1 = 0
IF iflag1 = 1 AND VAL(sr) < ilow AND VAL(sr) > ihigh THEN CALL snumeric(sr, ilow, ihigh)
COLOR White, Blue
END SUB
REM ***************************************************************************
REM **** main menu to the screen **********************************************
REM ***************************************************************************
SUB printmain
COLOR White, Blue
FOR ix = 11 TO imenu
READ smenu(ix): LOCATE ix, 20: PRINT smenu(ix)
NEXT ix
LOCATE 11, 15: PRINT smenu(1)
LOCATE 11, 40: PRINT smenu(2)
LOCATE 13, 15: PRINT smenu(3)
LOCATE 13, 40: PRINT smenu(4)
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** array data goes here *************************************************
REM ***************************************************************************
SUB Delay (dlay!)
start! = TIMER
DO WHILE start! + dlay! >= TIMER
IF start! > TIMER THEN start! = start! - 86400
LOOP
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** menu prompts start here **********************************************
REM ***************************************************************************
SUB mainmenuchoice
ib = 1
ihigh = 99
ilow = 1
saction = "Choose Menu Option or X to Quit "
CALL salphainput(saction, ib, ilow, ihigh, iflag1)
END SUB
REM ***************************************************************************
REM ***************************************************************************
REM **** clean up the prompt area *********************************************
REM ***************************************************************************
SUB clearprompt
LOCATE 23, 1: PRINT STRING$(79, 32)
END SUB
REM ***************************************************************************