Browse Source

Автодок: спецкомментарии к неэкспортированным полям; Граф: спецкомментарии

Arthur Yefimov 2 years ago
parent
commit
ec20a761ff
2 changed files with 76 additions and 47 deletions
  1. 31 2
      src/Autodoc/AutodocParser.Mod
  2. 45 45
      src/Graph.Mod

+ 31 - 2
src/Autodoc/AutodocParser.Mod

@@ -339,6 +339,7 @@ BEGIN
       IF o.comment[i] = tab THEN o.comment[i] := 0AX END;
       IF o.comment[i] = tab THEN o.comment[i] := 0AX END;
       INC(i)
       INC(i)
     END
     END
+  ELSE ClearComments
   END
   END
 END SaveAllComments;
 END SaveAllComments;
 
 
@@ -351,8 +352,9 @@ END SaveAllComments;
     symbol of the object, or -1 if comment goes before it. *)
     symbol of the object, or -1 if comment goes before it. *)
 PROCEDURE SaveComment(o: Object; lastLine: INTEGER);
 PROCEDURE SaveComment(o: Object; lastLine: INTEGER);
 BEGIN
 BEGIN
-  IF (o # NIL) & (doc[0] # 0X) & ((lastLine = -1) OR (docLine = lastLine)) THEN
-    IF o.comment[0] = 0X THEN AppendComment(o.comment)
+  IF (doc[0] # 0X) & ((lastLine = -1) OR (docLine = lastLine)) THEN
+    IF o = NIL THEN ClearComments (* RemoveLastComment ? *)
+    ELSIF o.comment[0] = 0X THEN AppendComment(o.comment)
     ELSIF docLine = lastLine THEN Strings.Append(0AX, o.comment);
     ELSIF docLine = lastLine THEN Strings.Append(0AX, o.comment);
       AppendComment(o.comment)
       AppendComment(o.comment)
     END
     END
@@ -996,13 +998,40 @@ BEGIN L := NewList(); stop := FALSE;
   Debug('ParseVars end')
   Debug('ParseVars end')
 RETURN L END ParseVars;
 RETURN L END ParseVars;
 
 
+(** Sets C.isOrdinal to TRUE if C.value is a single character literal in
+    the form of 'x', "x" or 4AX or if C.value is an integer (dec, hex). *)
 PROCEDURE CheckOrdinal(C: Const);
 PROCEDURE CheckOrdinal(C: Const);
 VAR x: CHAR;
 VAR x: CHAR;
+
+  PROCEDURE IsInt(s: ARRAY OF CHAR; VAR val: INTEGER): BOOLEAN;
+  VAR i, start: INTEGER;
+    minus, ok: BOOLEAN;
+    end: CHAR;
+  BEGIN val := 0; start := 0; minus := FALSE; ok := TRUE;
+    IF s[0] = '-' THEN minus := TRUE; start := 1
+    ELSIF s[0] = '+' THEN start := 1
+    END;
+    i := start;
+    WHILE IsHex(s[i]) DO INC(i) END; end := s[i];
+    IF ((end = 'X') OR (end = 'H')) & (s[i + 1] = 0X) THEN i := 0;
+      WHILE s[i] # end DO val := val * 16 + FromHex(s[i]); INC(i) END
+    ELSIF s[i] = 0X THEN i := 0;
+      WHILE s[i] # end DO val := val * 10 + ORD(s[i]) - ORD('0'); INC(i) END
+    ELSE ok := FALSE
+    END;
+    IF minus THEN val := -val END
+  RETURN ok & (s[0] # 0X) END IsInt;
+
 BEGIN
 BEGIN
+  Out.String('CHECK ORDINAL [');
+  Out.String(C.value);
+  Out.String(']');
+  Out.Ln;
   IF ~C.isOrdinal THEN x := C.value[0];
   IF ~C.isOrdinal THEN x := C.value[0];
     (* Literal char 'x' or "x" *)
     (* Literal char 'x' or "x" *)
     IF ((x = '"') OR (x = "'")) & (C.value[1] # 0X) & (C.value[2] = x) THEN
     IF ((x = '"') OR (x = "'")) & (C.value[1] # 0X) & (C.value[2] = x) THEN
       C.isOrdinal := TRUE; C.intVal := ORD(C.value[1])
       C.isOrdinal := TRUE; C.intVal := ORD(C.value[1])
+    ELSIF IsInt(C.value, C.intVal) THEN C.isOrdinal := TRUE
     END
     END
   END
   END
 END CheckOrdinal;
 END CheckOrdinal;

+ 45 - 45
src/Graph.Mod

@@ -4,7 +4,7 @@ IMPORT Out, Al := Allegro5, Utf8, Files, Dir, Strings, SYSTEM;
 CONST
 CONST
   fontPlanes = 4; (*!TODO*)
   fontPlanes = 4; (*!TODO*)
 
 
-  (* Settings set members *)
+  (** Settings set members **)
   manual*      = 0;
   manual*      = 0;
   fullscreen*  = 1;
   fullscreen*  = 1;
   window*      = 2;
   window*      = 2;
@@ -20,7 +20,7 @@ CONST
   nobuffer*    = 12;
   nobuffer*    = 12;
   topleft*     = 13;
   topleft*     = 13;
 
 
-  (* Event.type possible values *)
+  (** Event.type possible values **)
   noEvent      = 0;
   noEvent      = 0;
   quit*        = 1;
   quit*        = 1;
   timer*       = 2;
   timer*       = 2;
@@ -36,16 +36,16 @@ CONST
 
 
   eventUserResize = 2005;
   eventUserResize = 2005;
 
 
-  (* Window.zoom possible values *)
-  noZoom   = 0; (* The screen is not zoomed *)
-  intZoom  = 1; (* The zoom value is an integer: 2x, 3x etc. *)
-  realZoom = 2; (* The zoom value is not an integer, i.e. 2.5x *)
+  (** Window.zoom possible values **)
+  noZoom   = 0; (** The screen is not zoomed *)
+  intZoom  = 1; (** The zoom value is an integer: 2x, 3x etc. *)
+  realZoom = 2; (** The zoom value is not an integer, i.e. 2.5x *)
 
 
-  (* Flip flags for DrawFlip, DrawEx etc. *)
+  (** Flip flags for DrawFlip, DrawEx etc. **)
   flipHor*  = 0;
   flipHor*  = 0;
   flipVert* = 1;
   flipVert* = 1;
 
 
-  (* Key Codes *)
+  (** Key Codes **)
   kA*          = 1;
   kA*          = 1;
   kB*          = 2;
   kB*          = 2;
   kC*          = 3;
   kC*          = 3;
@@ -165,7 +165,7 @@ CONST
 
 
   kMax*        = 226;
   kMax*        = 226;
 
 
-  (* Modifiers Set *)
+  (** Modifiers Set **)
   mShift*      = 0;
   mShift*      = 0;
   mCtrl*       = 1;
   mCtrl*       = 1;
   mAlt*        = 2;
   mAlt*        = 2;
@@ -196,7 +196,7 @@ TYPE
   Timer* = POINTER TO TimerDesc;
   Timer* = POINTER TO TimerDesc;
   TimerDesc* = RECORD
   TimerDesc* = RECORD
     tmr: Al.Timer;
     tmr: Al.Timer;
-    next: Timer (* See timerList below *)
+    next: Timer (** See timerList below *)
   END;
   END;
 
 
   Bitmap* = POINTER TO BitmapDesc;
   Bitmap* = POINTER TO BitmapDesc;
@@ -206,31 +206,31 @@ TYPE
   END;
   END;
 
 
   Window* = POINTER TO WindowDesc;
   Window* = POINTER TO WindowDesc;
-  WindowDesc* = RECORD(BitmapDesc)
-    display: Al.Display;
-    winW, winH: INTEGER; (* Window size in real pixels *)
-    initX, initY: INTEGER; (* Window position upon its creation *)
-    initW, initH: INTEGER; (* Window size upon its creation *)
-    fsW, fsH: INTEGER; (* Window size upon its creation *)
-    wantZoom: REAL; (* Window zoom upon its creation *)
-    lastX, lastY: INTEGER; (* Last mouse position in virtual pixels *)
-    lastW, lastH: INTEGER; (* Last stepped size in virtual pixels *)
-    zoom: INTEGER; (* See constants above; based on this rzoom/izoom is used *)
-    izoom: INTEGER; (* Window.izoom is used if Window.zoom = intZoom  *)
-    rzoom: REAL;    (* Window.rzoom is used if Window.zoom = realZoom *)
-    scaleOn: BOOLEAN; (* If TRUE, scaleX and scaleY are used *)
-    scaleX, scaleY: REAL; (* Deforms pixels on Flip, but zoom is for drawing *)
+  WindowDesc* = RECORD(BitmapDesc) (** This is a window. *)
+    display: Al.Display; (** Allegro Display *)
+    winW, winH: INTEGER; (** Window size in real pixels *)
+    initX*, initY: INTEGER; (** Window position upon its creation *)
+    initW, initH: INTEGER; (** Window size upon its creation *)
+    fsW, fsH*: INTEGER; (** Window size upon its creation *)
+    wantZoom: REAL; (** Window zoom upon its creation *)
+    lastX, lastY: INTEGER; (** Last mouse position in virtual pixels *)
+    lastW, lastH: INTEGER; (** Last stepped size in virtual pixels *)
+    zoom: INTEGER; (** See constants above; based on this rzoom/izoom is used *)
+    izoom: INTEGER; (** Window.izoom is used if Window.zoom = intZoom  *)
+    rzoom: REAL;    (** Window.rzoom is used if Window.zoom = realZoom *)
+    scaleOn: BOOLEAN; (** If TRUE, scaleX and scaleY are used *)
+    scaleX, scaleY: REAL; (** Deforms pixels on Flip, but zoom is for drawing *)
     sizeStepX, sizeStepY: INTEGER;
     sizeStepX, sizeStepY: INTEGER;
-    flipX, flipY, flipW, flipH: REAL; (* Where to flip the window bitmap to *)
-    iFlipX, iFlipY: INTEGER; (* Same as flipX, flipY, which are always whole *)
+    flipX, flipY, flipW, flipH: REAL; (** Where to flip the window bitmap to *)
+    iFlipX, iFlipY: INTEGER; (** Same as flipX, flipY, which are always whole *)
     options: SET;
     options: SET;
-    pressedButtons: SET; (* Mouse buttons that are currenty being pressed *)
+    pressedButtons: SET; (** Mouse buttons that are currenty being pressed *)
     title: ARRAY 256 OF CHAR;
     title: ARRAY 256 OF CHAR;
-    resized: BOOLEAN; (* TRUE if fullscreen mode has been toggled for window *)
+    resized: BOOLEAN; (** TRUE if fullscreen mode has been toggled for window *)
     showMouse: BOOLEAN;
     showMouse: BOOLEAN;
     icons: ARRAY 64 OF Al.Bitmap;
     icons: ARRAY 64 OF Al.Bitmap;
     noficons: INTEGER;
     noficons: INTEGER;
-    next: Window (* See windowList below *)
+    next: Window (** See windowList below *)
   END;
   END;
 
 
   Event* = RECORD
   Event* = RECORD
@@ -239,11 +239,11 @@ TYPE
     x*, y*, z*, w*, h*: INTEGER;
     x*, y*, z*, w*, h*: INTEGER;
     dx*, dy*, dz*, dw*: INTEGER;
     dx*, dy*, dz*, dw*: INTEGER;
     button*: INTEGER;
     button*: INTEGER;
-    buttons*: SET; (* What mouse buttons are pressed *)
-    count*: LONGINT; (* Timer counter *)
-    key*: INTEGER; (* Physical key code *)
-    ch*: CHAR; (* Typed character for event.type = char *)
-    mod*: SET; (* Key modifiers *)
+    buttons*: SET; (** What mouse buttons are pressed *)
+    count*: LONGINT; (** Timer counter *)
+    key*: INTEGER; (** Physical key code *)
+    ch*: CHAR; (** Typed character for event.type = char *)
+    mod*: SET; (** Key modifiers *)
     repeat*: BOOLEAN;
     repeat*: BOOLEAN;
     window*: Window;
     window*: Window;
     timer*: Timer;
     timer*: Timer;
@@ -278,12 +278,12 @@ TYPE
 VAR
 VAR
   Done*: BOOLEAN;
   Done*: BOOLEAN;
 
 
-  settings: SET; (* See list of constants Settings above *)
-  wantW, wantH: INTEGER; (* Assigned in procedure Settings *)
-  wantZoom: REAL; (* Assigned in procedure SetZoom *)
-  wantSizeStepX, wantSizeStepY: INTEGER; (* Assigned in SetSizeStep *)
-  wantScaleX, wantScaleY: REAL; (* Assigned in procedure SetScale *)
-  wantTitle: ARRAY 256 OF CHAR; (* Assigned in procedure SetTitle *)
+  settings: SET; (** See list of constants Settings above *)
+  wantW, wantH: INTEGER; (** Assigned in procedure Settings *)
+  wantZoom: REAL; (** Assigned in procedure SetZoom *)
+  wantSizeStepX, wantSizeStepY: INTEGER; (** Assigned in SetSizeStep *)
+  wantScaleX, wantScaleY: REAL; (** Assigned in procedure SetScale *)
+  wantTitle: ARRAY 256 OF CHAR; (** Assigned in procedure SetTitle *)
   queue: Al.EventQueue;
   queue: Al.EventQueue;
   userEventSource: Al.EventSource;
   userEventSource: Al.EventSource;
   windowList: Window;
   windowList: Window;
@@ -292,8 +292,8 @@ VAR
   target: Bitmap;
   target: Bitmap;
   black: Color;
   black: Color;
 
 
-  charRead: CHAR; (* For KeyPressed and ReadKey *)
-  specialChar: BOOLEAN; (* For charRead *)
+  charRead: CHAR; (** For KeyPressed and ReadKey *)
+  specialChar: BOOLEAN; (** For charRead *)
 
 
 PROCEDURE Error(s: ARRAY OF CHAR);
 PROCEDURE Error(s: ARRAY OF CHAR);
 BEGIN Out.String(s); Out.Ln
 BEGIN Out.String(s); Out.Ln
@@ -1415,7 +1415,7 @@ BEGIN f := LoadFontInfo(fname);
   IF f # NIL THEN LoadFontBitmap(f) END
   IF f # NIL THEN LoadFontBitmap(f) END
 RETURN f END LoadFont;
 RETURN f END LoadFont;
 
 
-(* Clipboard *)
+(** Clipboard **)
 
 
 PROCEDURE GetClipboardText*(win: Window; VAR s: ARRAY OF CHAR);
 PROCEDURE GetClipboardText*(win: Window; VAR s: ARRAY OF CHAR);
 TYPE P = POINTER [1] TO ARRAY 5000 OF SHORTCHAR;
 TYPE P = POINTER [1] TO ARRAY 5000 OF SHORTCHAR;
@@ -1437,7 +1437,7 @@ END GetClipboardText;
 PROCEDURE Time*(): REAL;
 PROCEDURE Time*(): REAL;
 RETURN Al.get_time() END Time;
 RETURN Al.get_time() END Time;
 
 
-(* Window Icons *)
+(** Window Icons **)
 
 
 PROCEDURE SetWindowIconsEx*(win: Window; icons: ARRAY OF Bitmap;
 PROCEDURE SetWindowIconsEx*(win: Window; icons: ARRAY OF Bitmap;
     from, len: INTEGER);
     from, len: INTEGER);
@@ -1462,7 +1462,7 @@ BEGIN
   Al.set_display_icon(win.display, icon.bmp)
   Al.set_display_icon(win.display, icon.bmp)
 END SetWindowIcon;
 END SetWindowIcon;
 
 
-(* Init *)
+(** Init **)
 
 
 PROCEDURE InitScreen(): BOOLEAN;
 PROCEDURE InitScreen(): BOOLEAN;
 VAR opt: SET;
 VAR opt: SET;