@@ -16,50 +16,6 @@ internal partial class FBasicIC
1616 Interpreter basic = null ! ;
1717 ExecutionResult result = null ! ;
1818
19- public FBasicIC ( IConfiguration config )
20- {
21- this . iCommand = "RUN" ;
22- this . config = config ;
23- this . programsFolder = getProgramsFolder ( ) ;
24- this . startupName = config . GetValue < string > ( "Settings:Startup" ) ! ;
25- if ( string . IsNullOrEmpty ( startupName ) ) startupName = "helloWorld.bas" ;
26- }
27-
28-
29- public void welcome ( )
30- {
31- Console . WriteLine ( "FBASIC Interpreter Interactive Console" ) ;
32- Console . WriteLine ( "......................................" ) ;
33- }
34-
35- public void help ( )
36- {
37- Console . WriteLine ( "Help on FBASIC test console" ) ;
38- Console . WriteLine ( "---------------------------" ) ;
39- Console . WriteLine ( "RUN | R :: Run the last loaded program" ) ;
40- Console . WriteLine ( "LOAD | L :: Load a program from the tests folder" ) ;
41- Console . WriteLine ( "INFO | I :: Get information about the execution, errors, etc" ) ;
42- Console . WriteLine ( "LIST | :: List the last loaded program" ) ;
43- Console . WriteLine ( "DIR | :: List all .BAS files in the tests folder" ) ;
44- Console . WriteLine ( "S | :: Show the reversed source of the last loaded program" ) ;
45- Console . WriteLine ( "DUMP | D :: Dump the interpreter state" ) ;
46- Console . WriteLine ( "HELP | ? :: Show this help" ) ;
47- Console . WriteLine ( "QUIT | Q :: Exit of the test console program" ) ;
48- Console . WriteLine ( "CLS | :: Clear the screen" ) ;
49- Console . WriteLine ( ) ;
50- Console . WriteLine ( "BC1 | :: Run Business Case 1 - Credit Scoring" ) ;
51- Console . WriteLine ( ) ;
52- Console . WriteLine ( "TP | :: Run Experiment and test programs. Make sense only to the developers of the FBasic" ) ;
53-
54- }
55-
56- public void ClearScreen ( )
57- {
58- //for (int i = 0; i < 50; i++) Console.WriteLine();
59- Console . Clear ( ) ;
60- }
61-
62-
6319 public void run ( string iCommandArg )
6420 {
6521 if ( env == null ) setupEnvironment ( ) ; // run once
@@ -159,40 +115,6 @@ public void run(string iCommandArg)
159115
160116 }
161117
162-
163- private void internalInfo ( )
164- {
165- Console . WriteLine ( $ "Folder: { programsFolder } ") ;
166- Console . WriteLine ( $ "Program: { startupName } ") ;
167- if ( result != null )
168- {
169- var diff = result . programEndWhen - result . programStartWhen ;
170- Console . WriteLine ( $ "Run duration: { diff . ToString ( "c" ) } seconds") ;
171- }
172- Console . WriteLine ( ) ;
173- #if DEBUG
174- if ( result != null && result . exception != null )
175- {
176- Console . WriteLine ( $ "Exception:") ;
177- string modifiedTrace = StackTraceProcessor . ReplaceFilePathWithFileName ( result . exception . StackTrace ) ;
178- Console . WriteLine ( modifiedTrace ) ;
179- }
180- #endif
181- }
182-
183-
184- private string getProgramsFolder ( )
185- {
186- var progFolder = config . GetValue < string > ( "Settings:ProgramsFolder" ) ! ;
187- if ( string . IsNullOrEmpty ( progFolder ) ) progFolder = @"~\\..\\..\\..\\..\\FAST.FBasic.InteractiveConsole\\Tests" ;
188- if ( progFolder . Contains ( "~" ) )
189- progFolder = progFolder . Replace ( "~" , Environment . CurrentDirectory ) ;
190- //return progFolder;
191- return Path . GetFullPath ( progFolder ) ;
192- }
193-
194-
195-
196118 private void runFBasicProgram ( )
197119 {
198120
@@ -246,35 +168,5 @@ private void runFBasicProgram()
246168
247169 }
248170
249- // static void spBuilder()
250- // {
251- // var folder = Path.Combine(Environment.CurrentDirectory, @"..\..\..", "FBasicInterpreter", "Tests");
252- // Console.WriteLine($"Folder: {folder}");
253- // string name = "lets.bas";
254-
255- // string cs = "<your CS here>";
256- // //connectionAdapterForODBC connection = new(cs, dbDialectDetails.sql);
257-
258- // ExecutionEnvironment env = new();
259- // env.printHandler += Console.WriteLine;
260- // env.inputHandler += Console.ReadLine;
261- // env.callHandler += (name) => { var filepath = Path.Combine(folder, name); return File.ReadAllText(filepath); };
262- // env.requestForObjectHandler += (context, group, name) =>
263- // {
264- // // if ($"{context}.{group}.{name}" == "SQL.CONNECTION.ADAPTER") return connection;
265- // return null;
266- // };
267-
268- // foreach (string file in Directory.GetFiles(folder, name))
269- // {
270- // Console.WriteLine("SP BUILDER:");
271- // Console.WriteLine("---------------------------");
272- // var program = FBasicSource.ToProgram(file);
273- // IsourceCodeBuilder builder = new storedProcedureBuilder();
274- // builder.Build(program);
275- // var src = builder.GetSource();
276- // Console.WriteLine(src);
277- // }
278- // }
279171 }
280172}
0 commit comments