Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
padi-g committed Apr 2, 2015
0 parents commit 31a58a7
Show file tree
Hide file tree
Showing 42 changed files with 5,094 additions and 0 deletions.
Binary file added Documentation/CSProjReport.pdf
Binary file not shown.
Binary file added Documentation/Help File.pdf
Binary file not shown.
Binary file added Documentation/WxWidgets Documentation.chm
Binary file not shown.
Binary file added Documentation/WxWidgets Documentation.chw
Binary file not shown.
32 changes: 32 additions & 0 deletions Source Code/Demo Program/linklist.psc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@Begin
Function main
1. Variable input as int
2. Read input for input
3. Variable start as node*
4. Call createnode(input) store returned value in start
5. Display start->data
End main

Function createnode parameters: int data returns node*

1. Variable temp as node*
2. temp = new node
3. temp->data = data
4. temp->link = NULL
5. return temp
End createnode
$
Structure node:
Variable data as int
Variable link as node*
End Structure




#0^
#include<iostream>%
$0#
^-1#0#
@EndCode

20 changes: 20 additions & 0 deletions Source Code/Demo Program/tentimes.psc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@Begin
Function main
1. Variable a,b as int
2. Display "Enter a number:"
3. Read input for a
4. Display "Value of 10*"
5. Display a
6. Display " is:"
7. Display a*10
8. Display "\n"
End main
$

#1^
#include<iostream>%
#include<math.h>%
$0#
^-1#0#
@EndCode

70 changes: 70 additions & 0 deletions Source Code/Makefile.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Project: Psuedo Code Translator!
# Makefile created by Dev-C++ 5.7.1

CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o mainframe.o dialog_operation.o frame_var.o dialog_if.o dialog_loop.o func_dialog.o struct_dialog.o class_dialog.o control.o start_dialog.o dialog_cin.o dialog_cout.o call_dialog.o dialog_include.o
LINKOBJ = main.o mainframe.o dialog_operation.o frame_var.o dialog_if.o dialog_loop.o func_dialog.o struct_dialog.o class_dialog.o control.o start_dialog.o dialog_cin.o dialog_cout.o call_dialog.o dialog_include.o
LIBS = -L"C:/Program Files/Dev-Cpp/MinGW64/lib" -L"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -mwindows -Wl,--subsystem,windows -mwindows -lwxmsw -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid
INCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.8.1/include"
CXXINCS = -I"C:/Program Files/Dev-Cpp/MinGW64/include" -I"C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.8.1/include" -I"C:/Program Files/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++"
BIN = csproject.exe
CXXFLAGS = $(CXXINCS) -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__ -Wall -fno-pcc-struct-return -O2 -Os -fno-rtti -fno-exceptions
CFLAGS = $(INCS)
RM = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.cpp
$(CPP) -c main.cpp -o main.o $(CXXFLAGS)

mainframe.o: mainframe.cpp
$(CPP) -c mainframe.cpp -o mainframe.o $(CXXFLAGS)

dialog_operation.o: dialog_operation.cpp
$(CPP) -c dialog_operation.cpp -o dialog_operation.o $(CXXFLAGS)

frame_var.o: frame_var.cpp
$(CPP) -c frame_var.cpp -o frame_var.o $(CXXFLAGS)

dialog_if.o: dialog_if.cpp
$(CPP) -c dialog_if.cpp -o dialog_if.o $(CXXFLAGS)

dialog_loop.o: dialog_loop.cpp
$(CPP) -c dialog_loop.cpp -o dialog_loop.o $(CXXFLAGS)

func_dialog.o: func_dialog.cpp
$(CPP) -c func_dialog.cpp -o func_dialog.o $(CXXFLAGS)

struct_dialog.o: struct_dialog.cpp
$(CPP) -c struct_dialog.cpp -o struct_dialog.o $(CXXFLAGS)

class_dialog.o: class_dialog.cpp
$(CPP) -c class_dialog.cpp -o class_dialog.o $(CXXFLAGS)

control.o: control.cpp
$(CPP) -c control.cpp -o control.o $(CXXFLAGS)

start_dialog.o: start_dialog.cpp
$(CPP) -c start_dialog.cpp -o start_dialog.o $(CXXFLAGS)

dialog_cin.o: dialog_cin.cpp
$(CPP) -c dialog_cin.cpp -o dialog_cin.o $(CXXFLAGS)

dialog_cout.o: dialog_cout.cpp
$(CPP) -c dialog_cout.cpp -o dialog_cout.o $(CXXFLAGS)

call_dialog.o: call_dialog.cpp
$(CPP) -c call_dialog.cpp -o call_dialog.o $(CXXFLAGS)

dialog_include.o: dialog_include.cpp
$(CPP) -c dialog_include.cpp -o dialog_include.o $(CXXFLAGS)
173 changes: 173 additions & 0 deletions Source Code/call_dialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#include "call_dialog.h"

BEGIN_EVENT_TABLE( FnCallDialog, wxDialog )
EVT_RADIOBOX( wxID_ret_chk, FnCallDialog::_wxFB_c_ret_chk )
EVT_RADIOBOX( wxID_mem_chk, FnCallDialog::_wxFB_c_mem_chk )
EVT_BUTTON( wxID_call_func, FnCallDialog::_wxFB_c_call_func )
END_EVENT_TABLE()

FnCallDialog::FnCallDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
insert_code.Empty();
wxBoxSizer* s_main;
s_main = new wxBoxSizer( wxVERTICAL );

m_calldialog_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* s_calldialog_sizer;
s_calldialog_sizer = new wxBoxSizer( wxVERTICAL );

wxBoxSizer* s_radiobox_sizer;
s_radiobox_sizer = new wxBoxSizer( wxHORIZONTAL );

wxString m_ret_chkChoices[] = { wxT("Yes"), wxT("No") };
int m_ret_chkNChoices = sizeof( m_ret_chkChoices ) / sizeof( wxString );
m_ret_chk = new wxRadioBox( m_calldialog_panel, wxID_ret_chk, wxT("Does the function return a value?"), wxDefaultPosition, wxDefaultSize, m_ret_chkNChoices, m_ret_chkChoices, 1, wxRA_SPECIFY_ROWS );
m_ret_chk->SetSelection( 0 );
s_radiobox_sizer->Add( m_ret_chk, 0, wxALL|wxEXPAND, 5 );

wxString m_mem_chkChoices[] = { wxT("Yes"), wxT("No") };
int m_mem_chkNChoices = sizeof( m_mem_chkChoices ) / sizeof( wxString );
m_mem_chk = new wxRadioBox( m_calldialog_panel, wxID_mem_chk, wxT("Is the function a member function of any class or structure?"), wxDefaultPosition, wxDefaultSize, m_mem_chkNChoices, m_mem_chkChoices, 1, wxRA_SPECIFY_ROWS );
m_mem_chk->SetSelection( 0 );
s_radiobox_sizer->Add( m_mem_chk, 1, wxALL, 5 );


s_calldialog_sizer->Add( s_radiobox_sizer, 0, wxEXPAND, 5 );

t_funcname = new wxStaticText( m_calldialog_panel, wxID_ANY, wxT("Enter the function name"), wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_funcname, 0, wxALL, 5 );

t_func_name_input = new wxTextCtrl( m_calldialog_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_func_name_input, 0, wxALL|wxEXPAND, 5 );

t_cls_name = new wxStaticText( m_calldialog_panel, wxID_ANY, wxT("Enter the name of the class or structure to which the function belongs"), wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_cls_name, 0, wxALL, 5 );

t_cls_name_input = new wxTextCtrl( m_calldialog_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_cls_name_input, 0, wxALL|wxEXPAND, 5 );

t_ret_var_name = new wxStaticText( m_calldialog_panel, wxID_ANY, wxT("Enter the name of the variable to which the returned value has to be stored"), wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_ret_var_name, 0, wxALL, 5 );

t_ret_var_name_input = new wxTextCtrl( m_calldialog_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_ret_var_name_input, 0, wxALL|wxEXPAND, 5 );

t_para_list = new wxStaticText( m_calldialog_panel, wxID_ANY, wxT("Enter the parameter list"), wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_para_list, 0, wxALL, 5 );

t_para_list_input = new wxTextCtrl( m_calldialog_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
s_calldialog_sizer->Add( t_para_list_input, 0, wxALL|wxEXPAND, 5 );

m_call_func = new wxButton( m_calldialog_panel, wxID_call_func, wxT("Add Function Call"), wxDefaultPosition, wxDefaultSize, 0 );
m_call_func->SetDefault();
s_calldialog_sizer->Add( m_call_func, 0, wxALL|wxEXPAND, 5 );


m_calldialog_panel->SetSizer( s_calldialog_sizer );
m_calldialog_panel->Layout();
s_calldialog_sizer->Fit( m_calldialog_panel );
s_main->Add( m_calldialog_panel, 1, wxEXPAND, 5 );


this->SetSizer( s_main );
this->Layout();

this->Centre( wxBOTH );
}

void FnCallDialog :: c_ret_chk( wxCommandEvent& event )
{
if(m_ret_chk->GetSelection()==1)
{
t_ret_var_name_input->Enable(false);
t_ret_var_name->Enable(false);
}
else
{
t_ret_var_name_input->Enable(true);
t_ret_var_name->Enable(true);
}
}

void FnCallDialog :: c_mem_chk( wxCommandEvent& event )
{
if(m_mem_chk->GetSelection()==1)
{
t_cls_name_input->Enable(false);
t_cls_name->Enable(false);
}
else
{
t_cls_name_input->Enable(true);
t_cls_name->Enable(true);
}
}

void FnCallDialog :: c_call_func( wxCommandEvent& event )
{
insert_code.Empty();
if((m_ret_chk->GetSelection()==0)&&(m_mem_chk->GetSelection()==1))
{
insert_code.Empty();
if((t_func_name_input->GetLastPosition()!=0)&&(t_ret_var_name_input->GetLastPosition()!=0))
{
insert_code.Empty();
insert_code<<"Call "<<t_func_name_input->GetValue()<<"("<<t_para_list_input->GetValue()<<") store returned value in "<<t_ret_var_name_input->GetValue();
EndModal(wxID_CANCEL);
}
else
{
wxString msg;
msg.Printf( _T("Fill in atleast the functin name and the variable to store returned value!"));
wxMessageBox(msg, _T("ERROR!"), wxOK | wxICON_ERROR , this);
}
}
else if((m_ret_chk->GetSelection()==1)&&(m_mem_chk->GetSelection()==0))
{
insert_code.Empty();
if((t_func_name_input->GetLastPosition()!=0)&&(t_cls_name_input->GetLastPosition()!=0))
{
insert_code.Empty();
insert_code<<"Call "<<t_cls_name_input->GetValue()<<"."<<t_func_name_input->GetValue()<<"("<<t_para_list_input->GetValue()<<")";
EndModal(wxID_CANCEL);
}
else
{
wxString msg;
msg.Printf( _T("Fill in atleast the functoin name and the class/structur to which it belongs!"));
wxMessageBox(msg, _T("ERROR!"), wxOK | wxICON_ERROR , this);
}
}
else if((m_ret_chk->GetSelection()==0)&&(m_mem_chk->GetSelection()==0))
{
insert_code.Empty();
if((t_func_name_input->GetLastPosition()!=0)&&(t_cls_name_input->GetLastPosition()!=0)&&(t_ret_var_name_input->GetLastPosition()!=0))
{
insert_code.Empty();
insert_code<<"Call "<<t_cls_name_input->GetValue()<<"."<<t_func_name_input->GetValue()<<"("<<t_para_list_input->GetValue()<<") store returned value in "<<t_ret_var_name_input->GetValue();
EndModal(wxID_CANCEL);
}
else
{
wxString msg;
msg.Printf( _T("Fill in all the fields!"));
wxMessageBox(msg, _T("ERROR!"), wxOK | wxICON_ERROR , this);
}
}
else if((m_ret_chk->GetSelection()==1)&&(m_mem_chk->GetSelection()==1))
{
insert_code.Empty();
if(t_func_name_input->GetLastPosition()!=0)
{
insert_code.Empty();
insert_code<<"Call "<<t_func_name_input->GetValue()<<"( "<<t_para_list_input->GetValue()<<" )";
EndModal(wxID_CANCEL);
}
else
{
wxString msg;
msg.Printf( _T("Fill in atleast the function name!"));
wxMessageBox(msg, _T("ERROR!"), wxOK | wxICON_ERROR , this);
}
}
}
67 changes: 67 additions & 0 deletions Source Code/call_dialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#ifndef __CALL_DIALOG_H__
#define __CALL_DIALOG_H__

#include <wx/artprov.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/panel.h>
#include <wx/dialog.h>
#include "control.h"

class FnCallDialog : public wxDialog
{
DECLARE_EVENT_TABLE()
private:

void _wxFB_c_ret_chk( wxCommandEvent& event ){ c_ret_chk( event ); }
void _wxFB_c_mem_chk( wxCommandEvent& event ){ c_mem_chk( event ); }
void _wxFB_c_call_func( wxCommandEvent& event ){ c_call_func( event ); }


protected:
enum
{
wxID_ret_chk = 1000,
wxID_mem_chk,
wxID_call_func
};

wxPanel* m_calldialog_panel;
wxRadioBox* m_ret_chk;
wxRadioBox* m_mem_chk;
wxStaticText* t_funcname;
wxTextCtrl* t_func_name_input;
wxStaticText* t_cls_name;
wxTextCtrl* t_cls_name_input;
wxStaticText* t_ret_var_name;
wxTextCtrl* t_ret_var_name_input;
wxStaticText* t_para_list;
wxTextCtrl* t_para_list_input;
wxButton* m_call_func;


void c_ret_chk( wxCommandEvent& event );
void c_mem_chk( wxCommandEvent& event );
void c_call_func( wxCommandEvent& event );


public:

FnCallDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Call a Function"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 507,329 ), long style = wxDEFAULT_DIALOG_STYLE );
~FnCallDialog()
{
EndModal(wxID_CANCEL);
}

};

#endif //__CALL_DIALOG_H__

Loading

0 comments on commit 31a58a7

Please sign in to comment.