"############################################################################################### " " Filename: nqc.vim " " Description: gvim-menus for NQC (Not Quite C), Version 2.3r1 . " " NQC stands for Not Quite C, and is a simple language for programmimg " several LEGO MINDSTORMS products: RCX, CyberMaster, Scout and RCX2. " The language is described in: " NQC Programmers's Guide, Version 2.3r1, by Dave Baum " ( http://www.enteract.com/~dbaum/ ) " " nqc.vim turns gvim into an IDE for NQC programming: " - insertion of NQC statements, API function calls, API constants and comments " - download and start programs " - download firmware " - upload the RCX datalog into the current buffer " - erase programs and datalogs " - configurable for RCX, RCX2, CyberMaster, Scout " " Version: 1.5 - LINUX / UNIX " Revision: 10.09.2001 " Author: Dr.-Ing. Fritz Mehner " Email: mehner@mfh-iserlohn.de " Created: 28.07.2001 " " Usage: (1.0) Configure nqc.vim (section Configuration below). " " (2.1) Load nqc.vim manually into VIM with the 'so' command: " :so ~//nqc.vim " " or better " (2.2) Load nqc.vim on startup (VIM versions below 6) : " - Rename nqc.vim to .nqc.vim and move it to your home directory. " - place the following command in your file .gvimrc : " :so ~/.nqc.vim " or " (2.3) Load nqc.vim on startup (VIM version 6.0 and higher) : " - move this file to the directory ~/.vim/plugin/ " " Hints: The register z is used in many places. " "############################################################################################### " Configuration (Use my configuration as an example) "----------------------------------------------------------------------------------------------- " " Personalization (full name, email, ... ; used in comments) : " let NQC_AuthorName = "Fritz Mehner" let NQC_AuthorRef = "FM" " " --------------------------------------------------------------------- " " RCX-Firmware (RCX 1.5, RCX 2.0, ... ); full path and filename : " let NQC_RCX_Firmware = "~/bin/firm0328.lgo" " " --------------------------------------------------------------------- " " Choose a target : " " RCX : Mindstorms with RCX " RCX2 : Mindstorms with RCX 2 " Scout : Scout " CM : Cybermaster " let NQC_Target = "RCX2" " " --------------------------------------------------------------------- " " Specify serial port, case matters (file permission 777) : " /dev/ttyS0 = COM1 " /dev/ttyS1 = COM2 " let NQC_Portname = "/dev/ttyS0" " "############################################################################################### " Key Mappings "----------------------------------------------------------------------------------------------- " This is for convenience only. Comment out the following maps if you dislike them. " If enabled, there may be conflicts with predefined key bindings of your window manager. " " F2 write buffer to file without confirmation (update) " F3 file open dialog " map :update map :browse confirm e " "############################################################################################### " "=============================================================================================== "----- Menu : NQC-Comments --------------------------------------------------------------------- "=============================================================================================== " MENU ENTRY " ----------------- " Line End Comment " Frame Comment " Function Description " File Prologue " Author+Date+Time " Date+Time " Date " comment out a highlighted block of code " uncomment a highlighted block of code "=============================================================================================== " imenu NQC-&Comments.&Line\ End\ Comment // imenu NQC-&Comments.&Frame\ Comment :call NQC_CommentFrame() jA imenu NQC-&Comments.task\/function\/sub\ &Description :call NQC_CommentFunction() :/NameA imenu NQC-&Comments.File\ &Prologue :call NQC_CommentFilePrologue() :/DescriptionA imenu NQC-&Comments.-SEP1- : imenu NQC-&Comments.\/\/\ Date\ Time\ &Author $:call NQC_CommentDateTimeAuthor() kJA imenu NQC-&Comments.Date\ &Time :call NQC_CommentDateTime() kJi imenu NQC-&Comments.Date :call NQC_CommentDate() kJi imenu NQC-&Comments.-SEP2- : vmenu NQC-&Comments.&code->comment :'<,'>s/^/\/\// vmenu NQC-&Comments.c&omment->code :'<,'>s/^\/\/// " "=============================================================================================== "----- Menu : NQC-Statements ------------------------------------------------------------------- "=============================================================================================== " Inserting at the end of a line preserves indentation. "----------------------------------------------------------------------------------------------- " imenu NQC-St&atements.&if\ \{\ \} :let @z="if ( )\n\t{\n\t\n\t}\n" "z]pf(la imenu NQC-St&atements.if\ \{\ \}\ &else\ \{\ \} :let @z="if ( )\n\t{\n\t\n\t}\nelse\n\t{\n\t\n\t}\n" "z]pf(la imenu NQC-St&atements.&for\ \{\ \} :let @z="for ( ; ; )\n\t{\n\t\n\t}\n" "z]pf;i imenu NQC-St&atements.&while\ \{\ \} :let @z="while ( )\n\t{\n\t\n\t}\n" "z]pf(la imenu NQC-St&atements.&do\ \{\ \}\ while :call NQC_DoWhile() "z]p:/while f(la imenu NQC-St&atements.&repeat\ \{\ \} :let @z="repeat ( )\n\t{\n\t\n\t}\n" "z]pf(la imenu NQC-St&atements.&switch :call NQC_CodeSwitch() "z]pf(la imenu NQC-St&atements.&case :call NQC_CodeCase() "z]pf:i imenu NQC-St&atements.-SEP1- : imenu NQC-St&atements.&task :call NQC_CodeTask() imenu NQC-St&atements.in&line\ function :call NQC_CodeInlineFunction() imenu NQC-St&atements.s&ubroutine :call NQC_CodeSubroutine() imenu NQC-St&atements.-SEP2- : imenu NQC-St&atements.#include\ \"\.\.\.\" :let @z="#include\t\".nqh\"" "zpF.i imenu NQC-St&atements.&#define :let @z="#define\t\t\t\t// " "zp4Fa imenu NQC-St&atements.#if&ndef\.\.#def\.\.#endif :call NQC_CodeIfndef() imenu NQC-St&atements.#ifdef\.\.#endif #ifdef#endif3kA if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu NQC-St&atements.-SEP3- : imenu NQC-St&atements.&acquire :call NQC_Acquire()f(a imenu NQC-St&atements.&monitor :call NQC_Monitor()f(a imenu NQC-St&atements.&catch\ \(\ \) :call NQC_Catch()f(a endif " "=============================================================================================== "----- Menu : API-Functions -------------------------------------------------------------------- "=============================================================================================== " "----- outputs ---------------------------------------------------------------------------- imenu API-Functions.outputs.Float\ (outputs) Float();F(a imenu API-Functions.outputs.Fwd\ (outputs) Fwd();F(a imenu API-Functions.outputs.Off\ (outputs) Off();F(a imenu API-Functions.outputs.On\ (outputs) On();F(a imenu API-Functions.outputs.OnFor\ (outputs,time) OnFor(,);F(a imenu API-Functions.outputs.OnFwd\ (outputs) OnFwd();F(a imenu API-Functions.outputs.OnRev\ (outputs) OnRev();F(a imenu API-Functions.outputs.OutputStatus\ (n) OutputStatus()F(a imenu API-Functions.outputs.Rev\ (outputs) Rev();F(a imenu API-Functions.outputs.SetDirection\ (outputs,dir) SetDirection(,);F(a imenu API-Functions.outputs.SetOutput\ (outputs,mode) SetOutput(,);F(a imenu API-Functions.outputs.SetPower\ (outputs,power) SetPower(,);F(a imenu API-Functions.outputs.Toggle\ (outputs) Toggle();F(a "----- sensor types, modes, information --------------------------------------------------- imenu API-Functions.sensors.ClearSensor\ (sensor) ClearSensor();F(a if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="CM" imenu API-Functions.sensors.SensorMode\ (n) SensorMode();F(a endif imenu API-Functions.sensors.SensorType\ (n) SensorType();F(a if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.sensors.SensorValueBool\ (n) SensorValueBool()F(a endif if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.sensors.SensorValueRaw\ (n) SensorValueRaw()F(a endif imenu API-Functions.sensors.SensorValue\ (n) SensorValue()F(a if NQC_Target=="Scout" imenu API-Functions.sensors.SetSensorLowerLimit\ (value) SetSensorLowerLimit();F(a imenu API-Functions.sensors.SetSensorUpperLimit\ (value) SetSensorUpperLimit();F(a imenu API-Functions.sensors.SetSensorHysteresis\ (value) SetSensorHysteresis();F(a imenu API-Functions.sensors.CalibrateSensor\ (\ ) CalibrateSensor(); endif if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.sensors.SetSensor\ (sensor,config) SetSensor(,);F(a endif if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="CM" imenu API-Functions.sensors.SetSensorMode\ (sensor,mode) SetSensorMode(,);F(a endif if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.sensors.SetSensorType\ (sensor,type) SetSensorType(,)F(a endif "----- timers and counters ---------------------------------------------------------------- imenu API-Functions.timers\ counters.ClearTimer\ (n) ClearTimer();F(a imenu API-Functions.timers\ counters.Timer\ (n) Timer()F(a if NQC_Target=="RCX2" imenu API-Functions.timers\ counters.FastTimer\ (n) FastTimer()F(a imenu API-Functions.timers\ counters.SetTimer\ (n,value) SetTimer(,);F(a endif if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.timers\ counters.Counter\ (n) Counter()F(a imenu API-Functions.timers\ counters.ClearCounter\ (n) ClearCounter();F(a imenu API-Functions.timers\ counters.DecCounter\ (n) DecCounter();F(a imenu API-Functions.timers\ counters.IncCounter\ (n) IncCounter();F(a endif "----- sounds ----------------------------------------------------------------------------- if NQC_Target=="RCX2" imenu API-Functions.sounds.ClearSound\ (\n) ClearSound(); endif imenu API-Functions.sounds.PlaySound\ (sound) PlaySound();F(a imenu API-Functions.sounds.PlayTone\ (freq,duration) PlayTone(,);F(a if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.sounds.MuteSound\ (\n) MuteSound(); imenu API-Functions.sounds.UnmuteSound\ (\n) UnmuteSound(); endif if NQC_Target=="Scout" imenu API-Functions.sounds.SelectSound\ (group) SelectSound();F(a endif "----- LCD display ------------------------------------------------------------------------ if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.display.SelectDisplay\ (mode) SelectDisplay();F(a endif if NQC_Target=="RCX2" imenu API-Functions.display.SelectUserDisplay\ (value,precision) SelectUserDisplay(,);F(a endif "----- messages --------------------------------------------------------------------------- if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.messages.ClearMessage\ (\ ) ClearMessage(); imenu API-Functions.messages.Message\ (\ ) Message() imenu API-Functions.messages.SendMessage\ (message) SendMessage();F(a imenu API-Functions.messages.SetTxPower\ (power) SetTxPower();F(a endif "----- general ---------------------------------------------------------------------------- imenu API-Functions.general.Random\ (n) Random()F(a imenu API-Functions.general.SetSleepTime\ (minutes) SetSleepTime();F(a if NQC_Target=="RCX2" imenu API-Functions.general.SetRandomSeed\ (n) SetRandomSeed();F(a endif imenu API-Functions.general.SleepNow\ (\ ) SleepNow(); imenu API-Functions.general.StopAllTasks\ (\ ) StopAllTasks(); imenu API-Functions.general.Wait\ (time) Wait();F(a "----- RCX features ----------------------------------------------------------------------- if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.RCX\ features.Program\ (\ ) Program() imenu API-Functions.RCX\ features.SetWatch\ (hours,minutes) SetWatch(,);F(a imenu API-Functions.RCX\ features.Watch\ (\n) Watch() endif if NQC_Target=="RCX2" imenu API-Functions.RCX\ features.BatteryLevel\ (\ ) BatteryLevel() imenu API-Functions.RCX\ features.FirmwareVersion\ (\ ) FirmwareVersion() imenu API-Functions.RCX\ features.SelectProgram\ (n) SelectProgram();F(a endif "----- SCOUT features ----------------------------------------------------------------------- if NQC_Target=="Scout" imenu API-Functions.Scout\ features.EventFeedback\ (\ ) EventFeedback() imenu API-Functions.Scout\ features.ScoutRules\ (n) ScoutRules()F(a imenu API-Functions.Scout\ features.SetEventFeedback\ (events) SetEventFeedback();F(a imenu API-Functions.Scout\ features.SetLight\ (mode) SetLight();F(a imenu API-Functions.Scout\ features.SetScoutRules\ (motion,touch,light,time,fx) SetScoutRules(,,,,);F(a imenu API-Functions.Scout\ features.SetScoutMode\ (mode) SetScoutMode();F(a endif "----- CYBERMASTER features ----------------------------------------------------------------------- if NQC_Target=="CM" imenu API-Functions.cybermaster\ features.Drive\ (motor0,motor1) Drive(,);F(a imenu API-Functions.cybermaster\ features.OnWait\ (motors,time) OnWait(,);F(a imenu API-Functions.cybermaster\ features.OnWaitDifferent\ (motors,n0,n1,n2,time) OnWaitDifferent(,,,,);F(a imenu API-Functions.cybermaster\ features.ClearTachoCounter\ (motors) ClearTachoCounter();F(a imenu API-Functions.cybermaster\ features.TachoCount\ (n) TachoCount()F(a imenu API-Functions.cybermaster\ features.TachoSpeed\ (n) TachoSpeed()F(a imenu API-Functions.cybermaster\ features.ExternalMotorRunning\ (\n) ExternalMotorRunning() imenu API-Functions.cybermaster\ features.AGC\ (\ ) AGC() endif "----- datalog ---------------------------------------------------------------------------- if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Functions.datalog.AddToDatalog\ (value) AddToDatalog();F(a imenu API-Functions.datalog.CreateDatalog\ (size) CreateDatalog();F(a imenu API-Functions.datalog.UploadDatalog\ (start,count) UploadDatalog(,);F(a endif "----- global control -------------------------------------------------------------------- if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.global\ control.SetGlobalOutput\ (outputs,mode) SetGlobalOutput(,);F(a imenu API-Functions.global\ control.SetGlobalDirection\ (outputs,mode) SetGlobalDirection(,);F(a imenu API-Functions.global\ control.SetMaxPower\ (outputs,power) SetMaxPower(,);F(a imenu API-Functions.global\ control.GlobalOutputStatus\ (n) GlobalOutputStatus()F(a endif "----- serial ---------------------------------------------------------------------------- if NQC_Target=="RCX2" imenu API-Functions.serial.InternalMessage\ (message) InternalMessage();F(a imenu API-Functions.serial.SetSerialComm\ (settings) SetSerialComm();F(a imenu API-Functions.serial.SetSerialPacket\ (settings) SetSerialPacket();F(a imenu API-Functions.serial.SetSerialData\ (n,value) SetSerialData(,);F(a imenu API-Functions.serial.SerialComm\ (\ ) SerialComm() imenu API-Functions.serial.SerialData\ (n) SerialData()F(a imenu API-Functions.serial.SerialPacket\ (\ ) SerialPacket() imenu API-Functions.serial.SendSerial\ (start,count) SendSerial(,);F(a endif "----- VLL -------------------------------------------------------------------------------- if NQC_Target=="Scout" imenu API-Functions.VLL.SendVLL\ (value) SendVLL();F(a endif "----- access control ---------------------------------------------------------------------- if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Functions.access\ control.SetPriority\ (p) SetPriority();F(a endif "----- RCX2 events ------------------------------------------------------------------------- if NQC_Target=="RCX2" imenu API-Functions.RCX2\ events.CalibrateEvent\ (event,lower,upper,hyst) CalibrateEvent(,,,);F(a imenu API-Functions.RCX2\ events.ClearAllEvents\ (\ ) ClearAllEvents() imenu API-Functions.RCX2\ events.ClearEvent\ (event) ClearEvent()F(a imenu API-Functions.RCX2\ events.ClickCounter\ (event) ClickCounter()F(a imenu API-Functions.RCX2\ events.ClickTime\ (event) ClickTime()F(a imenu API-Functions.RCX2\ events.Event\ (event) Event();F(a imenu API-Functions.RCX2\ events.EventState\ (event) EventState()F(a imenu API-Functions.RCX2\ events.Hysteresis\ (event) Hysteresis()F(a imenu API-Functions.RCX2\ events.LowerLimit\ (event) LowerLimit()F(a imenu API-Functions.RCX2\ events.SetClickCounter\ (event,value) SetClickCounter();F(a imenu API-Functions.RCX2\ events.SetClickTime\ (event,value) SetClickTime();F(a imenu API-Functions.RCX2\ events.SetEvent\ (event,source,type) SetEvent();F(a imenu API-Functions.RCX2\ events.SetHysteresis\ (event,value) SetHysteresis();F(a imenu API-Functions.RCX2\ events.SetLowerLimit\ (event,limit) SetLowerLimit();F(a imenu API-Functions.RCX2\ events.SetUpperLimit\ (event,limit) SetUpperLimit();F(a imenu API-Functions.RCX2\ events.UpperLimit\ (event) UpperLimit()F(a imenu API-Functions.RCX2\ events.ActiveEvents\ (task) ActiveEvents()F(a imenu API-Functions.RCX2\ events.CurrentEvents\ (\ ) CurrentEvents(); imenu API-Functions.RCX2\ events.Events\ (events) Events()F(a endif "----- Scout events ------------------------------------------------------------------------ if NQC_Target=="Scout" imenu API-Functions.Scout\ events.ActiveEvents\ (task) ActiveEvents();F(a imenu API-Functions.Scout\ events.CounterLimit\ (n) CounterLimit()F(a imenu API-Functions.Scout\ events.Events\ (events) Events();F(a imenu API-Functions.Scout\ events.SetSensorClickTime\ (time) SetSensorClickTime();F(a imenu API-Functions.Scout\ events.SetCounterLimit\ (n,value) SetCounterLimit(,);F(a imenu API-Functions.Scout\ events.SetTimerLimit\ (n,value) SetTimerLimit(,);F(a imenu API-Functions.Scout\ events.TimerLimit\ (n) TimerLimit()F(a endif " " "=============================================================================================== "----- Menu : API-Constants -------------------------------------------------------------------- "=============================================================================================== " "----- access control --------------------------------------------------------------------- if NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Constants.access\ control.ACQUIRE_OUT_A ACQUIRE_OUT_A imenu API-Constants.access\ control.ACQUIRE_OUT_B ACQUIRE_OUT_B imenu API-Constants.access\ control.ACQUIRE_OUT_C ACQUIRE_OUT_C imenu API-Constants.access\ control.ACQUIRE_SOUND ACQUIRE_SOUND endif if NQC_Target=="RCX2" imenu API-Constants.access\ control.ACQUIRE_USER_1 ACQUIRE_USER_1 imenu API-Constants.access\ control.ACQUIRE_USER_2 ACQUIRE_USER_2 imenu API-Constants.access\ control.ACQUIRE_USER_3 ACQUIRE_USER_3 imenu API-Constants.access\ control.ACQUIRE_USER_4 ACQUIRE_USER_4 endif "----- display ---------------------------------------------------------------------------- if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Constants.display.DISPLAY_OUT_A DISPLAY_OUT_A imenu API-Constants.display.DISPLAY_OUT_B DISPLAY_OUT_B imenu API-Constants.display.DISPLAY_OUT_C DISPLAY_OUT_C imenu API-Constants.display.DISPLAY_SENSOR_1 DISPLAY_SENSOR_1 imenu API-Constants.display.DISPLAY_SENSOR_2 DISPLAY_SENSOR_2 imenu API-Constants.display.DISPLAY_SENSOR_3 DISPLAY_SENSOR_3 imenu API-Constants.display.DISPLAY_WATCH DISPLAY_WATCH endif if NQC_Target=="RCX2" imenu API-Constants.display.DISPLAY_USER DISPLAY_USER endif "----- output ---------------------------------------------------------------------------- imenu API-Constants.output.OUT_A OUT_A imenu API-Constants.output.OUT_B OUT_B imenu API-Constants.output.OUT_C OUT_C imenu API-Constants.output.OUT_FLOAT OUT_FLOAT imenu API-Constants.output.OUT_FULL OUT_FULL imenu API-Constants.output.OUT_FWD OUT_FWD imenu API-Constants.output.OUT_HALF OUT_HALF imenu API-Constants.output.OUT_LOW OUT_LOW imenu API-Constants.output.OUT_OFF OUT_OFF imenu API-Constants.output.OUT_ON OUT_ON imenu API-Constants.output.OUT_REV OUT_REV imenu API-Constants.output.OUT_TOGGLE OUT_TOGGLE if NQC_Target=="CM" imenu API-Constants.output.OUT_L OUT_L imenu API-Constants.output.OUT_R OUT_R imenu API-Constants.output.OUT_X OUT_X endif "----- sensor ---------------------------------------------------------------------------- if NQC_Target=="RCX2" imenu API-Constants.serial.SERIAL_COMM_DEFAULT SERIAL_COMM_DEFAULT imenu API-Constants.serial.SERIAL_COMM_4800 SERIAL_COMM_4800 imenu API-Constants.serial.SERIAL_COMM_DUTY25 SERIAL_COMM_DUTY25 imenu API-Constants.serial.SERIAL_COMM_76KHZ SERIAL_COMM_76KHZ imenu API-Constants.serial.SERIAL_PACKET_DEFAULT SERIAL_PACKET_DEFAULT imenu API-Constants.serial.SERIAL_PACKET_PREAMBLE SERIAL_PACKET_PREAMBLE imenu API-Constants.serial.SERIAL_PACKET_NEGATED SERIAL_PACKET_NEGATED imenu API-Constants.serial.SERIAL_PACKET_CHECKSUM SERIAL_PACKET_CHECKSUM imenu API-Constants.serial.SERIAL_PACKET_RCX SERIAL_PACKET_RCX endif "----- sensor ---------------------------------------------------------------------------- imenu API-Constants.sensor.SENSOR_1 SENSOR_1 imenu API-Constants.sensor.SENSOR_2 SENSOR_2 imenu API-Constants.sensor.SENSOR_3 SENSOR_3 if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Constants.sensor.SENSOR_CELSIUS SENSOR_CELSIUS imenu API-Constants.sensor.SENSOR_EDGE SENSOR_EDGE imenu API-Constants.sensor.SENSOR_FAHRENHEIT SENSOR_FAHRENHEIT imenu API-Constants.sensor.SENSOR_LIGHT SENSOR_LIGHT imenu API-Constants.sensor.SENSOR_PULSE SENSOR_PULSE imenu API-Constants.sensor.SENSOR_ROTATION SENSOR_ROTATION imenu API-Constants.sensor.SENSOR_TOUCH SENSOR_TOUCH imenu API-Constants.sensor.SENSOR_MODE_CELSIUS SENSOR_MODE_CELSIUS imenu API-Constants.sensor.SENSOR_MODE_FAHRENHEIT SENSOR_MODE_FAHRENHEIT imenu API-Constants.sensor.SENSOR_MODE_ROTATION SENSOR_MODE_ROTATION endif if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="CM" imenu API-Constants.sensor.SENSOR_MODE_BOOL SENSOR_MODE_BOOL imenu API-Constants.sensor.SENSOR_MODE_EDGE SENSOR_MODE_EDGE imenu API-Constants.sensor.SENSOR_MODE_PERCENT SENSOR_MODE_PERCENT imenu API-Constants.sensor.SENSOR_MODE_PULSE SENSOR_MODE_PULSE imenu API-Constants.sensor.SENSOR_MODE_RAW SENSOR_MODE_RAW endif if NQC_Target=="RCX" || NQC_Target=="RCX2" imenu API-Constants.sensor.SENSOR_TYPE_LIGHT SENSOR_TYPE_LIGHT imenu API-Constants.sensor.SENSOR_TYPE_NONE SENSOR_TYPE_NONE imenu API-Constants.sensor.SENSOR_TYPE_ROTATION SENSOR_TYPE_ROTATION imenu API-Constants.sensor.SENSOR_TYPE_TEMPERATURE SENSOR_TYPE_TEMPERATURE imenu API-Constants.sensor.SENSOR_TYPE_TOUCH SENSOR_TYPE_TOUCH endif if NQC_Target=="CM" imenu API-Constants.sensor.SENSOR_L SENSOR_L imenu API-Constants.sensor.SENSOR_M SENSOR_M imenu API-Constants.sensor.SENSOR_R SENSOR_R endif "----- sound ---------------------------------------------------------------------------- imenu API-Constants.sound.SOUND_CLICK SOUND_CLICK imenu API-Constants.sound.SOUND_DOUBLE_BEEP SOUND_DOUBLE_BEEP imenu API-Constants.sound.SOUND_DOWN SOUND_DOWN imenu API-Constants.sound.SOUND_FAST_UP SOUND_FAST_UP imenu API-Constants.sound.SOUND_LOW_BEEP SOUND_LOW_BEEP imenu API-Constants.sound.SOUND_UP SOUND_UP "----- RCX2 events ------------------------------------------------------------------------ if NQC_Target=="RCX2" imenu API-Constants.RCX2\ events.EVENT_TYPE_PRESSED EVENT_TYPE_PRESSED imenu API-Constants.RCX2\ events.EVENT_TYPE_RELEASED EVENT_TYPE_RELEASED imenu API-Constants.RCX2\ events.EVENT_TYPE_PULSE EVENT_TYPE_PULSE imenu API-Constants.RCX2\ events.EVENT_TYPE_EDGE EVENT_TYPE_EDGE imenu API-Constants.RCX2\ events.EVENT_TYPE_FASTCHANGE EVENT_TYPE_FASTCHANGE imenu API-Constants.RCX2\ events.EVENT_TYPE_LOW EVENT_TYPE_LOW imenu API-Constants.RCX2\ events.EVENT_TYPE_NORMAL EVENT_TYPE_NORMAL imenu API-Constants.RCX2\ events.EVENT_TYPE_HIGH EVENT_TYPE_HIGH imenu API-Constants.RCX2\ events.EVENT_TYPE_CLICK EVENT_TYPE_CLICK imenu API-Constants.RCX2\ events.EVENT_TYPE_DOUBLECLICK EVENT_TYPE_DOUBLECLICK imenu API-Constants.RCX2\ events.EVENT_TYPE_MESSAGE EVENT_TYPE_MESSAGE endif "----- Scout events ----------------------------------------------------------------------- if NQC_Target=="Scout" imenu API-Constants.Scout\ events.EVENT_1_PRESSED EVENT_1_PRESSED imenu API-Constants.Scout\ events.EVENT_2_PRESSED EVENT_2_PRESSED imenu API-Constants.Scout\ events.EVENT_1_RELEASED EVENT_1_RELEASED imenu API-Constants.Scout\ events.EVENT_2_RELEASED EVENT_2_RELEASED imenu API-Constants.Scout\ events.EVENT_LIGHT_HIGH EVENT_LIGHT_HIGH imenu API-Constants.Scout\ events.EVENT_LIGHT_NORMAL EVENT_LIGHT_NORMAL imenu API-Constants.Scout\ events.EVENT_LIGHT_LOW EVENT_LIGHT_LOW imenu API-Constants.Scout\ events.EVENT_LIGHT_CLICK EVENT_LIGHT_CLICK imenu API-Constants.Scout\ events.EVENT_LIGHT_DOUBLECLICK EVENT_LIGHT_DOUBLECLICK imenu API-Constants.Scout\ events.EVENT_COUNTER_0 EVENT_COUNTER_0 imenu API-Constants.Scout\ events.EVENT_COUNTER_1 EVENT_COUNTER_1 imenu API-Constants.Scout\ events.EVENT_TIMER_0 EVENT_TIMER_0 imenu API-Constants.Scout\ events.EVENT_TIMER_1 EVENT_TIMER_1 imenu API-Constants.Scout\ events.EVENT_TIMER_2 EVENT_TIMER_2 imenu API-Constants.Scout\ events.EVENT_MESSAGE EVENT_MESSAGE imenu API-Constants.LIGHT_ON LIGHT_ON imenu API-Constants.LIGHT_OFF LIGHT_OFF imenu API-Constants.SCOUT_MODE_POWER SCOUT_MODE_POWER imenu API-Constants.SCOUT_MODE_STANDALONE SCOUT_MODE_STANDALONE endif "----- misc ---------------------------------------------------------------------------- if NQC_Target=="RCX" || NQC_Target=="RCX2" || NQC_Target=="Scout" imenu API-Constants.TX_POWER_HI TX_POWER_HI imenu API-Constants.TX_POWER_LO TX_POWER_LO endif " " "=============================================================================================== "----- Menu : NQC-Run ------------------------------------------------------------------------- "=============================================================================================== " amenu NQC-&Run.save\ and\ &compile :call NQC_SaveCompile () amenu NQC-&Run.-SEP1- : if NQC_Target=="RCX" || NQC_Target=="RCX2" amenu NQC-&Run.download\ program\ 1\ to\ RCX :call NQC_CompDown (1) amenu NQC-&Run.download\ program\ 2\ to\ RCX :call NQC_CompDown (2) amenu NQC-&Run.download\ program\ 3\ to\ RCX :call NQC_CompDown (3) amenu NQC-&Run.download\ program\ 4\ to\ RCX :call NQC_CompDown (4) amenu NQC-&Run.download\ program\ 5\ to\ RCX :call NQC_CompDown (5) amenu NQC-&Run.-SEP2- : amenu NQC-&Run.download\ program\ 1\ to\ RCX\ and\ Run :call NQC_CompDownRun (1) amenu NQC-&Run.download\ program\ 2\ to\ RCX\ and\ Run :call NQC_CompDownRun (2) amenu NQC-&Run.download\ program\ 3\ to\ RCX\ and\ Run :call NQC_CompDownRun (3) amenu NQC-&Run.download\ program\ 4\ to\ RCX\ and\ Run :call NQC_CompDownRun (4) amenu NQC-&Run.download\ program\ 5\ to\ RCX\ and\ Run :call NQC_CompDownRun (5) amenu NQC-&Run.-SEP3- : amenu NQC-&Run.download\ firmware\ to\ RCX :call NQC_DLoadFirmware() amenu NQC-&Run.upload\ datalog\ into\ buffer :call NQC_DatalogUpload() amenu NQC-&Run.erase\ programs\ and\ datalogs\ from\ RCX :call NQC_DatalogClear() endif if NQC_Target=="Scout" amenu NQC-&Run.download\ program\ to\ Scout call NQC_CompDownRun(0) endif if NQC_Target=="CM" amenu NQC-&Run.download\ program\ to\ CyberMaster call NQC_CompDownRun(0) endif " "=============================================================================================== "----- vim Functions --------------------------------------------------------------------------- "=============================================================================================== " "------------------------------------------------------------------------------ " NQC-Comments : Frame Comment "------------------------------------------------------------------------------ function! NQC_CommentFrame () let @z= "//----------------------------------------------------------------------\n" let @z=@z."// \n" let @z=@z."//----------------------------------------------------------------------\n" put z endfunction " "------------------------------------------------------------------------------ " NQC-Comments : Function Comment "------------------------------------------------------------------------------ function! NQC_CommentFunction () let @z= "//=====================================================================================\n" let @z= @z."//\n" let @z= @z."// Name: \n" let @z= @z."//\n" let @z= @z."// Description: \n" let @z= @z."//\n" let @z= @z."//- PARAMETER -------------------------------------------------------------------------\n" let @z= @z."// Mode Type Name Description\n" let @z= @z."//-------------------------------------------------------------------------------------\n" let @z= @z."// in: \n" let @z= @z."// in-out: \n" let @z= @z."// out: \n" let @z= @z."//-------------------------------------------------------------------------------------\n" let @z= @z."// Author: ".g:NQC_AuthorName."\n" let @z= @z."// Date: ".strftime("%x - %X")."\n" let @z= @z."//=====================================================================================\n" put z endfunction " "------------------------------------------------------------------------------ " NQC-Comments : File Prologue "------------------------------------------------------------------------------ function! NQC_CommentFilePrologue () let File = expand("%:t") " name of the file in the current buffer let @z= "//=====================================================================================\n" let @z= @z."//\n" let @z= @z."// Filename:\t".File."\n" let @z= @z."// Description:\t\n" let @z= @z."//\n" let @z= @z."// Compiler:\tnqc\n" let @z= @z."// Author:\t".g:NQC_AuthorName."\n" let @z= @z."// Created:\t".strftime("%x - %X")."\n" let @z= @z."//=====================================================================================\n" put! z endfunction " "------------------------------------------------------------------------------ " NQC-Comments : Author+Date+Time " NQC-Comments : Date+Time " NQC-Comments : Date "------------------------------------------------------------------------------ function! NQC_CommentDateTimeAuthor () put = '//% '.strftime(\"%x - %X\").' ('.g:NQC_AuthorRef.')' endfunction " function! NQC_CommentDateTime () put = strftime(\"%x - %X\") endfunction " function! NQC_CommentDate () put = strftime(\"%x\") endfunction " "------------------------------------------------------------------------------ " NQC-Statements : do-while "------------------------------------------------------------------------------ " function! NQC_DoWhile () let @z= "do\n\t{\n\t\n\t}\nwhile ( );" let @z= @z."\t\t\t\t// ----- end do-while -----\n" endfunction " "------------------------------------------------------------------------------ " NQC-Statements : switch " NQC-Statements : case "------------------------------------------------------------------------------ " let NQC_CaseStatement = "\tcase :\t\n\t\tbreak;\n\n" " function! NQC_CodeSwitch () let @z= "switch ( )\n\t{\n\n" let loopcount=4 " default number of cases while loopcount>0 let @z= @z.g:NQC_CaseStatement let loopcount=loopcount-1 endwhile let @z= @z."\tdefault:\t\n\t}" let @z= @z."\t\t\t\t// ----- end switch -----\n" endfunction " function! NQC_CodeCase () let @z= g:NQC_CaseStatement endfunction " "------------------------------------------------------------------------------ " NQC-Statements : #ifndef "------------------------------------------------------------------------------ function! NQC_CodeIfndef (...) if a:0 == 0 let identifier=input("(uppercase) identifier (default _H ) : ") if identifier=="" let identifier = expand("%:t:r")."_H" let identifier = substitute(identifier,".*", '\U\0', "" ) " to uppercase endif else let identifier=a:1 endif let @z= "#ifndef\t".identifier."\n" let @z= @z."#define\t".identifier."\t\t// \n\n\n\n" let @z= @z."#endif\t\t\t// ---------- ifndef ".identifier." ----------\n" put z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : task "------------------------------------------------------------------------------ function! NQC_CodeTask () let identifier=input("task name (default main ) : ") if identifier=="" let identifier = "main" endif let @z= "task\n".identifier."\t( )\n{\n\n\n\treturn ;\n}" let @z= @z."\t\t\t\t// ---------- end of task ".identifier." ----------" put z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : inline function "------------------------------------------------------------------------------ function! NQC_CodeInlineFunction () let identifier=input("inline function name (default func ) : ") if identifier=="" let identifier = "func" endif let @z= "void\n".identifier."\t( )\n{\n\n\n\treturn ;\n}" let @z= @z."\t\t\t\t// ---------- end of inline function ".identifier." ----------" put z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : subroutine "------------------------------------------------------------------------------ function! NQC_CodeSubroutine () let identifier=input("subroutine name (default subr ) : ") if identifier=="" let identifier = "subr" endif let @z= "sub\n".identifier."\t( )\n{\n\n\n\treturn ;\n}" let @z= @z."\t\t\t\t// ---------- end of subroutine ".identifier." ----------" put z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : acquire / monitor / catch "------------------------------------------------------------------------------ function! NQC_Acquire () let @z= "acquire ()\n\t{\n\t\n\t}\t\t\t// ----- end acquire -----\n" let @z= @z."catch\n\t{\n\t\n\t}\t\t\t// ----- end catch -----\n" put z endfunction " function! NQC_Monitor () let @z= "monitor ()\n\t{\n\t\n\t}\t\t\t// ----- end monitor -----\n" let @z= @z."catch\n\t{\n\t\n\t}\t\t\t// ----- end catch -----\n" put z endfunction " function! NQC_Catch () let @z= "catch ()\n\t{\n\t\n\t}\t\t\t// ----- end catch -----\n" put z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : save and compile "------------------------------------------------------------------------------ function! NQC_SaveCompile () let @z= "update | !nqc -T".g:NQC_Target." %" exec @z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : compile, download " NQC-Statements : compile, download and run "------------------------------------------------------------------------------ function! NQC_CompDown (n) let @z= "!nqc -T".g:NQC_Target." -S".g:NQC_Portname." -d -pgm ".a:n." %" exec @z endfunction " function! NQC_CompDownRun (n) if g:NQC_Target=="RCX" || g:NQC_Target=="RCX2" let @z= "!nqc -T".g:NQC_Target." -S".g:NQC_Portname." -d -pgm ".a:n." % -run" else let @z= "!nqc -T".g:NQC_Target." -S".g:NQC_Portname." -d %" endif exec @z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : download firmware "------------------------------------------------------------------------------ function! NQC_DLoadFirmware () let @z= "!nqc -S".g:NQC_Portname." -firmware ".g:NQC_RCX_Firmware exec @z endfunction " "------------------------------------------------------------------------------ " NQC-Statements : datalog upload / clear "------------------------------------------------------------------------------ function! NQC_DatalogUpload () put = '// ----- datalog : '.strftime(\"%x - %X\").' -----' let @z= "read !nqc -S".g:NQC_Portname." -datalog 2>/dev/null" exec @z endfunction " function! NQC_DatalogClear () let @z= "!nqc -S".g:NQC_Portname." -clear" exec @z endfunction " "=====================================================================================