summaryrefslogtreecommitdiff
path: root/ldmicro/includes
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro/includes')
-rw-r--r--ldmicro/includes/advanceddialog.h142
-rw-r--r--ldmicro/includes/componentlist.h71
-rw-r--r--ldmicro/includes/components/componentfunctions.h63
-rw-r--r--ldmicro/includes/components/componentimages.h53
-rw-r--r--ldmicro/includes/components/components.h51
-rw-r--r--ldmicro/includes/components/componentstructs.h62
-rw-r--r--ldmicro/includes/ldmicro.h44
-rw-r--r--ldmicro/includes/simulate.h8
8 files changed, 17 insertions, 477 deletions
diff --git a/ldmicro/includes/advanceddialog.h b/ldmicro/includes/advanceddialog.h
deleted file mode 100644
index 5e4808f..0000000
--- a/ldmicro/includes/advanceddialog.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef _ADVANCED_DIALOG_H
-#define _ADVANCED_DIALOG_H
-
-#define MAX_PIN_NAME 128
-
-/*Advanced Dialog Menus*/
-#define MNU_ADV_NEW 0x01
-#define MNU_ADV_OPEN 0x02
-#define MNU_ADV_SAVE 0x03
-#define MNU_ADV_SAVE_AS 0x04
-#define MNU_ADV_EXIT 0x05
-
-#define MNU_ADV_UNDO 0x10
-#define MNU_ADV_REDO 0x11
-#define MNU_ADV_CUT 0x12
-#define MNU_ADV_COPY 0x13
-#define MNU_ADV_PASTE 0x14
-#define MNU_ADV_DEL 0x15
-
-#define MNU_ADV_SIMULATION_MODE 0x20
-#define MNU_ADV_START_SIMULATION 0x21
-#define MNU_ADV_STOP_SIMULATION 0x22
-#define MNU_ADV_SINGLE_CYCLE 0x23
-
-#define MNU_ADV_MANUAL 0x30
-#define MNU_ADV_ABOUT 0x31
-
-#define MAX_NAME_LENGTH 128
-#define MAX_SCREEN_ITEMS 512
-#define MAX_PINS 4000
-#define MCU_PIN_FLAG 4000
-#define MAX_MCU_PINS 128
-#define TIMER_ADV_SIMULATE 101
-
-
-typedef struct ImageStructTag {
- int selectedState;
- HIMAGELIST Images;
- int ComponentId;
-} ImageStruct;
-
-typedef struct ImageLocationTag{
- int Id;
- ImageStruct* Image;
- int Index;
- int x;
- int y;
- void* Properties;
- void* PinId;
- void* PinName;
-}ImageLocation;
-
-typedef struct PinInfoTag{
- double Volt;
- double OperatingVolt;
- void** ImageId;
- int* Index;
- int* ImageType; //To compare with imagelocation array
- int LinkCount; //No of valid entries in array
- double ProgVolt;
- void* ProgComponent;
-}PinInfo;
-
-typedef struct PinMcuTag{
- UINT PinId;
- UINT state;
- int type;
- BOOL InternalPullup;
-}PinMcu;
-
-typedef struct PinNameTag{
- UINT PinId; //Need to generate unique pinid every time user saves a name
- TCHAR Name[MAX_NAME_LENGTH];
- PinInfo PinData;
-}PinName;
-
-typedef struct PinComponentTag{
- UINT PinId;
- void** ComponentAddress;
- int Count;
- void* Next;
-}PinComponent;
-
-extern HANDLE ImageHeap;
-extern HFONT AdvNiceFont;
-extern HFONT AdvFixedFont;
-extern UINT NameCount;
-extern ImageLocation ImageStack[MAX_SCREEN_ITEMS];
-// extern PinInfo PinData[MAX_PINS];
-extern PinMcu McuPin[MAX_MCU_PINS];
-extern PinName NameId[MAX_PINS];
-extern HWND AdvancedDialog;
-extern PinComponent ComponentPin;
-
-/*Advanced Dialog Functions*/
-void MakeAdvancedDialogControls(void);
-void AdvancedDialogResized(void);
-void MakeAdvancedWindowMenus(void);
-void ProcessEvent(int x, int y, int Event);
-void AdvancedWindowClosing(void);
-void ToggleAdvancedSimulationMode(void);
-void SimulateOneAdvCycle(BOOL ForceRefresh);
-int IsMCUPin(int PinId);
-// void CreateVoltRequest(int PinId, int Index, double VoltReq);
-
-// Heap Functions
-void* AllocImageHeap(size_t n);
-void* ReallocImageHeap(LPVOID lpMem, size_t n);
-void FreeImageHeap(void *p);
-
-// Component Functions
-
-void InitComponents(void);
-
-double GetGlobalVoltage(int PinId, void* ComponentAddress);
-double RefreshVolt(int PinId, int Index, UINT Id, void* ComponentAddress, double volt);
-double RefreshProcessorStat(int PinId, UINT Id);
-
-
-int RegisterPinName(LPCTSTR Name);
-int SetPinImage(int PinId,void* ImageId,int ImageType, int Index);
-int FlushPinNames(void); //Clear Pins which are deleted from MainWindow
-int DeRegisterPinName(LPCTSTR Name, void* ImageId);
-int DeletePinImage(LPCTSTR Name, void* ImageId, int Index);
-int DeletePinName(UINT Index);
-void SetMcu(int PinId, int Type);
-void RefreshNamingList(void);
-void PopulateNamingList(void);
-
-double RequestVoltChange(int PinId, int Index, void *ComponentAddress, double volt);
-
-int DeleteComponentPin(int PinId, void* ComponentAddress);
-int AddComponentPin(int PinId, void* ComponentAddress);
-// int RegisterPinState(int Index, double Volt);
-
-//NamingList functions
-void ToggleInternalPullup(int PinId);
-
-
-extern BOOL SimulationStarted;
-
-#endif
diff --git a/ldmicro/includes/componentlist.h b/ldmicro/includes/componentlist.h
deleted file mode 100644
index 20c095b..0000000
--- a/ldmicro/includes/componentlist.h
+++ /dev/null
@@ -1,71 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright 2007 Jonathan Westhues
-//
-// This file is part of LDmicro.
-//
-// LDmicro is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// LDmicro is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with LDmicro. If not, see <http://www.gnu.org/licenses/>.
-//------
-//
-// Constants, structures, declarations etc. for the PIC ladder logic compiler
-// Jonathan Westhues, Oct 2004
-//-----------------------------------------------------------------------------
-
-#ifndef __COMPONENTLIST_H
-#define __COMPONENTLIST_H
-
-#define MAX_COMPONENTS 999
-#define MAX_IMAGES 10
-
-#define COMPONENT_WIDTH 100
-#define COMPONENT_HEIGHT 100
-
-extern HDC HdcMem;
-extern HWND ComponentList;
-extern HBITMAP test;
-extern HIMAGELIST ComponentDiagrams;
-extern HWND AdvancedWorkspace;
-extern BOOL Dragging;
-extern int ImagesDrawn;
-extern int DragX;
-extern int DragY;
-extern UINT UniquePinId;
-extern UINT UniqueImgId;
-
-
-/*map<int, HIMAGELIST, int, int, int> Imagemap; //To relate image with it's drawing area(Index,Images,x,y,maptype)
-map<int, BOOL, BOOL, BOOL> Switchmap; //Add MCU pin later //(Index(same as Imagemap), Selected, Default Connected,Latch Action)
-map<int, BOOL> Relaymap; //Add MCU pin later //(Index(same as Imagemap), Selected)
-
-extern Imagemap test;*/
-
-void ComponentListProc(NMHDR *h);
-void ComponentListInitiate(void);
-
-void InitializeImageList(HIMAGELIST *il);
-
-int BeginComponentDrag(int x, int y);
-int ComponentDrag(int x, int y);
-int EndComponentDrag(int x, int y);
-
-// Componentimages.cpp functions
-//Function Definitions
-
-void InitializeComponentImage(int Component, HIMAGELIST *il);
-IStream * CreateStreamOnResource(LPCTSTR lpName, LPCTSTR lpType);
-IWICBitmapSource * LoadBitmapFromStream(IStream * ipImageStream);
-HBITMAP CreateHBITMAP(IWICBitmapSource * ipBitmap);
-HBITMAP LoadComponentImage(int resource);
-
-
-#endif \ No newline at end of file
diff --git a/ldmicro/includes/components/componentfunctions.h b/ldmicro/includes/components/componentfunctions.h
deleted file mode 100644
index 916bf00..0000000
--- a/ldmicro/includes/components/componentfunctions.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _COMPONENT_FUNCTIONS
-#define _COMPONENT_FUNCTIONS
-
-//Few Prerequisites
-extern HFONT MyNiceFont;
-extern HFONT MyFixedFont;
-extern HWND OkButton;
-extern HWND CancelButton;
-extern HINSTANCE* ComponentInstance;
-
-extern BOOL DlgDone;
-extern BOOL DlgCancel;
-extern HWND ComponentDialog;
-
-// Common Functions
-
-void FontNice(HWND h);
-void FontFixed(HWND h);
-HWND* CreateDialogWindow(LPCTSTR title, int x, int y, int width, int height, int style);
-void ShowDialogWindow(void);
-BOOL ProcessDialogWindow(void);
-
-/*Initialization Functions*/
-int InitSwitch(void* ComponentAddress);
-int InitRelay(void* ComponentAddress);
-int InitSpdt(void* ComponentAddress);
-int InitDpst(void* ComponentAddress);
-int InitDpdt(void* ComponentAddress);
-
-/*Event Handlers*/
-void HandleSwitchEvent(void* ComponentAddress, int Event, BOOL SimulationStarted,
- void* ImageLocation, UINT ImageId, HWND* h);
-void HandleRelayEvent(void* ComponentAddress, int Event, BOOL SimulationStarted,
- void* ImageLocation, UINT ImageId, HWND* h);
-void HandleSpdtEvent(void* ComponentAddress, int Event, BOOL SimulationStarted,
- void* ImageLocation, UINT ImageId, HWND* h);
-void HandleDpstEvent(void* ComponentAddress, int Event, BOOL SimulationStarted,
- void* ImageLocation, UINT ImageId, HWND* h);
-void HandleDpdtEvent(void* ComponentAddress, int Event, BOOL SimulationStarted,
- void* ImageLocation, UINT ImageId, HWND* h);
-
-/*Request Handlers*/
-double SwitchVoltChanged(void* ComponentAddress, BOOL SimulationStarted, int index,
- double Volt, int Source, void* ImageLocation);
-double RelayVoltChanged(void* ComponentAddress, BOOL SimulationStarted, int index,
- double Volt, int Source, void* ImageLocation);
-double SpdtVoltChanged(void* ComponentAddress, BOOL SimulationStarted, int index,
- double Volt, int Source, void* ImageLocation);
-double DpstVoltChanged(void* ComponentAddress, BOOL SimulationStarted, int index,
- double Volt, int Source, void* ImageLocation);
-double DpdtVoltChanged(void* ComponentAddress, BOOL SimulationStarted, int index,
- double Volt, int Source, void* ImageLocation);
-
-/*Program Reference Functions*/
-void SetSwitchIds(int*, void*);
-void SetRelayIds(int*, void*);
-void SetSpdtIds(int*, void*);
-void SetDpstIds(int*, void*);
-void SetDpdtIds(int*, void*);
-
-// Relay Functions
-
-#endif
diff --git a/ldmicro/includes/components/componentimages.h b/ldmicro/includes/components/componentimages.h
deleted file mode 100644
index 27ef6ce..0000000
--- a/ldmicro/includes/components/componentimages.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __COMPONENTIMAGES_H
-#define __COMPONENTIMAGES_H
-
-#define SWITCH_CONNECTED 8000
-#define SWITCH_DISCONNECTED 8001
-#define RELAY_NC 8002
-#define RELAY_NO 8003
-#define SPDT_1 8004
-#define SPDT_2 8005
-#define DPST_1 8006
-#define DPST_2 8007
-#define DPDT_1 8008
-#define DPDT_2 8009
-
-
-
-#ifndef RC_INVOKED //Used to hide code from resource file(Guess)
-
-#define TOTAL_COMPONENTS 5
-#define COMPONENT_NAME_MAX_LENGTH 50
-
-// Try to keep ComponentID's between 6000 - 6999
-
-#define COMPONENT_SWITCH 6000
-#define COMPONENT_RELAY 6001
-#define COMPONENT_SPDT 6002
-#define COMPONENT_DPST 6003
-#define COMPONENT_DPDT 6004
-
-
-#define MAX_PIN_COUNT 10
-
-typedef struct ComponentDataTag{
- int Index;
- int ComponentId;
- TCHAR ComponentName[COMPONENT_NAME_MAX_LENGTH];
- int PinCount;
- LPCTSTR PinNames[MAX_PIN_COUNT]; //Valid Number of images from below property
-}ComponentData;
-
-void RefreshImages();
-void SetImage(int Component, void *il);
-
-static ComponentData rgCompData[TOTAL_COMPONENTS] = {
- {0, COMPONENT_SWITCH, TEXT("Switch"), 2, {"Input:", "Output:"}},
- {1, COMPONENT_RELAY, TEXT("Relay"), 5, {"Coil1:", "Coil2:", "NO:", "COM:", "NC:"}},
- {2, COMPONENT_SPDT, TEXT("SPDT"), 3, {"Input:", "Output1:", "Output2:"}},
- {3, COMPONENT_DPST, TEXT("DPST"), 4, {"Input1:", "Input2:", "Output1:", "Output2:"}},
- {4, COMPONENT_DPDT, TEXT("DPDT"), 6, {"Input1:", "Input2:", "Output11:", "Output12:", "Output21:", "Output22:"}}
-};
-
-#endif
-#endif
diff --git a/ldmicro/includes/components/components.h b/ldmicro/includes/components/components.h
deleted file mode 100644
index 810c2d2..0000000
--- a/ldmicro/includes/components/components.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _COMPONENTS_H
-#define _COMPONENTS_H
-
-#define EVENT_VALUE_CHANGED 0
-#define EVENT_MOUSE_CLICK 1
-#define EVENT_MOUSE_DOWN 2
-#define EVENT_MOUSE_UP 3
-#define EVENT_MOUSE_RDOWN 4
-#define EVENT_MOUSE_RUP 5
-#define EVENT_MOUSE_DBLCLICK 6
-#define EVENT_MOUSE_RCLICK 7
-
-
-
-#define SOURCE_PROGRAM_MAIN 1
-#define SOURCE_PROGRAM_NEW 2
-#define SOURCE_EVENT_MAIN 3
-#define SOURCE_EVENT_NEW 4
-#define SOURCE_FORCE_MAIN 5
-#define SOURCE_REQUEST_MAIN 6
-
-/*#define EVENT_KEY_DOWN 6
-#define EVENT_KEY_RELEASE 7
-#define EVENT_KEY_PRESS 8*/
-#define V_DIALOG_WIDTH 96
-#define V_DIALOG_HEIGHT 115
-#define H_DIALOG_WIDTH 179
-#define H_DIALOG_HEIGHT 85
-
-//Window styles for dialog box
-#define STYLE_HORIZONTAL 1
-#define STYLE_VERTICAL 2
-
-#define GND 0
-#define VOLT_5 5
-#define V_OPEN 4196
-
-int NotifyComponent(void *ComponentAddress, void* PinName, int ComponentId, int Event,
- BOOL SimulationStarted, HWND* h, int Index, UINT ImageId, void* ImageLocation);
-int InitializeComponentProperties(void *ComponentAddress, int ComponentId);
-double VoltSet(void* ComponentAddress, BOOL SimulationStarted, int ImageType, int Index,
- double Volt, int Source, void* ImageLocation);
-
-double VoltRequest(int PinId, void* ComponentAddress);
-// void RequestData(void* ComponentAddress);
-// double GlobalVoltChange(int PinId, void *ComponentAddress, double volt);
-double VoltChange(int PinId, int Index, void* ComponentAddress, double Volt);
-size_t GetStructSize(int ComponentId);
-size_t GetNameSize(int ComponentId);
-
-#endif
diff --git a/ldmicro/includes/components/componentstructs.h b/ldmicro/includes/components/componentstructs.h
deleted file mode 100644
index 76dadda..0000000
--- a/ldmicro/includes/components/componentstructs.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _COMPONENT_STRUCTS
-#define _COMPONENT_STRUCTS
-
-typedef struct SwitchStructTag
-{
- int id;
- int Image;
- BOOL Latched; //Temporary/Latched Action
- BOOL NOpen; //Initial Open/Closed position
- BOOL Open;
- char Name[15];
- double Volt[2];
- int PinId[2];
-}SwitchStruct;
-
-typedef struct RelayStructTag
-{
- int id;
- int Image;
- BOOL NC; //Whether relay is operated
- double MinOperatingVolt; //Operating voltage
- double MaxOperatingVolt;
- double CoilVolt1; //Voltage at input pin
- double CoilVolt2; //Voltage at input pin
- double COMVolt; //Voltage at COM pin
- double NOVolt; //Voltage at NO pin
- double NCVolt; //Voltage at NC pin
- int PinId[5];
-
-}RelayStruct;
-
-typedef struct SpdtStructTag
-{
- int id;
- int image;
- BOOL latched; //Whether the swetch is in latch mode or not
- BOOL NO1; //Whether Output 1 is connected
- double Volt[3]; //Voltage at Input, Output1, Output2 respectively
- int PinId[3];
-}SpdtStruct;
-
-typedef struct DpstStructTag
-{
- int id;
- int image;
- BOOL latched; //Whether the swetch is in latch mode or not
- BOOL NO; //Whether the inputs and outputs are disconnected (Open)
- double Volt[4]; // Voltage at Input1, Input2, Output1, Output2 respectively
- int PinId[4];
-}DpstStruct;
-
-typedef struct DpdtStructTag
-{
- int id;
- int image;
- BOOL latched; //Whether the swetch is in latch mode or not
- BOOL NS1; //Whether the inputs and outputs are connected in state 1
- double Volt[6]; // Voltage at Input1, Input2, Output11, Output12, Output21, Output22 respectively
- int PinId[6];
-}DpdtStruct;
-
-#endif
diff --git a/ldmicro/includes/ldmicro.h b/ldmicro/includes/ldmicro.h
index 0f165bc..01b0160 100644
--- a/ldmicro/includes/ldmicro.h
+++ b/ldmicro/includes/ldmicro.h
@@ -501,27 +501,26 @@ typedef struct McuIoInfoTag {
#define NUM_SUPPORTED_MCUS 16
-/*
//-----------------------------------------------
// Function prototypes
// ldmicro.cpp
void ProgramChanged(void);
-*/
+
void SetMenusEnabled(BOOL canNegate, BOOL canNormal, BOOL canResetOnly,
BOOL canSetOnly, BOOL canDelete, BOOL canInsertEnd, BOOL canInsertOther,
BOOL canPushRungDown, BOOL canPushRungUp, BOOL canInsertComment);
-/*
+
void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled);
void RefreshScrollbars(void);
-extern HINSTANCE Instance;*/
+extern HINSTANCE Instance;
extern HWID MainWindow;
extern HDC Hdc;
extern PlcProgram Prog;
extern char CurrentSaveFile[MAX_PATH];
-// extern char CurrentCompileFile[MAX_PATH];
+extern char CurrentCompileFile[MAX_PATH];
extern McuIoInfo SupportedMcus[NUM_SUPPORTED_MCUS];
-/*
+
// memory debugging, because I often get careless; ok() will check that the
// heap used for all the program storage is not yet corrupt, and oops() if
// it is
@@ -558,14 +557,14 @@ extern BOOL SelectionActive;
extern BOOL ThisHighlighted;
// draw_outputdev.cpp
-extern void (*DrawChars)(int, int, char *);
-void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time);
-void PaintWindow(void);
-void ExportDrawingAsText(char *file);
-void InitForDrawing(void);
-void SetUpScrollbars(BOOL *horizShown, SCROLLINFO *horiz, SCROLLINFO *vert);
-int ScreenRowsAvailable(void);
-int ScreenColsAvailable(void);
+// extern void (*DrawChars)(int, int, char *);
+// void CALLBACK BlinkCursor(HWND hwnd, UINT msg, UINT_PTR id, DWORD time);
+// void PaintWindow(void);
+// void ExportDrawingAsText(char *file);
+// void InitForDrawing(void);
+// void SetUpScrollbars(BOOL *horizShown, SCROLLINFO *horiz, SCROLLINFO *vert);
+// int ScreenRowsAvailable(void);
+// int ScreenColsAvailable(void);
extern HFONT FixedWidthFont;
extern HFONT FixedWidthFontBold;
extern int SelectedGxAfterNextPaint;
@@ -668,16 +667,6 @@ void ShowContactsDialog(BOOL *negated, char *name);
// coildialog.cpp
void ShowCoilDialog(BOOL *negated, BOOL *setOnly, BOOL *resetOnly, char *name);
-//advanceddialog.cpp
-void ShowAdvancedDialog(void);
-void MakeAdvancedDialogClass(void);
-void MakeAdvancedWorkspaceClass(void);
-void TranslateState(char *name, BOOL state);
-void MCUPinState(char *name, BOOL state);
-void StartAdvSimulation(void);
-void StopAdvSimulation(void);
-extern BOOL AdvancedWindowOpen;
-
//naminglist.cpp
void MakeSmplDialogClass(void);
@@ -707,6 +696,7 @@ void ShowHelpDialog(BOOL about);
Error("Internal error at line %d file '%s'\n", __LINE__, __FILE__); \
exit(1); \
}
+
void dbp(char *str, ...);
void Error(char *str, ...);
void *CheckMalloc(size_t n);
@@ -750,9 +740,9 @@ void SimulationResetContact(char* name);
void SetAdcShadow(char *name, SWORD val);
SWORD GetAdcShadow(char *name);
void DestroyUartSimulationWindow(void);
-void ShowUartSimulationWindow(void);*/
+void ShowUartSimulationWindow(void);
extern BOOL InSimulationMode;
-/*extern BOOL SimulateRedrawAfterNextCycle;
+extern BOOL SimulateRedrawAfterNextCycle;
// compilecommon.cpp
void AllocStart(void);
@@ -781,5 +771,5 @@ void CompileAnsiC(char *outFile);
void CompileInterpreted(char *outFile);
//Arduino.cpp
void CompileArduino(char *outFile);
-*/
+
#endif
diff --git a/ldmicro/includes/simulate.h b/ldmicro/includes/simulate.h
deleted file mode 100644
index 7b26ba3..0000000
--- a/ldmicro/includes/simulate.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*This file is created with an intention to share simulation functions
-with advanced simulation dialog window*/
-#ifndef _SIMULATE_H
-#define _SIMULATE_H
-
-static void SetSingleBit(char *name, BOOL state);
-static BOOL SingleBitOn(char *name);
-#endif