I start to make a little command line IDE for BASIC

DOS specific questions.
exagonx
Posts: 107
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

I start to make a little command line IDE for BASIC

Postby exagonx » Apr 02, 2018 10:31

Before I start Happy Easter to all

Yesterday during the afternoon I lose a little of time with a hold pc "Pentium 166Mhz MMX" 32MB RAM and S3Trio Virge DX/GX 2MB with Windows 98
I download last FreeBASIC for DOS CWSDPMI Driver and I writed a little code for make a Command Line IDE.

Its seems like it works
But Im not sure Is writed correctly.

Code: Select all

CONST PROJ_NAME = "IDEBAS" '                                                   >
CONST PROJ_DESC = "BASIC IDE for Command Line" '                               >
CONST PROJ_VERS = "0.01.00" '                                                  >
CONST PROJ_YEAR = "2018" '                                                     >
CONST PROJ_AUTH = "Graziano Falcone" '                                         >
CONST PROJ_MAIL = "exagonx@hotmail.com" '                                      >
CONST PROJ_WEBS = "exagonx.altervista.org" '                                   >
CONST PROJ_LICE = "" '                                                         >



Declare sub Comandi(ByVal Comando as String)

Declare Function IsCommand(ByVal Stringa As String, ByVal dfcm As String)As Integer



Function IsCommand(ByVal Stringa As String, ByVal dfcm As String)As Integer
rem dfcm = "funzi" dfcm = "defin"
Dim As Integer CiR, ISC
Dim As String StrCom

If ucase(dfcm) = "FUNZI" then Restore Funzioni
If ucase(dfcm) = "DEFIN" then Restore Definizione


CiR = 0
Do Until CiR = 1
Read StrCom

If Ucase(StrCom) = Ucase(Stringa) Then
ISC = 1
CiR = 1
End If
If StrCom = "000" Then
ISC = 0
CiR = 1
End If

Loop
Return ISC

End Function



Sub Interprete(ByVal Stringa as String, ByVal CCom As Integer, ByVal CFun As Integer,ByVal CNor As Integer, ByVal CStri As Integer)

Dim As String MyCom, Parola, Compose, Estratto, SiCh
Dim As Integer FinStr, LunStr, Passo, LunPar, Conf, ConStr, Riga, Colonna, ContStr

FinStr = 0
Passo = 0

Input "<> ", MyCom


LunStr = Len(MyCom)
ConStr = 0

Riga = Csrlin + 1
'Print Riga
if Riga > 24 Then Print " ": Riga = 24
Colonna = 1

Do Until FinStr = 1
Passo = Passo + 1
If Passo > (LunStr + 1) Then
End If

   SiCh = Mid(MyCom, Passo, 1)
   
   If SiCh = Chr(32) Or SiCh = Chr(34) Or SiCh = Chr(39) Or Passo > (LunStr + 1) Then
   
      If ConStr = 0 Then
         If SiCh = Chr(32) Or Passo > (LunStr + 1) Then
            Conf = 0
            
            if IsCommand(Parola,"FUNZI") = 1 Then
               Color CCom, 0
               
               Locate Riga , Colonna
               Print Parola
               Colonna = Colonna + Len(Parola) + 1
               Conf = 1
               
            End If
      
            if IsCommand(Parola,"DEFIN") = 1 Then
               Color CFun, 0
               
               Locate Riga , Colonna
               Print Parola
               Colonna = Colonna + Len(Parola) + 1
               Conf = 1
               
            End if
         
            If Conf = 0 Then
               Color CNOr, 0
               
               Locate Riga , Colonna
               Print Parola
               Colonna = Colonna + Len(Parola) + 1
               Conf = 1
               
            End If
            
            If Conf = 1 Then  Parola = ""
            
         End If
         
         If SiCh = Chr(34) Then ConStr = 1:Parola = Parola & SiCh
         If SiCh = Chr(39) Then ConStr = 2:Parola = Parola & SiCh
      Else
         If    ContStr = 1 Then
            Parola = Parola & SiCh
               
            Color CStri, 0
            
            Locate Riga , Colonna
            Print Parola    
            Colonna = Colonna + Len(Parola) + 1   
            Parola = ""   
         Else
         
            If SiCh = Chr(34) or SiCh = Chr(39) Then
               Parola = Parola & SiCh
            End if
            
            Color Cstri, 0
            
            Locate Riga , Colonna
            Print Parola
            Colonna = Colonna + Len(Parola) + 1
            Parola = ""
         End If
      End If
      
   Else
      Parola = Parola & SiCh
      
   
   End If
   
   If Passo > (LunStr + 1) Then FinStr = 1



