sharedobj/src/sharedobj.tmpl


% Copyright (C) 1993, Digital Equipment Corporation
% All rights reserved.
% See the file COPYRIGHT for a full description.
%
% Last modified on Fri Feb 10 08:28:26 PST 1995 by kalsow
%      modified on Thu Mar  3 15:41:57 PST 1994 by wobber
%      modified on Fri Aug 13 10:01:08 PDT 1993 by harrison
%      modified on Wed May 19 12:35:20 PDT 1993 by mjordan

if defined ("SHAREDOBJGEN")
  % take the version specified by the user
  _SHAREDOBJ_STUBGEN = SHAREDOBJGEN
else
  %% - full path
  _SHAREDOBJ_STUBGEN = format ("%s%s%s", BIN_USE, SL, "shobjcodegen")
  %% _SHAREDOBJ_STUBGEN = "shobjcodegen"
end
/* _SHAREDOBJ_STUBGEN = format("/u/stieglitz/bm/arm3/bm-work/sharedobjgen/%s/sharedobjgen", BUILD_DIR) */

readonly proc _v_sharedobjv1(intf, types, v, useintfs, proxy) is
  local intf_pn = path_of(intf & ".i3")

% The generated sources are in the build directory of THIS_PACKAGE
% we generate: <intf>Proxy.i3, <intf>Pickle.i3, <intf>CB.i3, <intf>CB.m3,
%	       <intf>SO.m3

  local initArgs = []
  if proxy
    initArgs = ["-p"]
    derived_interface (intf & "Proxy", v)
  end
  derived_interface (intf & "CBProxy", v)
  derived_interface (intf & "CB", v)
  derived_interface (intf & "Pickle", v)
  derived_implementation (intf & "CB")
  derived_implementation (intf & "SO")

  if defined("M3_MODE")
    if equal(M3_MODE, "clean")
      return
    end
  end

  local stalei = stale(intf & "SO.m3", intf_pn)
  foreach i in useintfs
    stalei = stalei and stale(intf & "SO.m3", i & ".i3")
  end
  local args = []
  foreach i in types
    args += format("%s.%s", intf, i)
  end

  if stalei
    generate_tfile()
    exec(_SHAREDOBJ_STUBGEN, "-o", intf, initArgs, "-so", args, "-i", useintfs,
          M3SEARCH_TABLES)
  end

end

readonly proc sharedobjv1(intf, types, useintfs) is
  _v_sharedobjv1(intf, types, HIDDEN, useintfs, "true")
end

readonly proc Sharedobjv1(intf, types, useintfs) is
  _v_sharedobjv1(intf, types, VISIBLE, useintfs, "true")
end

readonly proc sharedobj(intf, types, useintfs) is
 sharedobjv1(intf, types, useintfs)
end

readonly proc Sharedobj(intf, types, useintfs) is
  Sharedobjv1(intf, types, useintfs)
end

readonly proc sharedobjNoProxyv1(intf, types, useintfs) is
  _v_sharedobjv1(intf, types, HIDDEN, useintfs, "")
end

readonly proc SharedobjNoProxyv1(intf, types, useintfs) is
  _v_sharedobjv1(intf, types, VISIBLE, useintfs, "")
end

readonly proc sharedobjNoProxy(intf, types, useintfs) is
 sharedobjNoProxyv1(intf, types, useintfs)
end

readonly proc SharedobjNoProxy(intf, types, useintfs) is
  SharedobjNoProxyv1(intf, types, useintfs)
end