Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building with protocol buffers #1544

Merged
merged 6 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
[submodule "documentation/website"]
path = documentation/website
url = https://github.com/dylan-lang/website
[submodule "sources/lib/protocol-buffers"]
path = sources/lib/protocol-buffers
url = https://github.com/cgay/protocol-buffers
26 changes: 13 additions & 13 deletions documentation/corba-guide/source/projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,19 @@ To create a CORBA project with the New Project wizard:

The :guilabel:`Advanced...` button next to the client and server
options produces a dialog containing several ORB-related
options. See Setting ORB options” on page 76 for details.
options. See `Setting ORB options`_ for details.

#. Click :guilabel:`Next`.

The next page is the standard wizard page for naming a project and
specifying its location. (See Chapter 4 of Getting Started with
Open Dylan for details.)
specifying its location. (See `Getting Started with Open Dylan > Projects
<https://opendylan.org/getting-started-ide/projects.html>`_ for details.)

The project name you specify here is not used literally when the
wizard creates the project or projects. Instead, if you chose to
create a client project, the wizard creates a project called name
``-client``, where name is the project name you specified. If you
chose to create a server project, the project will be called name
``-server``.
The project name you specify here is not used literally when the wizard
creates the project or projects. Instead, if you chose to create a client
project, the wizard creates a project called ``{name}-client``, where
``{name}`` is the project name you specified. If you chose to create a
server project, the project will be called ``{name}-server``.

Similarly, the project folder you specify is used as the overall
project folder name, with the project files and sources for clients
Expand All @@ -106,7 +105,8 @@ To create a CORBA project with the New Project wizard:

#. Enter a project name and location, and click :guilabel:`Next`.

The wizard moves on to the Use libraries page. This and the remaining wizard pages are as for ordinary projects.
The wizard moves on to the "Use libraries" page. This and the remaining
wizard pages are as for ordinary projects.

#. Complete the remaining pages in the wizard to finish specifying the
non-CORBA parts of your project or projects.
Expand All @@ -119,16 +119,16 @@ To create a CORBA project with the New Project wizard:
both separately. The only exception to this is your choice of
Advanced ORB Settings, which can be set differently for client and
server projects in the “Projects to generate” section of the
wizard’s CORBA options page. See Setting ORB options” on page 76.
wizard’s CORBA options page. See `Setting ORB options`_.

.. note::
The interface projects (that is, the client stubs, server
skeletons, and protocol projects that provide a static interface to
the main project’s IDL) are not generated until you first build
your client or server project. When you do so, the IDL compiler is
invoked and the necessary interface projects are created
automatically. See How the spec file affects IDL compilation” on
page 80 for details of what projects are generated and where.
automatically. See `How the spec file affects IDL compilation`_ for
details of what projects are generated and where.

Setting ORB options
===================
Expand Down
27 changes: 19 additions & 8 deletions sources/app/tool-invoke/library.dylan
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
Module: dylan-user
Synopsis: A standalone program to invoke Functional Developer tools on
specification files.
Synopsis: A standalone program to invoke Open Dylan tool plugins, good for
use while developing new plugins.
Author: 7/98 Seth LaForge
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: See License.txt in this distribution for details.
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND

define library tool-invoke
use collections;
use common-dylan;
use system;
use io;
use collections;
use tools-interface;

use motley;
end library tool-invoke;
use system;
use tools-interface;

// Replace this with your plugin library when developing a new plugin.
use protobuf-tool;
end library;

define module tool-invoke
use common-dylan;
use format-out;
use locators;
use operating-system;
use standard-io;
use streams;
use tools-interface;
end module;
25 changes: 0 additions & 25 deletions sources/app/tool-invoke/module.dylan

This file was deleted.

54 changes: 35 additions & 19 deletions sources/app/tool-invoke/tool-invoke.dylan
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
Module: tool-invoke
Synopsis: A standalone program to invoke Functional Developer tools on
specification files.
Synopsis: A standalone program to invoke Open Dylan tool plugins, good for
use while developing new plugins.
Author: 7/98 Seth LaForge
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: See License.txt in this distribution for details.
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND


// To use this tool to develop a new plugin, replace "use protobuf-tool;" in
// library.dylan with the name of your plugin library and then rebuild.

// TODO(cgay): add third command-line arg to pass prev-run date.

