/* --- Copyright University of Sussex 1995. All rights reserved. ----------
 > File:            C.all/lib/objectclass/setup/loadobjectclass.p
 > Purpose:         Objectclass file
 > Author:          Steve Knight, HP Labs, 1992-1993 (see revisions)
 > Documentation:   HELP OBJECTCLASS
 > Related Files:
 */
compile_mode:pop11 +strict;


;;; -- Top-level loading file -----------------------------------------------

section $-objectclass;

;;; We want some description of the loading process if pop_debugging
;;; is true and we aren't inside a call to "uses".
;;;
define lconstant procedure want_chat();
	pop_debugging == true and
	not( testdef useslib and iscaller( weakref useslib ) )
enddefine;

if want_chat() then
	nprintf( ';;; ObjectClass %p', [^(pop_oc_version/1000.0s0)] );
endif;

;;; Determine whether we're being loaded from Popc.
lvars i = 0, mode = false;
while caller(i) and not(caller_valof("pop_pas_mode", i) ->> mode) do
	i + 1 -> i;
endwhile;
constant OBJECTCLASS_IN_POPC = mode;

procedure();
	dlocal current_directory, cucharout;
	unless pop_debugging == true then
		erase -> cucharout
	endunless;
	;;; load everything from the runtime library, in any order
	objectclass_dir dir_>< 'rt/' -> current_directory;
	applist(pdtolist(sys_file_match('*.p', nullstring, false, false)),
		pop11_compile);
	;;; load source files
	objectclass_dir dir_>< 'src/' -> current_directory;
	pop11_compile('setup.p');
endprocedure();

#_IF DEF OBJECTCLASS_IN_POPC
;;; Force generation of all generic linking code at end of file
popc_after_compile_hook <> optimise_objectclass(%"all"%)
	-> popc_after_compile_hook;
#_ENDIF

if want_chat() then
	nprintf( ';;; ObjectClass %p loaded', [^(pop_oc_version/1000.0s0)] );
endif;

endsection;


/* --- Revision History ---------------------------------------------------
--- Robert John Duncan, Oct 27 1995
		Changed to load everything from the runtime library
--- Robert John Duncan, Oct  6 1995
		Popc changes
;;; -------------------------------------------------------------------------
;;; Modified, 6/10/93, JJC
;;;     *   Modified version printing + other minor mods before installing
;;;         in Poplog 14.5
;;; -------------------------------------------------------------------------
;;; Modified, 1/7/93, sfk
;;;     *   Stopped the loading process from chatting when objectclass
;;;         is loaded via "uses".  Doesn't matter about "lib", though,
;;;         because "lib" chats anyway.
;;; -------------------------------------------------------------------------
;;; Modified, 15/04/93, sfk
;;;     *   Removed sysprotects from this file.  They were out of date
;;;         and difficult to keep synchronised with changes in the
;;;         implementation.
;;; -------------------------------------------------------------------------
;;; Modified, 23/10/92, sfk
;;;     *   Removed the sysprotect of "class_make" which has been removed
;;;         from the system.
;;; -------------------------------------------------------------------------
;;; Modified, 25/4/92, sfk
;;;     *   added sysprotects for selected identifiers which simplifies
;;;         the declarations in the main body.  It also makes testing
;;;         easier.
;;; -------------------------------------------------------------------------
 */
