Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,61 @@
|
|||
BOOL = 1
|
||||
NAME = 2
|
||||
ARRAY = 3
|
||||
|
||||
optfile$ = "options.cfg"
|
||||
|
||||
fullname$ = FNoption(optfile$, "FULLNAME", NAME)
|
||||
favouritefruit$ = FNoption(optfile$, "FAVOURITEFRUIT", NAME)
|
||||
needspeeling% = FNoption(optfile$, "NEEDSPEELING", BOOL)
|
||||
seedsremoved% = FNoption(optfile$, "SEEDSREMOVED", BOOL)
|
||||
!^otherfamily$() = FNoption(optfile$, "OTHERFAMILY", ARRAY)
|
||||
|
||||
PRINT "fullname = " fullname$
|
||||
PRINT "favouritefruit = " favouritefruit$
|
||||
PRINT "needspeeling = "; : IF needspeeling% PRINT "true" ELSE PRINT "false"
|
||||
PRINT "seedsremoved = "; : IF seedsremoved% PRINT "true" ELSE PRINT "false"
|
||||
PRINT "otherfamily(1) = " otherfamily$(1)
|
||||
PRINT "otherfamily(2) = " otherfamily$(2)
|
||||
END
|
||||
|
||||
DEF FNoption(file$, key$, type%)
|
||||
LOCAL file%, opt$, comma%, bool%, name$, size%, !^array$()
|
||||
file% = OPENIN(file$)
|
||||
IF file% = 0 THEN = 0
|
||||
WHILE NOT EOF#file%
|
||||
opt$ = GET$#file%
|
||||
WHILE RIGHT$(opt$) = " " opt$ = LEFT$(opt$) : ENDWHILE
|
||||
IF opt$ = key$ OR LEFT$(opt$, LEN(key$)+1) = key$ + " " THEN
|
||||
opt$ = MID$(opt$, LEN(key$) + 1)
|
||||
WHILE LEFT$(opt$,1) = " " opt$ = MID$(opt$,2) : ENDWHILE
|
||||
CASE type% OF
|
||||
WHEN BOOL: bool% = TRUE : EXIT WHILE
|
||||
WHEN NAME: name$ = opt$ : EXIT WHILE
|
||||
WHEN ARRAY:
|
||||
REPEAT
|
||||
comma% = INSTR(opt$, ",", comma%+1)
|
||||
IF comma% size% += 1
|
||||
UNTIL comma% = 0
|
||||
DIM array$(size% + 1)
|
||||
size% = 0
|
||||
REPEAT
|
||||
comma% = INSTR(opt$, ",")
|
||||
IF comma% THEN
|
||||
size% += 1
|
||||
array$(size%) = LEFT$(opt$, comma%-1)
|
||||
opt$ = MID$(opt$, comma%+1)
|
||||
WHILE LEFT$(opt$,1) = " " opt$ = MID$(opt$,2) : ENDWHILE
|
||||
ENDIF
|
||||
UNTIL comma% = 0
|
||||
array$(size% + 1) = opt$
|
||||
EXIT WHILE
|
||||
ENDCASE
|
||||
ENDIF
|
||||
ENDWHILE
|
||||
CLOSE #file%
|
||||
CASE type% OF
|
||||
WHEN BOOL: = bool%
|
||||
WHEN NAME: = name$
|
||||
WHEN ARRAY: = !^array$()
|
||||
ENDCASE
|
||||
= 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue