[DEVELOPMENT ENVIRONMENT]

* NEW: More support for WebPage.

[COMPILER]
* NEW: Start supporting WebPage.


git-svn-id: svn://localhost/gambas/trunk@4427 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-01-28 09:55:55 +00:00
parent 3ad16e0b5d
commit 0a9b6abe82
16 changed files with 109 additions and 63 deletions

View File

@ -286,7 +286,7 @@ msgstr ""
msgid "Provides"
msgstr ""
#: CInsertColor.class:106 FEditor.form:409 FTextEditor.form:342
#: CInsertColor.class:106 FEditor.form:409 FTextEditor.form:350
msgid "Insert color"
msgstr ""
@ -377,7 +377,7 @@ msgstr ""
#: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28
#: FSaveProjectAs.form:59 FSearch.class:838 FSelectExtraFile.form:40
#: FSelectIcon.form:87 FSnippet.form:57 FTableChooser.form:68 FText.form:41
#: FTextEditor.class:496 FTranslate.class:636 Project.module:424
#: FTextEditor.class:498 FTranslate.class:636 Project.module:424
msgid "Cancel"
msgstr ""
@ -509,41 +509,41 @@ msgstr ""
#: FCommit.form:91 FConflict.form:53 FConnectionEditor.form:361
#: FEditor.form:144 FForm.form:228 FIconEditor.form:103 FImageEditor.form:71
#: FMenu.form:107 FOutput.form:58 FTextEditor.form:93
#: FMenu.form:107 FOutput.form:58 FTextEditor.form:101
msgid "Cut"
msgstr ""
#: FCommit.form:97 FConflict.form:59 FConnectionEditor.form:146
#: FEditor.form:150 FForm.form:235 FIconEditor.form:111 FImageEditor.form:80
#: FMenu.form:113 FOutput.form:65 FTextEditor.form:100
#: FMenu.form:113 FOutput.form:65 FTextEditor.form:108
msgid "Copy"
msgstr ""
#: FCommit.form:103 FConflict.form:65 FConnectionEditor.form:382
#: FEditor.form:157 FForm.form:248 FIconEditor.form:119 FImageEditor.form:89
#: FMenu.form:119 FOutput.form:72 FPasteTable.form:101 FTextEditor.form:107
#: FMenu.form:119 FOutput.form:72 FPasteTable.form:101 FTextEditor.form:115
msgid "Paste"
msgstr ""
#: FCommit.form:109 FConflict.form:71 FConnectionEditor.form:389
#: FEditor.form:128 FForm.form:211 FIconEditor.form:87 FImageEditor.form:99
#: FOption.form:611 FOutput.form:41 FTextEditor.form:76
#: FOption.form:611 FOutput.form:41 FTextEditor.form:84
msgid "Undo"
msgstr ""
#: FCommit.form:115 FConflict.form:77 FConnectionEditor.form:396
#: FEditor.form:135 FForm.form:218 FImageEditor.form:107 FOutput.form:48
#: FTextEditor.form:83
#: FTextEditor.form:91
msgid "Redo"
msgstr ""
#: FCommit.form:121 FConflict.form:83 FEditor.form:434 FMenu.form:129
#: FTextEditor.form:301
#: FTextEditor.form:309
msgid "Indent"
msgstr ""
#: FCommit.form:127 FConflict.form:89 FEditor.form:442 FMenu.form:135
#: FTextEditor.form:308
#: FTextEditor.form:316
msgid "Unindent"
msgstr ""
@ -665,13 +665,13 @@ msgstr ""
#: FConnectionEditor.form:101 FEditor.form:313 FForm.form:403
#: FIconEditor.form:72 FImageEditor.form:54 FMenu.class:64
#: FTextEditor.form:219
#: FTextEditor.form:227
msgid "Save"
msgstr ""
#: FConnectionEditor.form:109 FEditor.form:307 FForm.form:397
#: FHelpBrowser.form:67 FIconEditor.form:79 FImageEditor.form:62
#: FTextEditor.form:213 FTranslate.class:730
#: FTextEditor.form:221 FTranslate.class:730
msgid "Reload"
msgstr ""
@ -1301,7 +1301,7 @@ msgstr ""
msgid "Go to"
msgstr ""
#: FEditor.form:99 FTextEditor.form:67
#: FEditor.form:99 FTextEditor.form:68
msgid "Go to line..."
msgstr ""
@ -1317,15 +1317,15 @@ msgstr ""
msgid "&Startup class"
msgstr ""
#: FEditor.form:167 FTextEditor.form:117
#: FEditor.form:167 FTextEditor.form:125
msgid "Select &All"
msgstr ""
#: FEditor.form:176 FOutput.form:89 FTextEditor.form:126
#: FEditor.form:176 FOutput.form:89 FTextEditor.form:134
msgid "Find next"
msgstr ""
#: FEditor.form:183 FOutput.form:96 FTextEditor.form:133
#: FEditor.form:183 FOutput.form:96 FTextEditor.form:141
msgid "Find previous"
msgstr ""
@ -1341,15 +1341,15 @@ msgstr ""
msgid "&Watch expression"
msgstr ""
#: FEditor.form:214 FTextEditor.form:142
#: FEditor.form:214 FTextEditor.form:150
msgid "Advanced"
msgstr ""
#: FEditor.form:218 FTextEditor.form:153
#: FEditor.form:218 FTextEditor.form:161
msgid "Lower case"
msgstr ""
#: FEditor.form:225 FTextEditor.form:146
#: FEditor.form:225 FTextEditor.form:154
msgid "Upper case"
msgstr ""
@ -1365,7 +1365,7 @@ msgstr ""
msgid "Paste special..."
msgstr ""
#: FEditor.form:259 FTextEditor.form:163
#: FEditor.form:259 FTextEditor.form:171
msgid "Insert color..."
msgstr ""
@ -1377,19 +1377,19 @@ msgstr ""
msgid "Sort procedures..."
msgstr ""
#: FEditor.form:277 FTextEditor.form:183
#: FEditor.form:277 FTextEditor.form:191
msgid "View"
msgstr ""
#: FEditor.form:281 FTextEditor.form:187
#: FEditor.form:281 FTextEditor.form:195
msgid "No split"
msgstr ""
#: FEditor.form:288 FTextEditor.form:194
#: FEditor.form:288 FTextEditor.form:202
msgid "Horizontal split"
msgstr ""
#: FEditor.form:295 FTextEditor.form:201
#: FEditor.form:295 FTextEditor.form:209
msgid "Vertical split"
msgstr ""
@ -1429,7 +1429,7 @@ msgstr ""
msgid "Procedure list"
msgstr ""
#: FEditor.class:2366 FIconEditor.class:2048 FTextEditor.class:496
#: FEditor.class:2366 FIconEditor.class:2048 FTextEditor.class:498
msgid ""
"The file has been modified.\n"
"\n"
@ -1543,7 +1543,7 @@ msgstr ""
msgid "Change into"
msgstr ""
#: FForm.form:136
#: FForm.form:136 FTextEditor.form:74
msgid "Open code"
msgstr ""
@ -1659,7 +1659,7 @@ msgstr ""
msgid "Menu editor..."
msgstr ""
#: FForm.form:435 FTextEditor.form:251
#: FForm.form:435 FTextEditor.form:259
msgid "Code"
msgstr ""
@ -1892,7 +1892,7 @@ msgid ""
"Do you want to save it ?"
msgstr ""
#: FImageEditor.form:48 FTextEditor.form:229
#: FImageEditor.form:48 FTextEditor.form:237
msgid "Text editor"
msgstr ""
@ -4015,23 +4015,23 @@ msgstr ""
msgid "Use a fixed font"
msgstr ""
#: FTextEditor.form:169
#: FTextEditor.form:177
msgid "Compress file"
msgstr ""
#: FTextEditor.form:175
#: FTextEditor.form:183
msgid "Uncompress file"
msgstr ""
#: FTextEditor.class:691
#: FTextEditor.class:693
msgid "The file has been compressed from &1 to &2 bytes (&3)."
msgstr ""
#: FTextEditor.class:691
#: FTextEditor.class:693
msgid "Original file has been saved in the <b>Project</b> folder."
msgstr ""
#: FTextEditor.class:697
#: FTextEditor.class:699
msgid "Unable to compress file."
msgstr ""

View File

@ -1174,7 +1174,7 @@ Static Public Function GetClassSymbols(sClass As String) As Collection
For Each sFamily In CFamily.List
sPath = Project.FindPath(sClass & "." & sFamily)
If Exist(sPath) Then
hPForm = Project.LoadFile(sPath)
Try hPForm = Project.LoadFile(sPath)
Break
Endif
Next

View File

@ -3111,7 +3111,7 @@ End
Public Sub panToolBar_Configure()
If $sModule Then
btnForm.Picture = Picture["img/16/" & $sModule & ".png"]
Action[".show-form"].Picture = Picture["img/16/" & $sModule & ".png"]
btnForm.ToolTip = CModule[$sModule].Name
btnForm.Show
Else
@ -3356,6 +3356,7 @@ Public Sub mnuPretty_Click()
Y = Editor.Line
Editor.Begin
If Not bSelected Then Editor.SelectAll
Print Editor.Selection.Text
Editor.Insert(sNewText)
Editor.Goto(Y, X)
Editor.End

View File

@ -21,7 +21,7 @@
Shortcut = "F2"
}
{ mnuForm Menu
Action = ".code-form"
Action = ".show-form"
Text = ("Open form")
Picture = Picture["img/16/form.png"]
Shortcut = "F12"
@ -458,11 +458,6 @@
Shortcut = "F9"
Picture = "icon:/small/halt"
}
{ Action code-form
Text = "Open form"
Shortcut = "F12"
Picture = "img/16/form.png"
}
{ Action color
Text = "Insert color..."
Shortcut = ""
@ -560,7 +555,8 @@
Shortcut = "Ctrl+A"
}
{ Action show-form
Text = "Form"
Text = "Open form"
Shortcut = "F12"
Picture = "img/16/form.png"
}
{ Action startup-class

View File

@ -47,9 +47,11 @@ Public Sub _new(sPath As String, Optional bModule As Boolean)
If bModule Then
btnShowCode.Visible = True
mnuShowCode.Show
Me.Name = File.BaseName(Path)
Else
btnShowCode.Visible = False
mnuShowCode.Hide
Me.Name = File.Name(Path)
Endif

View File

@ -12,6 +12,12 @@
Text = ("Go to line...")
Shortcut = "Ctrl+G"
}
{ mnuShowCode Menu
Action = ".show-code"
Text = ("Open code")
Picture = Picture["img/16/class.png"]
Shortcut = "F12"
}
{ Menu3 Menu
}
{ mnuUndo Menu
@ -358,6 +364,11 @@
Text = "Code"
Picture = "img/16/class.png"
}
{ Action show-code
Text = "Open code"
Shortcut = "F12"
Picture = "img/16/class.png"
}
{ Action ucase
Text = "Upper case"
Shortcut = "Ctrl+Shift+U"

View File

@ -2067,7 +2067,7 @@ Private Sub CompileError(sMsg As String)
sErr = TranslateMessage(sMsg)
If hForm And If iLine >= hForm.Editor.Lines.Count Then
If hForm And If iLine > hForm.Editor.Lines.Count Then
SetMessage(File.BaseName(sFile) & ": " & sErr & " " & ("in form definition"))
sMsg = "<b>" & sErr & "</b> " & ("in form definition")
Else If iLine >= 1 Then

View File

@ -5,7 +5,11 @@ Create Static
Static Public Sub Main()
Dim hObject As Object
hObject = Application.Startup.AutoCreate()
If Not hObject Is WebPage Then Return
hObject.Render
End

View File

@ -1,2 +1,3 @@
' Gambas class file

View File

@ -1,6 +1,6 @@
<html>
<body>
<h2><%= Application.Name %></h2>
<%[Header]%> ==> OtherWebPage.Render
<h2><%=Application.Name%></h2>
<%
Print "<h1>Gambas</h1>";
@ -9,5 +9,4 @@ For i = 1 To 10
Next
%>
</body>
</html>
<%[Footer]%>

View File

@ -286,7 +286,19 @@ static void compile_file(const char *file)
{
JOB->first_line = FORM_FIRST_LINE;
BUFFER_add(&JOB->source, "#Line " FORM_FIRST_LINE_STRING "\n", -1);
FORM_do(main_public);
switch (JOB->family->type)
{
case FORM_WEBPAGE:
fprintf(stderr, "gbc: warning: WebPage not implemented yet\n");
break;
case FORM_NORMAL:
default:
FORM_do(main_public);
break;
}
BUFFER_add(&JOB->source, "#Line 1\n", -1);
}

View File

@ -63,8 +63,13 @@ static char *COMP_classes = NULL;
COMPILE COMP_current;
const char *COMP_form_families[] = { "form", "report", NULL };
bool COMP_family_allowed[2] = { FALSE, FALSE };
const FORM_FAMILY COMP_form_families[] =
{
{ "form", FORM_NORMAL },
{ "report", FORM_NORMAL },
{ "webpage", FORM_WEBPAGE },
{ NULL }
};
static bool read_line(FILE *f, char *dir, int max)
{
@ -319,7 +324,7 @@ void COMPILE_begin(const char *file, bool trans)
CLEAR(JOB);
JOB->name = STR_copy(file);
JOB->form = FORM_get_file(JOB->name);
JOB->form = FORM_get_file_family(JOB->name, &JOB->family);
JOB->output = OUTPUT_get_file(JOB->name);
if (trans)

View File

@ -34,6 +34,7 @@
#include "gb_limit.h"
#include "gb_reserved.h"
#include "gbc_read.h"
#include "gbc_form.h"
#include "gbc_class.h"
@ -66,6 +67,7 @@ typedef
FUNCTION *func; /* current function being compiled */
CLASS *class; /* current class being compiled */
char *form; /* form file name */
const FORM_FAMILY *family; /* form file family */
char *tname; /* translation file name */
int default_library; /* default library name for extern declarations */
}
@ -78,8 +80,8 @@ EXTERN char *COMP_root;
EXTERN char *COMP_project;
EXTERN char *COMP_project_name;
EXTERN char *COMP_info_path;
EXTERN const char *COMP_form_families[];
EXTERN bool COMP_family_allowed[];
EXTERN FORM_FAMILY COMP_form_families[];
//EXTERN bool COMP_family_allowed[];
#endif

View File

@ -277,19 +277,19 @@ static void save_action(bool delete)
STR_free(name);
}
char *FORM_get_file(const char *file)
char *FORM_get_file_family(const char *file, const FORM_FAMILY **family)
{
char *form;
const char **p;
const FORM_FAMILY *p;
if (strcmp(FILE_get_ext(file), "class"))
return NULL;
p = COMP_form_families;
while (*p)
while (p->ext)
{
form = STR_copy(FILE_set_ext(file, *p));
form = STR_copy(FILE_set_ext(file, p->ext));
if (FILE_exist(form))
break;
STR_free(form);
@ -297,6 +297,7 @@ char *FORM_get_file(const char *file)
p++;
}
if (form) *family= p;
return form;
}

