Revision: 66514
Updated Code
at May 21, 2014 05:06 by lalzy
Updated Code
;;;; Start-up, use and compilation ;;; Global-Imports (ql:quickload "cl-utilities") (load "mtu_settings.lisp") (load "mtu_menus.lisp") (load "mtu_input.lisp") ;;; Global variables (defvar *mtu* nil) (defvar *mtub* nil) ; backup (defvar *interface* nil) (defun main_menu (preset) "The Main Menu" (show_main_menu preset) (let ((input (input_loop #'menu_input_check `(,preset)))) (cond ((equal input 'settings) (show_settings_menu) (setf input (input_loop #'settings_input_check nil)) (if (equal input 'exit) (main_menu preset) (format t "Selected: ~a" input))) ((equal input 'exit) (exit)) ((equal input 'showmtu) (format t "Current MTU Value: ~a~%" *mtu*)) ((equal input 'editMtu) (edit_mtu)) ((equal input 'createpmtu) (create_preset_mtu)) ((equal input 'loadpmtu) (load_preset_mtu)) ((equal input 'editpmtu) (edit_preset_mtu)) ((equal input 'deletepmtu) (delete_preset_mtu)) (t (format t "Selected: ~a" input)))) (main_menu preset)) (defun main (&optional preset) "Main Loop" (when (equal (load_settings) 'None) (show_interface_selection (get_interface_list)) (let ((interface (input_loop #'interface_input_check (get_interface_list)))) (create_settings interface)) (main_menu preset))) (defun start () "Start-up function" (main) ) #| (Ext:saveinitmem "W:\\Lisp\\rel-dir\\MTU\\mtu.exe" :init-function #'start :NORC t :script t :executable t :quiet t) #|
Revision: 66513
Updated Code
at May 19, 2014 15:56 by lalzy
Updated Code
(defparameter line-sep "===========================") (defun show_main_menu (&optional preset) "Display appropriate menu" (format t " ~a Main Menu ~a 0 - exit 1 - Show current MTU 2 - Edit MTU 3 - Create Preset MTU~%" line-sep line-sep) (when preset (format t "4 - Load Preset MTU 5 - Edit Preset MTU 6 - Delete preset MTU~%")) (format t "9 - Settings~%>> ")) (defun show_settings_menu () (format t " ~a Settings Menu ~a 0 - back 1 - Change Interface~%>> " line-sep line-sep)) (defun menu_input_check (input arg-list) "Returns the function requested, if it doesn't exist returns invalid Arguments: 1 - preset | Used for checking preset listing if not nil" (let* ((preset (car arg-list))) (cond ((equal input 1) 'showMtu) ((equal input 2) 'EditMTU) ((equal input 3) 'CreatePMTU) ((equal input 9) 'settings) (preset ; If extended menu, allow the other functionality (cond ((equal input 4) 'LoadPMTU) ((equal input 5) 'EditPMTU) ((equal input 6) 'DeletePMTU) (t 'invalid))) (t 'invalid)))) (defun settings_input_check (input arg-list) "Check for valid settings-input" (if (equal input 1) 'changeInterface 'invalid)) (defun input_loop (input_checker arg-list) " Check for valid input, loops if invalid" (let* ((input (read)) (retval (funcall input_checker input arg-list))) (cond ((equal input 0) 'exit) ((equal retval 'invalid) (format t "Invalid Input!~%>> ") (input_loop input_checker arg-list)) (t retval)))) (defun main_menu (preset) "The Main Menu" (show_main_menu preset) (let ((input (input_loop #'menu_input_check `(,preset)))) (cond ((equal input 'settings) (show_settings_menu) (setf input (input_loop #'settings_input_check nil)) (if (equal input 'exit) (main preset) (format t "Selected: ~a" input))) ((equal input 'exit) (exit)) (t (format t "Selected: ~a" input)))) (main preset)) (defun main (&optional preset) "Main Loop" (main_menu preset))
Revision: 66512
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 18, 2014 03:08 by lalzy
Initial Code
(defparameter line-sep "===========================") (defun show_menu (&optional preset) "Display appropriate menu" (format t " ~a Main Menu ~a 0 - exit 1 - Show current MTU 2 - Edit MTU 3 - Create Preset MTU~%" line-sep line-sep) (when preset (format t "4 - Load Preset MTU 5 - Edit Preset MTU 6 - Delete preset MTU~%")) (format t "9 - Settings~%>> ")) (defun show_settings_menu () (format t " ~a Settings Menu ~a 0 - back 1 - Change Interface~%>> " line-sep line-sep)) (defun menu_input_check (input arg-list) "Returns the function requested, if it doesn't exist returns invalid Arguments: 1 - preset | Used for checking preset listing if not nil" (let* ((preset (car arg-list))) (cond ((equal input 1) 'showMtu) ((equal input 2) 'EditMTU) ((equal input 3) 'CreatePMTU) ((equal input 9) 'settings) (preset ; If extended menu, allow the other functionality (cond ((equal input 4) 'LoadPMTU) ((equal input 5) 'EditPMTU) ((equal input 6) 'DeletePMTU) (t 'invalid))) (t 'invalid)))) (defun settings_input_check (input arg-list) "Check for valid settings-input" (if (equal input 1) 'changeInterface 'invalid)) (defun input_loop (input_checker arg-list) " Check for valid input, loops if invalid" (let* ((input (read)) (retval (funcall input_checker input arg-list))) (cond ((equal input 0) 'exit) ((equal retval 'invalid) (format t "Invalid Input!~%>> ") (input_loop input_checker arg-list)) (t retval)))) (defun main_menu (input preset) "The Main-Menu functionality" (cond ((equal input 'settings) (show_settings_menu) (setf input (input_loop #'settings_input_check nil)) (if (equal input 'exit) (main preset) (format t "Selected: ~a" input))) ((equal input 'exit) (exit)) ((equal input 'showmtu) (EXT:RUN-SHELL-COMMAND "netsh interface ipv4 show subinterfaces")) (t (format t "Selected: ~a" input))) (main preset)) (defun main (&optional preset) "Main Loop" (show_menu preset) (let* ((input (input_loop #'menu_input_check `(,preset)))) (main_menu input preset)))
Initial URL
Initial Description
The Main-loop and other main-functions.
Initial Title
MTU-Changing program - Main.lisp
Initial Tags
Initial Language
Lisp