Loop
Color 7, 0
print " "









End Sub


Interprete("", 10, 14, 7, 12)

Funzioni:
DATA "abs", "access", "acos", "add", "alias", "allegro", "allocate", "alpha", "and", "any", "andalso", "append", "as"
DATA "asc", "ascii", "asi", "asm", "assert", "atn", "bass", "bassmod", "beep", "bfd", "big_int", "bin", "binary", "bit"
DATA "bload", "bsave", "byref", "byval", "byte", "caca", "call", "callocate", "case", "cast", "cbyte", "cdbl", "cdecl"
DATA "cgi-util", "cgui", "chain", "chdir", "chr", "cint", "circle", "class", "clear", "clng", "clngint", "close", "cls"
DATA "color", "command", "comments", "common", "condbroadcast", "condcreate", "conddestroy", "condsignal", "condwait"
DATA "const", "constants", "constructor", "continue", "continue do", "continue for", "continue while", "control flow"
DATA "cos", "cptr", "cryptlib", "cshort", "csign", "csng", "csrlin", "cubyte", "cuint", "culng", "culngint", "cunit", "cunsg"
DATA "curdir", "curl", "curses", "cushort", "cvd", "cvi", "cvl", "cvlongint", "cvs", "cvshort", "data", "date"
DATA "dateadd", "datediff", "datepart", "dateserial", "datevalue", "day", "deallocate", "debugging", "declare", "default"
DATA "defbyte", "defdbl", "defined", "defint", "deflng", "deflongint", "defshort", "defsng", "defstr", "defubyte", "defuint"
DATA "defulongint", "defushort", "delete", "destructor", "dim", "dir", "dislin", "disphelper", "do", "loop", "while", "double"
DATA "draw", "draw string", "dylibfree", "dylibload", "dylibsymbol", "else", "else if", "encoding", "end", "end if", "enum"
DATA "end enum", "environ", "environ statement", "eof", "eqv", "erase", "erfn", "erl", "ermn", "err", "error", "error handling"
DATA "herror handling functions", "exec", "exepath", "exit", "exit do", "exit for", "exit select", "exit while", "exp", "expat"
DATA "export", "extern", "end extern", "fastcgi"
DATA "field", "fileattr", "filecopy", "filedatetime", "fileexists", "filelen", "fix", "flip", "fmod", "for", "next", "to"
DATA "step", "format", "frac", "fre", "freefile", "function", "gd", "gdsl", "get", "get #", "getjoystick", "getkey", "getmouse"
DATA "gif_lib", "gmp", "gosub", "goto", "grx", "gsl", "gtk", "hex", "hibyte", "hiword", "hour", "if", "then", "else"
DATA "end if", "else if", "imp", "import", "implicit", "inkey", "initialization", "inp", "inline asm", "input", "input #"
DATA "input$", "installing", "instr", "instrrev", "int", "integer", "ls", "lsdate", "iup", "japi", "jni", "jpeglib"
DATA "jpegalleg", "kill", "labels", "lbound", "lcase", "left", "len", "let", "lib", "libpng", "lbxml", "libslt", "line"
DATA "line input", "line input #", "literals", "lobyte", "loc", "local", "locate", "lock", "lof", "log", "long"
DATA "long", "longint", "loop", "loword", "lpos", "lprint", "lpt", "lset", "ltrim", "lua", "lzo", "mid", "minute", "mkd"
DATA "mkdir", "mki", "mkl", "mklongint", "mks", "mkshrt", "mod", "modularizing", "month", "monthname", "multikey"
DATA "mutexcreate", "mutexdestroy", "mutexlock", "mutexunlock", "mxml", "mysql", "name", "namespace", "new", "newton"
DATA "next", "not", "now", "oct", "ode", "offsetof", "on error", "on gosub", "on goto", "on local error", "goto", "gosub"
DATA "once", "open", "open com", "open cons", "open err", "open lpt", "open pipe", "open scm", "openal", "opengl", "or"
DATA "orelse", "output", "overload", "overview", "paint", "palette", "pascal", "pcopy", "pcre", "pdflib"
DATA "peek", "pmap", "point", "pointer", "poke", "pos", "postgresql", "preset", "print", "print #", "print using"
DATA "print using #", "private", "procedures", "procptr", "profiling", "property", "protected", "pset", "ptr", "public"
DATA "put", "put #", "quicklz", "radians", "random", "randomize", "read", "reallocate", "redim", "requirements", "rem"
DATA "reset", "restore", "resume", "resume next", "return", "rgb", "rgba", "right", "rmdir", "rnd", "rset", "rtrim", "run"
DATA "sadd", "scope", "screen", "screencontrol", "screencopy", "screenevent", "screenglproc", "screeninfo", "screenlist"
DATA "screenlock", "screenptr", "screenres", "screenset", "screensync", "screenunlock", "sdl", "second", "seek", "select case"
DATA "select", "case", "end select", "setdate", "setenviron", "setmouse", "settime", "sgn", "shared", "shl", "short", "shr"
DATA "sin", "single", "sizeof", "sleep", "space", "spc", "spidermonkey", "sqlite", "sqr", "static", "stdcall", "step"
DATA "stick", "stop", "str", "storage classes", "strig", "string", "strptr", "sub", "swap", "system", "tab", "tan", "then"
DATA "this", "threadcreate", "thread wait", "time", "timer", "timeserial", "timevalue", "tinyptc", "to", "trans"
DATA "tre", "trim", "type", "end type", "typeof", "ubound", "ubyte", "ucase", "uinteger", "ulong", "ulongint", "union"
DATA "end union", "unlock", "unsigned", "until", "ushort", "using", "va_arg", "va_first", "va_next", "val", "valint"
DATA "vallng", "valuint", "valulng", "var", "varptr", "variables", "view", "wait", "wbin", "wchr", "weekday", "weekdayname"
DATA "wend", "whex", "while", "wend", "width", "window", "window title", "winput", "with", "woct", "write", "write #", "wspace"
DATA "wstr", "wstring", "xor", "zlib", "zstring", "year"
DATA "000"

