home *** CD-ROM | disk | FTP | other *** search
- DECLARE SUB create.new.documentation.file ()
- DECLARE SUB read.documentation.file ()
- DECLARE SUB read.env.file ()
- REM QBasic program shell
-
- COMMON SHARED ref.units$, val.units$, title$, ref.system$, flag.defn$
- COMMON SHARED val.recs&, rows&, cols&, legend%, data.format%, geo.type%
- COMMON SHARED old.data.type%, old.file.type%
- COMMON SHARED new.data.type%, new.file.type%
- COMMON SHARED wxmin!, wxmax!, wymin!, wymax!, unit.dist!
- COMMON SHARED flag.value!, resolution!, cellx!, celly!
- COMMON SHARED posn.error!, val.error!, min!, max!
- COMMON SHARED path$
- COMMON SHARED digi.port$, plot.port$, prn.port$
- COMMON SHARED drive$, units$
- COMMON SHARED old.image$, new.image$
- COMMON SHARED image.docfile.extension$
- COMMON SHARED image.file.extension$
- COMMON SHARED vector.docfile.extension$
- COMMON SHARED vector.file.extension$
- COMMON SHARED values.docfile.extension$
- COMMON SHARED values.file.extension$
- COMMON SHARED posn.error.flag%, resolution.flag%
- COMMON SHARED val.error.flag%, flag.flag%
-
- DIM SHARED legend.text$(255)
-
- REM ***************************************************************************
-
-
- REM main program goes here
-
-
- REM ***************************************************************************
- REM this program contains three subroutines - to see them in the qbasic
- REM interpreted environment, choose VIEW from the menu bar, and choose
- REM SUBs from the displayed menu. A list of subroutines associated with this
- REM program will be displayed.
- REM ***************************************************************************
-
- SUB create.new.documentation.file
- REM ***************************************************************************
-
- docname$ = drive$ + path$ + new.image$ + image.docfile.extension$
- OPEN docname$ FOR OUTPUT AS #10
-
- IF ((new.data.type% = 0) AND (new.file.type% = 1)) THEN new.data.type% = 2
-
- PRINT #10, "file title : ", title$
-
- SELECT CASE new.data.type%
- CASE 0
- PRINT #10, "data type : integer"
- CASE 1
- PRINT #10, "data type : real"
- CASE 2
- PRINT #10, "data type : byte"
- END SELECT
-
- SELECT CASE new.file.type%
- CASE 0
- PRINT #10, "file type : ascii"
- CASE 1
- PRINT #10, "file type : binary"
- CASE 2
- PRINT #10, "file type : packed binary"
- END SELECT
-
- PRINT #10, "columns :"; cols&
- PRINT #10, "rows :"; rows&
-
- PRINT #10, "ref. system : "; ref.system$
- PRINT #10, "ref. units : "; ref.units$
-
- REM *** note that both ref.system$ and ref.units$ MUST be in LOWER CASE ***
-
- PRINT #10, "unit dist. :"; unit.dist!
- PRINT #10, "min. X :"; wxmin!
- PRINT #10, "max. X :"; wxmax!
- PRINT #10, "min. Y :"; wymin!
- PRINT #10, "max. Y :"; wymax!
-
- IF posn.error.flag% THEN PRINT #10, "pos'n error : "; posn.error! ELSE PRINT #10, "pos'n error : unknown"
- IF resolution.flag% THEN PRINT #10, "resolution :"; resolution! ELSE PRINT #10, "resolution : unknown"
- IF new.data.type% = 1 THEN PRINT #10, "min. value :"; min! ELSE PRINT #10, "min. value :"; min!
- IF new.data.type% = 1 THEN PRINT #10, "max. value :"; max! ELSE PRINT #10, "max. value :"; max!
- IF val.units$ = "" THEN PRINT #10, "value units : unspecified" ELSE PRINT #10, "value units : "; val.units$
-
- REM *** note that val.units$ MUST be in LOWER SELECT CASE ***
-
- IF NOT val.error.flag% THEN PRINT #10, "value error : unknown" ELSE PRINT #10, "value error : "; val.error!; ""
-
- IF NOT flag.flag% THEN
- PRINT #10, "flag value : none"
- ELSEIF new.data.type% = 1 THEN
- PRINT #10, "flag value :"; flag.value!
- ELSE
- PRINT #10, "flag value :"; flag.value!
- END IF
-
- IF flag.defn$ = "" THEN PRINT #10, "flag def'n : none" ELSE PRINT #10, "flag def'n : "; flag.defn$
-
- PRINT #10, "legend cats :"; legend%
-
- IF legend% <> 0 THEN
- IF legend% > 255 THEN legend% = 255
- FOR i = 0 TO (legend% - 1) STEP 1
- temp$ = LEFT$(("category " + STR$(i)), 13) + ": " + legend.text$(i)
- PRINT #10, temp$
- NEXT
- END IF
-
- CLOSE #10
- REM ***************************************************************************
-
- END SUB
-
- SUB read.documentation.file
- REM ***************************************************************************
-
-
- docname$ = drive$ + path$ + old.image$ + image.docfile.extension$
- OPEN docname$ FOR INPUT AS #15
-
- INPUT #15, temp$
- title$ = RIGHT$(temp$, (LEN(temp$) - 14))
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
-
- IF LEFT$(temp$, 7) = "integer" THEN
- old.data.type% = 0
- ELSEIF LEFT$(temp$, 4) = "real" THEN
- old.data.type% = 1
- ELSEIF LEFT$(temp$, 4) = "byte" THEN
- old.data.type% = 2
- ELSEIF LEFT$(temp$, 4) = "word" THEN
- old.data.type% = 3
- ELSE old.data.type% = 999
- END IF
-
- IF old.data.type% > 3 THEN
- PRINT "Error : The "; temp$; " data type is not supported by this module"
- STOP
- END IF
-
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- IF LEFT$(temp$, 5) = "ascii" THEN
- old.file.type% = 0
- ELSEIF LEFT$(temp$, 6) = "binary" THEN
- old.file.type% = 1
- ELSEIF LEFT$(temp$, 13) = "packed binary" THEN
- old.file.type% = 1
- ELSE old.file.type% = 999
- END IF
-
- IF old.file.type% > 1 THEN
- PRINT "Error : The ", temp$, " file type is not supported by this module"
- STOP
- END IF
-
- INPUT #15, temp$
- cols& = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- rows& = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- INPUT #15, temp$
- ref.system$ = RIGHT$(temp$, (LEN(temp$) - 14))
-
- INPUT #15, temp$
- temp$ = UCASE$(temp$)
-
- IF temp$ = "M" OR temp$ = "FT" OR temp$ = "MI" OR temp$ = "KM" OR temp$ = "DEG" OR temp$ = "RAD" THEN ref.units$ = temp$
-
- INPUT #15, temp$
- unit.dist! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- wxmin! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- wxmax! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- wymin! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- wymax! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- cellx! = (wxmax! - wxmin!) / cols&
- celly! = (wymax! - wymin!) / rows&
-
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- posn.error.flag% = false
- posn.error! = 0
-
- temp$ = RTRIM$(temp$)
- posn.error! = VAL(temp$)
- IF posn.error! <> 0 THEN posn.error.flag% = true
-
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- resolution.flag% = false
- resolution! = 0
-
- temp$ = RTRIM$(temp$)
- resolution! = VAL(temp$)
- IF resolution! <> 0 THEN resolution.flag% = true
-
- INPUT #15, temp$
- min! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- max! = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
- INPUT #15, temp$
- val.units$ = RIGHT$(temp$, (LEN(temp$) - 14))
-
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- val.error.flag% = false
- val.error! = 0
-
- temp$ = RTRIM$(temp$)
- val.error! = VAL(temp$)
- IF val.error <> 0 THEN val.error.flag% = true
-
- INPUT #15, temp$
- temp$ = RIGHT$(temp$, (LEN(temp$) - 14))
- flag.flag% = false
- flag.value! = 0
-
- temp$ = RTRIM$(temp$)
- flag.value! = VAL(temp$)
- IF flag.value! <> 0 THEN flag.flag% = true
-
- INPUT #15, temp$
- flag.defn$ = RIGHT$(temp$, (LEN(temp$) - 14))
- INPUT #15, temp$
- legend% = VAL(RIGHT$(temp$, (LEN(temp$) - 14)))
-
- IF legend% <> 0 THEN
- IF legend% > 255 THEN legend% = 255
- FOR i = 0 TO legend% - 1 STEP 1
- INPUT #15, temp$
- legend.text$(i) = RIGHT$(temp$, (LEN(temp$) - 14))
- NEXT i
- END IF
-
- CLOSE #15
- REM ***************************************************************************
-
- END SUB
-
- SUB read.env.file
- REM ***************************************************************************
-
- path$ = ""
- drive$ = ""
-
- OPEN "idrisi.env" FOR INPUT AS #20
-
- INPUT #20, temp$
- INPUT #20, temp$
- INPUT #20, temp$
- drive$ = RIGHT$(temp$, (LEN(temp$) - 40))
-
- INPUT #20, temp$
- path$ = RIGHT$(temp$, (LEN(temp$) - 40))
-
- INPUT #20, temp$
- image.file.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- image.docfile.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- vector.file.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- vector.docfile.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- values.file.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- values.docfile.extension$ = RIGHT$(temp$, (LEN(temp$) - 40))
-
- INPUT #20, temp$
- ref.units$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- digi.port$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- plot.port$ = RIGHT$(temp$, (LEN(temp$) - 40))
- INPUT #20, temp$
- prn.port$ = RIGHT$(temp$, (LEN(temp$) - 40))
-
- CLOSE #20
-
- IF path$ = "none" THEN path$ = ""
- IF drive$ = "no" THEN drive$ = ""
- IF MID$(drive$, 2) <> ":" THEN drive$ = ""
- REM ***************************************************************************
-
- END SUB
-