dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
vlp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vlp-10 using coding style in object.c
[vlp.git]
/
src
/
int
/
util.c
diff --git
a/src/int/util.c
b/src/int/util.c
index 39b4087b6be077e86438b5045f07898e19ab665e..f272016453897d7168cece078d573edd0a802f43 100644
(file)
--- a/
src/int/util.c
+++ b/
src/int/util.c
@@
-1,4
+1,4
@@
-
/* Loglan82 Compiler&Interpreter
+/* Loglan82 Compiler&Interpreter
Copyright (C) 1981-1993 Institute of Informatics, University of Warsaw
Copyright (C) 1993, 1994 LITA, Pau
Copyright (C) 1981-1993 Institute of Informatics, University of Warsaw
Copyright (C) 1993, 1994 LITA, Pau
@@
-39,9
+39,10
@@
or Andrzej Salwicki
/* Utility routines */
/* Utility routines */
-
-word entier(x) /* Compute entier (floor) */
-double x;
+/**
+ * Compute entier (floor)
+ */
+word entier(double x)
{
word i;
{
word i;
@@
-56,20
+57,23
@@
double x;
i = -i;
if ((double)i <= x) return(i); else return(i-1);
}
i = -i;
if ((double)i <= x) return(i); else return(i-1);
}
-} /* end entier */
-
+}
-word shift(x, n) /* shift x by n bits */
-word x, n;
+/**
+ * shift x by n bits
+ */
+word shift(word x, word n)
{
if (n == 0) return (x);
if (n > 0) return (x << n);
else return ( (x >> -n) & ~(~(word)0 << (8*sizeof(word)+n)) );
{
if (n == 0) return (x);
if (n > 0) return (x << n);
else return ( (x >> -n) & ~(~(word)0 << (8*sizeof(word)+n)) );
-}
/* end shift */
+}
-char *asciiz(virt) /* Get ASCIIZ string from arrayof char */
-virtaddr *virt;
+/**
+ * Get ASCIIZ string from arrayof char
+ */
+char *asciiz(virtaddr *virt)
{
word am;
int len, i;
{
word am;
int len, i;
@@
-85,27
+89,28
@@
virtaddr *virt;
return (cp);
}
else errsignal(RTEREFTN); /* reference to none */
return (cp);
}
else errsignal(RTEREFTN); /* reference to none */
-} /* end asciiz */
-
+}
-void addext(fname, ext) /* Add extension to a file name */
-char *fname, *ext;
+/**
+ * Add extension to a file name
+ */
+void addext(char *fname, char *ext)
{
char *cp;
cp = fname;
while (*cp != '\0' && *cp != '.') cp++;
strcpy(cp, ext);
{
char *cp;
cp = fname;
while (*cp != '\0' && *cp != '.') cp++;
strcpy(cp, ext);
-} /* end addext */
-
+}
void usage()
{
}
void usage()
{
}
-
-void abend(msg) /* Print error message and abort */
-char *msg;
+/**
+ * Print error message and abort
+ */
+void abend(char *msg)
{
fprintf(stderr, "Error: %s\n", msg);
exit(8);
{
fprintf(stderr, "Error: %s\n", msg);
exit(8);
@@
-116,7
+121,10
@@
char *msg;
static int ranpat1 = 7, ranpat2 = 503, ranpat3 = 15661;
static int ranpat1 = 7, ranpat2 = 503, ranpat3 = 15661;
-void ranset() /* Initialize generator */
+/**
+ * Initialize generator
+ */
+void ranset()
{
long tim;
{
long tim;
@@
-124,10
+132,12
@@
void ranset() /* Initialize generator */
ranpat1 = tim % 30269;
ranpat2 = tim % 30307;
ranpat3 = tim % 30323;
ranpat1 = tim % 30269;
ranpat2 = tim % 30307;
ranpat3 = tim % 30323;
-} /* end ranset */
-
+}
-double prandom() /* Produce next pseudo random number */
+/**
+ * Produce next pseudo random number
+ */
+double prandom()
{
int i;
double r;
{
int i;
double r;
@@
-143,14
+153,15
@@
double prandom() /* Produce next pseudo random number */
return (r-i);
}
return (r-i);
}
-
-void moveblock(from, to, len) /* Copy a block of memory */
-char *from, *to;
-word len;
+/**
+ * Copy a block of memory
+ */
+void moveblock(char *from, char *to, word len)
{
{
- while (len-- > 0) *to++ = *from++;
-} /* end moveblock */
-
+ while (len-- > 0) {
+ *to++ = *from++;
+ }
+}
/**************************************************************
/**************************************************************