Definizione:
DATA "__FB_ARGC__", "__FB_ARGV__", "__FB_BIGENDIAN__", "__FB_BUILD_DATE__"
DATA "__FB_CYGWIN__", "__FB_DEBUG__", "__FB_DOS__", "__FB_ERR__", "__FB_FREEBSD__", "__FB_LANG__", "__FB_LINUX__"
DATA "__FB_MAIN__", "__FB_MIN_VERSION__", "__FB_MT__", "__FB_OPTION_BYVAL__", "__FB_OPTION_DYNAMIC__", "__FB_OPTION_ESCAPE__"
DATA "__FB_OPTION_EXPLICIT__", "__Fb_Option_Gosub__", "__FB_OPTION_PRIVATE__", "__FB_OUT_DLL__", "__FB_OUT_EXE__"
DATA "__FB_OUT_LIB__", "__FB_OUT_OBJ__", "__FB_SIGNATURE__", "__FB_SSE__", "__FB_VER_MAJOR__", "__FB_VER_MINOR__"
DATA "__FB_VER_PATCH__", "__FB_VERSION__", "__FB_WIN32__", "__FB_XBOX__", "__TIME__", "__PATH__", "__LINE__", "__DATE__"
DATA "+", "-", "*", "/", "=", "?"
DATA "000"



This is the output
Image
If Someone can give me a tip for make something better im happy ^_^

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest