]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - Ada95/gen/gen.c
ncurses 5.2
[ncurses.git] / Ada95 / gen / gen.c
index 0a093cf8cd7b2bfbfb0125cea644003abd21cde2..64e9f912e443c6fc4a8ed45ad31d10eb94e18cb8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 /*
     Version Control
-    $Revision: 1.29 $
+    $Revision: 1.32 $
   --------------------------------------------------------------------------*/
 /*
   This program generates various record structures and constants from the
@@ -170,7 +170,7 @@ static void gen_chtype_rep(const char *name)
   chtype_rep("Ch",A_CHARTEXT);
   chtype_rep("Color",A_COLOR);
   chtype_rep("Attr",(A_ATTRIBUTES&~A_COLOR));
-  printf("      end record;\n   for %s'Size use %d;\n",name,8*sizeof(chtype));
+  printf("      end record;\n   for %s'Size use %ld;\n", name, (long)(8*sizeof(chtype)));
   printf("      --  Please note: this rep. clause is generated and may be\n");
   printf("      --               different on your system.\n");
 }
@@ -218,50 +218,53 @@ static void gen_mrep_rep(const char *name)
 
 static void gen_attr_set( const char *name )
 {
+  /* All of the A_xxx symbols are defined in ncurses, but not all are nonzero
+   * if "configure --enable-widec" is specified.
+   */
   static const name_attribute_pair nap[] = {
-#ifdef A_STANDOUT
+#if A_STANDOUT
     {"Stand_Out",               A_STANDOUT},
 #endif
-#ifdef A_UNDERLINE
+#if A_UNDERLINE
     {"Under_Line",              A_UNDERLINE},
 #endif
-#ifdef A_REVERSE
+#if A_REVERSE
     {"Reverse_Video",           A_REVERSE},
 #endif
-#ifdef A_BLINK
+#if A_BLINK
     {"Blink",                   A_BLINK},
 #endif
-#ifdef A_DIM
+#if A_DIM
     {"Dim_Character",           A_DIM},
 #endif
-#ifdef A_BOLD
+#if A_BOLD
     {"Bold_Character",          A_BOLD},
 #endif
-#ifdef A_ALTCHARSET
+#if A_ALTCHARSET
     {"Alternate_Character_Set", A_ALTCHARSET},
 #endif
-#ifdef A_INVIS
+#if A_INVIS
     {"Invisible_Character",     A_INVIS},
 #endif
-#ifdef A_PROTECT
+#if A_PROTECT
     {"Protected_Character",     A_PROTECT},
 #endif
-#ifdef A_HORIZONTAL
+#if A_HORIZONTAL
     {"Horizontal",              A_HORIZONTAL},
 #endif
-#ifdef A_LEFT
+#if A_LEFT
     {"Left",                    A_LEFT},
 #endif
-#ifdef A_LOW
+#if A_LOW
     {"Low",                     A_LOW},
 #endif
-#ifdef A_RIGHT
+#if A_RIGHT
     {"Right",                   A_RIGHT},
 #endif
-#ifdef A_TOP
+#if A_TOP
     {"Top",                     A_TOP},
 #endif
-#ifdef A_VERTICAL
+#if A_VERTICAL
     {"Vertical",                A_VERTICAL},
 #endif
     {(char *)0,                 0}
@@ -1048,7 +1051,6 @@ static void gen_color (void)
  */
 static void gen_linkopts (void)
 {
-   printf("   pragma Linker_Options (\"-lAdaCurses%s\");\n", model);
    printf("   pragma Linker_Options (\"-lncurses%s\");\n", model);
 }
 
@@ -1101,19 +1103,19 @@ eti_gen(char*buf, int code, const char* name, int* etimin, int* etimax)
   return strlen(buf);
 }
 
-#define GEN_OFFSET(member,itype)                                   \
-  if (sizeof(((WINDOW*)0)->member)==sizeof(itype)) {               \
-    o = offsetof(WINDOW, member);                                  \
-    if ((o%sizeof(itype) == 0)) {                                  \
-       printf("   Offset%-*s : constant Natural := %2d; --  %s\n", \
-              8, #member, o/sizeof(itype),#itype);                 \
-    }                                                              \
+#define GEN_OFFSET(member,itype)                                    \
+  if (sizeof(((WINDOW*)0)->member)==sizeof(itype)) {                \
+    o = offsetof(WINDOW, member);                                   \
+    if ((o%sizeof(itype) == 0)) {                                   \
+       printf("   Offset%-*s : constant Natural := %2ld; --  %s\n", \
+              8, #member, o/sizeof(itype),#itype);                  \
+    }                                                               \
   }
   
 static void
 gen_offsets(void)
 {
-  int o;
+  long o;
   const char* s_bool = "";
 
   GEN_OFFSET(_maxy,short);
@@ -1135,8 +1137,8 @@ gen_offsets(void)
     GEN_OFFSET(_scroll,int);
     s_bool = "int";
   }
-  printf("   Sizeof%-*s : constant Natural := %2d; --  %s\n",
-        8, "_bool",sizeof(bool),"bool");
+  printf("   Sizeof%-*s : constant Natural := %2ld; --  %s\n",
+        8, "_bool", (long) sizeof(bool),"bool");
   /* In ncurses _maxy and _maxx needs an offset for the "public"
    * value
    */