define method main () => ()
let handler <tool-warning-condition> =
method (c :: <tool-warning-condition>, next :: <function>) => ()
Expand All @@ -15,33 +21,43 @@ define method main () => ()
exit-application(2);
end if;
end method;
local method yn-handler (c :: <tool-yes-no-question>, next :: <function>)
=> (answer :: <boolean>)
format-out("%s (y/n) ", c);
force-output(*standard-output*);
let resp = read-line(*standard-input*);
if (resp.size = 0) yn-handler(c, next)
elseif (resp.first = 'y' | resp.first = 'Y') #t
elseif (resp.first = 'n' | resp.first = 'N') #f
else yn-handler(c, next)
end if;
end method yn-handler;
local
method yn-handler (c :: <tool-yes-no-question>, next :: <function>) => (answer :: <boolean>)
format-out("%s (y/n) ", c);
force-out();
let resp = read-line(*standard-input*);
if (resp.size = 0)
yn-handler(c, next)
elseif (resp.first = 'y' | resp.first = 'Y')
#t
elseif (resp.first = 'n' | resp.first = 'N')
#f
else
yn-handler(c, next)
end if;
end method;
let handler <tool-yes-no-question> = yn-handler;

let args = application-arguments();
if (size(args) < 1 | size(args) > 2)
format-out("Usage: %s <specification-file-name> [<project-file-name>]\n",
application-name());
if (size(args) < 1
| size(args) > 2
| member?(args[0], #("help", "-help", "-h", "--help"), test: \=))
format-out("Usage: %s <specification-file-name> [<project-file-name>]\n",
locator-base(as(<file-locator>, application-name())));
exit-application(1);
end if;
let spec-file = as(<file-locator>, args[0]);
let project-file = element(args, 1, default: #f);
if (project-file)
project-file := as(<file-locator>, project-file);
end if;

let tool-name = tool-name-from-specification(spec-file);
let tool = tool-find(tool-name);
if (tool-name == #"dylan")
// The #"dylan" default for files with no extension is not useful to us here.
tool-name := #f;
end;
let tool = tool-name & tool-find(tool-name);
if (tool)
let (success?, modified-projects) = tool(spec-file, project-file, #f);
if (~success?)
Expand All @@ -50,7 +66,7 @@ define method main () => ()
end if;
format-out("Modified projects: %=.\n", modified-projects);
else
format-out("Tool \"%s\" could not be found.\n", as(<string>, tool-name));
format-out("Tool for file %s could not be found.\n", as(<string>, spec-file))
end if;
end method main;

Expand Down
12 changes: 5 additions & 7 deletions sources/app/tool-invoke/tool-invoke.lid
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
library: tool-invoke
files: library
module
tool-invoke
compilation-mode: tight
target-type: executable
library: tool-invoke
files: library
tool-invoke
compilation-mode: tight
target-type: executable
Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
All rights reserved.
License: See License.txt in this distribution for details.
Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
3 changes: 2 additions & 1 deletion sources/environment/console/compiler-library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ define library dylan-compiler
// Back-ends
use dfmc-back-end-implementations;

// Project manager plug-ins
// Project manager plug-ins call tool-register on load.
use motley;
use protobuf-tool;
use tool-scepter;
use tool-parser-generator;

Expand Down
3 changes: 2 additions & 1 deletion sources/environment/console/environment-library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ define library dylan-environment
// Back-ends
use dfmc-back-end-implementations;

// Project manager plug-ins
// Project manager plug-ins call tool-register on load.
use motley;
use protobuf-tool;
use tool-scepter;
use tool-parser-generator;

Expand Down
1 change: 1 addition & 0 deletions sources/environment/console/environment-module.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ define module console-environment
working-directory };
use standard-io;
use format;
use format-out;
use commands;
use command-lines;

Expand Down
12 changes: 3 additions & 9 deletions sources/environment/dfmc/projects/common.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@ define sealed method initialize
(project-object :: <native-project-object>, #key) => ()
next-method();
add-new!(*open-projects*, project-object);
end method initialize;
end method;

//--- Is there a way around making this sideways?
define sealed sideways method open-projects
() => (projects :: <sequence>)
let projects :: <stretchy-object-vector> = make(<stretchy-object-vector>);
for (project :: <native-project-object> in *open-projects*)
if (project-opened-by-user?(project))
add!(projects, project)
end
end;
projects
end method open-projects;
choose(project-opened-by-user?, *open-projects*)
end method;
28 changes: 28 additions & 0 deletions sources/lib/protobuf-tool/library.dylan
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Module: dylan-user

define library protobuf-tool
use protocol-buffers;

use common-dylan;
use dylan, import: { simple-debugging };
use file-source-records;
use io;
use system;
use tools-interface;
end library;

define module protobuf-tool
use protocol-buffers;

use common-dylan;
use date;
use file-source-records;
use file-system;
use format;
use format-out;
use locators;
use simple-debugging, import: { debug-out };
use streams;
use tools-interface;
end module;

Loading
Loading