.CM  SCRIPT , Version - 1.1 , last edited by D.Dittmar
.pa
.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1996-2004 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.TT 1 $SQL$Project Distributed Database System$VIN02$
.tt 2 $$$
.TT 3 $$global_init$1995-11-01$
***********************************************************
.nf

.nf


    ========== licence begin  GPL
    Copyright (c) 1996-2004 SAP AG

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end

.fo


.fo
.nf
.sp
MODULE  : global_init
=========
.sp
Purpose : Allocation and initialization of the global variable I01G.
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :

&       ifndef INLINK
        PROCEDURE
              i02getgp (
                    VAR p : tin_global_in_vars);

        PROCEDURE
              i02inigp (
                    VAR p     : tin_global_in_vars;
                    VAR pende : integer);

        PROCEDURE
              i02freegp (
                    VAR p : tin_global_in_vars );
&       endif
&       ifdef WINDOWS

        PROCEDURE
              i02unlockgp (
                    VAR p : tin_global_in_vars);

        PROCEDURE
              i02lockgp (
                    VAR p : tin_global_in_vars);
&       endif

        PROCEDURE
              i02init (
                    VAR g_area : tin_global_in_vars );

        FUNCTION
              i02swapkind : tsp00_SwapKind;

        FUNCTION
              in0230 : tsp00_Int4;

.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :

&       ifndef INLINK
        FROM
              global_variable : VIN01;

        PROCEDURE
              i01dummy;

      ------------------------------

        FROM
              messages : VIN03 ;

        PROCEDURE
              i03init;

      ------------------------------

        FROM
              vp_output : VIN61;

        PROCEDURE
              i61init;
&       endif
&       ifdef WINDOWS

      ------------------------------

        FROM
              Windows_RTE_Extension : VEN102W ;

        FUNCTION
              sqlwmalloc (
                    size : tsp00_Int4) : tsp00_Int4;

        FUNCTION
              sqlwmlock (
                    handle : tsp00_Int4) : tin_global_in_vars;

        FUNCTION
              sqlwmunlock (
                    handle : tsp00_Int4 ) : tin_global_in_vars;

        FUNCTION
              sqlwmfree (
                    handle : tsp00_Int4 ) : tsp00_Int4;
&       endif

      ------------------------------

        FROM
              standard_editor_functions: VIN14;

        PROCEDURE
              i14cleareform (
                    VAR evars     : tin_eform_vars);

      ------------------------------

        FROM
              non_db_init: VIN021;

        PROCEDURE
              i021init (
                    VAR g_area : tin_global_in_vars );

.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :

        PROCEDURE
              sqlwmlock;

              tsp00_ObjAddr tin_global_in_vars

        PROCEDURE
              sqlwmunlock;

              tsp00_ObjAddr tin_global_in_vars

.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : 
.sp
.cp 3
Created : 1985-04-19
.sp
.cp 3
Version : 1996-12-04
.sp
.cp 3
Release :  6.1.2     Date : 1995-11-01
.sp
***********************************************************
.sp
.cp 20
.fo
.oc _/1
Specification:
* Before the user logs on, the variable I01_G is initialized with
i02INIT.
.hi 0
.sp 3;.cp 6;.nf
        PROCEDURE
              i02init;
.sp;.fo
Serves to initialize I01_G and is called at the beginning of the
main program.
.sp 3;.cp 6;.nf

.CM *-END-* specification -------------------------------
.sp 2.fo
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:

.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:

.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :


&ifdef WINDOWS
VAR
      i02handle : tsp00_Int4;
&     endif


(*------------------------------*)

FUNCTION
      in0230 : tsp00_Int4;

BEGIN
(* linkcheck function *)
in0230 := 219020526;
END;

&ifndef INLINK
(*------------------------------*)

PROCEDURE
      i02getgp (
            VAR p : tin_global_in_vars);

BEGIN
&ifdef WINDOWS
i02handle := sqlwmalloc( sizeof (p^) );
p := sqlwmlock( i02handle );
&else
new(p);
&endif
END;

(*------------------------------*)

PROCEDURE
      i02inigp (
            VAR p     : tin_global_in_vars;
            VAR pende : integer);

BEGIN
END;

&ifdef WINDOWS
(*------------------------------*)

PROCEDURE
      i02unlockgp (
            VAR p : tin_global_in_vars);

BEGIN
p := sqlwmunlock( i02handle );
END;

(*------------------------------*)

PROCEDURE
      i02lockgp (
            VAR p : tin_global_in_vars);

BEGIN
p := sqlwmlock( i02handle );
END;

&endif
(*------------------------------*)

PROCEDURE
      i02freegp (
            VAR p : tin_global_in_vars );

BEGIN
&ifdef WINDOWS
IF  p <> NIL
THEN
    p := sqlwmunlock( i02handle );
(*ENDIF*)
IF  i02handle <> 0
THEN
    i02handle := sqlwmfree( i02handle );
&else
(*ENDIF*)
dispose(p);
p := NIL;
&endif
END;

&endif
(*------------------------------*)

PROCEDURE
      i02init (
            VAR g_area : tin_global_in_vars );

BEGIN
i021init (g_area);
&ifndef INLINK
i03init;
i61init;
i01dummy;
WITH g_area^.com_stack DO
    BEGIN
    cp := 0;
    i14cleareform (cvars);
    cvars.size := mxin_cmd_pool;
    END;
(*ENDWITH*)
&endif
END; (* i02init *)

(*------------------------------*)

FUNCTION
      i02swapkind : tsp00_SwapKind;

VAR

      i4c4 : RECORD
            CASE  boolean OF
                true :
                    (iiii : tsp00_Int4);
                false :
                    (cccc : tsp00_C4);
                END;
            (*ENDCASE*)


BEGIN
WITH i4c4 DO
    BEGIN
    iiii := 1;
    IF  cccc  [4]  = chr (1)
    THEN
        i02swapkind := sw_normal
    ELSE
        IF  cccc  [1]  = chr (1)
        THEN
            i02swapkind := sw_full_swapped
        ELSE
            i02swapkind := sw_part_swapped;
        (*ENDIF*)
    (*ENDIF*)
    END;
(*ENDWITH*)
END; (* i02swapkind *)

.CM *-END-* code ----------------------------------------
.SP 2
***********************************************************
*-PRETTY-*  statements    :         27
*-PRETTY-*  lines of code :        142        PRETTY  3.09
*-PRETTY-*  lines in file :        353         1992-11-23
.PA