View File

@ -24,6 +24,18 @@
#ifndef __GBC_FORM_H
#define __GBC_FORM_H
enum {
FORM_NORMAL = 0,
FORM_WEBPAGE = 1
};
typedef
struct {
char *ext;
int type;
}
FORM_FAMILY;
typedef
struct {
char *name;
@ -35,6 +47,6 @@ typedef
#define FORM_FIRST_LINE_STRING "100000"
void FORM_do(bool ctrl_public);
char *FORM_get_file(const char *file);
char *FORM_get_file_family(const char *file, const FORM_FAMILY **family);
#endif

View File

@ -203,7 +203,7 @@ static void analyze_function_desc(TRANS_FUNC *func, int flag)
static void header_module_type(void)
{
const char *ext;
const char **p;
const FORM_FAMILY *p;
/*JOB->class->name = STR_copy(FILE_get_name(JOB->name));*/
@ -222,9 +222,9 @@ static void header_module_type(void)
else
{
p = COMP_form_families;
while (*p)
while (p->ext)
{
if (strcasecmp(ext, *p) == 0)
if (strcasecmp(ext, p->ext) == 0)
{
JOB->is_module = FALSE;
JOB->is_form = TRUE;
@ -233,7 +233,7 @@ static void header_module_type(void)
p++;
}
if (!*p)
if (!p->ext)
THROW("Unknown file extension");
}