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

View File

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

View File

@ -3111,7 +3111,7 @@ End
Public Sub panToolBar_Configure() Public Sub panToolBar_Configure()
If $sModule Then 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.ToolTip = CModule[$sModule].Name
btnForm.Show btnForm.Show
Else Else
@ -3356,6 +3356,7 @@ Public Sub mnuPretty_Click()
Y = Editor.Line Y = Editor.Line
Editor.Begin Editor.Begin
If Not bSelected Then Editor.SelectAll If Not bSelected Then Editor.SelectAll
Print Editor.Selection.Text
Editor.Insert(sNewText) Editor.Insert(sNewText)
Editor.Goto(Y, X) Editor.Goto(Y, X)
Editor.End Editor.End

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -286,7 +286,19 @@ static void compile_file(const char *file)
{ {
JOB->first_line = FORM_FIRST_LINE; JOB->first_line = FORM_FIRST_LINE;
BUFFER_add(&JOB->source, "#Line " FORM_FIRST_LINE_STRING "\n", -1); 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); BUFFER_add(&JOB->source, "#Line 1\n", -1);
} }

View File

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

View File

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

View File

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

View File

@ -24,6 +24,18 @@
#ifndef __GBC_FORM_H #ifndef __GBC_FORM_H
#define __GBC_FORM_H #define __GBC_FORM_H
enum {
FORM_NORMAL = 0,
FORM_WEBPAGE = 1
};
typedef
struct {
char *ext;
int type;
}
FORM_FAMILY;
typedef typedef
struct { struct {
char *name; char *name;
@ -35,6 +47,6 @@ typedef
#define FORM_FIRST_LINE_STRING "100000" #define FORM_FIRST_LINE_STRING "100000"
void FORM_do(bool ctrl_public); 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 #endif

View File

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