Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
42199e42
Commit
42199e42
authored
24 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Added /q (quiet mode) option.
Upped displayed ver to 2.2. Remove ex-ASCII from banner.
parent
8dc7a343
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/baja.c
+100
-90
100 additions, 90 deletions
src/sbbs3/baja.c
with
100 additions
and
90 deletions
src/sbbs3/baja.c
+
100
−
90
View file @
42199e42
...
...
@@ -3107,113 +3107,123 @@ free(str);
free
(
save
);
}
char
*
usage
=
"
\n
"
"usage: baja [/opts] file[.src]
\n
"
"
\n
"
" opts: /d display debug during compile
\n
"
" /c case sensitive variables, labels, and macros
\n
"
" /o set output directory (e.g. /o
\\
sbbs
\\
exec)
\n
"
;
char
*
banner
=
"
\n
"
"BAJA v2.20 - Synchronet Shell/Module Compiler - "
"Copyright 2000 Rob Swindell
\n
"
;
char
*
usage
=
"
\n
"
"usage: baja [/opts] file[.src]
\n
"
"
\n
"
" opts: /d display debug during compile
\n
"
" /c case sensitive variables, labels, and macros
\n
"
" /o set output directory (e.g. /o
\\
sbbs
\\
exec)
\n
"
" /q quiet mode (no banner)
\n
"
;
int
main
(
int
argc
,
char
**
argv
)
{
uchar
str
[
128
],
src
[
128
]
=
""
,
*
p
,
outdir
[
128
]
=
""
,
outfname
[
128
]
=
""
;
int
i
,
j
;
int
show_banner
=
1
;
for
(
i
=
1
;
i
<
argc
;
i
++
)
if
(
argv
[
i
][
0
]
==
'/'
)
switch
(
toupper
(
argv
[
i
][
1
]))
{
case
'D'
:
display
=
1
;
break
;
case
'C'
:
case_sens
=
1
;
break
;
case
'O'
:
strcpy
(
outdir
,
argv
[
i
]
+
2
);
break
;
case
'Q'
:
show_banner
=
0
;
break
;
default:
printf
(
banner
);
printf
(
usage
);
exit
(
1
);
}
else
strcpy
(
src
,
argv
[
i
]);
printf
(
"
\n
BAJA v2.10 Synchronet Shell/Module Compiler "
"Copyright 2000 Rob Swindell
\n
"
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
if
(
argv
[
i
][
0
]
==
'/'
)
switch
(
toupper
(
argv
[
i
][
1
]))
{
case
'D'
:
display
=
1
;
break
;
case
'C'
:
case_sens
=
1
;
break
;
case
'O'
:
strcpy
(
outdir
,
argv
[
i
]
+
2
);
break
;
default:
printf
(
usage
);
exit
(
1
);
}
else
strcpy
(
src
,
argv
[
i
]);
if
(
!
src
[
0
])
{
printf
(
usage
);
exit
(
1
);
}
if
(
show_banner
)
printf
(
banner
);
strupr
(
src
);
strcpy
(
str
,
src
);
if
(
!
strchr
(
str
,
'.'
))
sprintf
(
src
,
"%s.SRC"
,
str
);
if
(
!
src
[
0
])
{
printf
(
usage
);
exit
(
1
);
}
strcpy
(
str
,
src
);
p
=
strrchr
(
str
,
'.'
);
if
(
p
)
*
p
=
0
;
strcat
(
str
,
".BIN"
);
strcpy
(
str
,
src
);
if
(
!
strchr
(
str
,
'.'
))
sprintf
(
src
,
"%s.SRC"
,
str
);
if
(
outdir
[
0
])
{
p
=
strrchr
(
str
,
'\\'
);
if
(
!
p
)
p
=
strrchr
(
str
,
':'
);
strcpy
(
str
,
src
);
p
=
strrchr
(
str
,
'.'
);
if
(
p
)
strcpy
(
outfname
,
p
+
1
);
else
strcpy
(
outfname
,
str
);
if
(
outdir
[
strlen
(
outdir
)
-
1
]
!=
'\\'
&&
outdir
[
strlen
(
outdir
)
-
1
]
!=
':'
)
strcat
(
outdir
,
"
\\
"
);
sprintf
(
str
,
"%s%s"
,
outdir
,
outfname
);
}
if
((
out
=
fopen
(
str
,
"wb"
))
==
NULL
)
{
printf
(
"error opening %s for write
\n
"
,
str
);
exit
(
1
);
}
*
p
=
0
;
strcat
(
str
,
".BIN"
);
if
(
outdir
[
0
])
{
p
=
strrchr
(
str
,
'\\'
);
if
(
!
p
)
p
=
strrchr
(
str
,
':'
);
if
(
p
)
strcpy
(
outfname
,
p
+
1
);
else
strcpy
(
outfname
,
str
);
if
(
outdir
[
strlen
(
outdir
)
-
1
]
!=
'\\'
&&
outdir
[
strlen
(
outdir
)
-
1
]
!=
':'
)
strcat
(
outdir
,
"
\\
"
);
sprintf
(
str
,
"%s%s"
,
outdir
,
outfname
);
}
if
((
out
=
fopen
(
str
,
"wb"
))
==
NULL
)
{
printf
(
"error opening %s for write
\n
"
,
str
);
exit
(
1
);
}
atexit
(
bail
);
atexit
(
bail
);
printf
(
"
\n
Compiling %s...
\n
"
,
src
);
printf
(
"
\n
Compiling %s...
\n
"
,
src
);
compile
(
src
);
compile
(
src
);
/****************************/
/* Resolve GOTOS and CALLS */
/****************************/
/****************************/
/* Resolve GOTOS and CALLS */
/****************************/
printf
(
"Resolving labels...
\n
"
);
printf
(
"Resolving labels...
\n
"
);
for
(
i
=
0
;
i
<
gotos
;
i
++
)
{
for
(
j
=
0
;
j
<
labels
;
j
++
)
if
(
!
stricmp
(
goto_label
[
i
],
label_name
[
j
]))
break
;
if
(
j
>=
labels
)
{
printf
(
"%s line %d: label (%s) not found.
\n
"
,
goto_file
[
i
],
goto_line
[
i
],
goto_label
[
i
]);
exit
(
1
);
}
fseek
(
out
,(
long
)(
goto_indx
[
i
]
+
1
),
SEEK_SET
);
fwrite
(
&
label_indx
[
j
],
2
,
1
,
out
);
}
for
(
i
=
0
;
i
<
calls
;
i
++
)
{
for
(
j
=
0
;
j
<
labels
;
j
++
)
if
((
!
case_sens
&&
!
strnicmp
(
call_label
[
i
],
label_name
[
j
],
strlen
(
call_label
[
i
])))
||
(
case_sens
&&
!
strncmp
(
call_label
[
i
],
label_name
[
j
],
strlen
(
call_label
[
i
]))))
break
;
if
(
j
>=
labels
)
{
printf
(
"%s line %d: label (%s) not found.
\n
"
,
call_file
[
i
],
call_line
[
i
],
call_label
[
i
]);
exit
(
1
);
}
fseek
(
out
,(
long
)(
call_indx
[
i
]
+
1
),
SEEK_SET
);
fwrite
(
&
label_indx
[
j
],
2
,
1
,
out
);
}
for
(
i
=
0
;
i
<
gotos
;
i
++
)
{
for
(
j
=
0
;
j
<
labels
;
j
++
)
if
(
!
stricmp
(
goto_label
[
i
],
label_name
[
j
]))
break
;
if
(
j
>=
labels
)
{
printf
(
"%s line %d: label (%s) not found.
\n
"
,
goto_file
[
i
],
goto_line
[
i
],
goto_label
[
i
]);
exit
(
1
);
}
fseek
(
out
,(
long
)(
goto_indx
[
i
]
+
1
),
SEEK_SET
);
fwrite
(
&
label_indx
[
j
],
2
,
1
,
out
);
}
for
(
i
=
0
;
i
<
calls
;
i
++
)
{
for
(
j
=
0
;
j
<
labels
;
j
++
)
if
((
!
case_sens
&&
!
strnicmp
(
call_label
[
i
],
label_name
[
j
],
strlen
(
call_label
[
i
])))
||
(
case_sens
&&
!
strncmp
(
call_label
[
i
],
label_name
[
j
],
strlen
(
call_label
[
i
]))))
break
;
if
(
j
>=
labels
)
{
printf
(
"%s line %d: label (%s) not found.
\n
"
,
call_file
[
i
],
call_line
[
i
],
call_label
[
i
]);
exit
(
1
);
}
fseek
(
out
,(
long
)(
call_indx
[
i
]
+
1
),
SEEK_SET
);
fwrite
(
&
label_indx
[
j
],
2
,
1
,
out
);
}
fclose
(
out
);
out
=
NULL
;
/* so bail() won't truncate */
fclose
(
out
);
out
=
NULL
;
/* so bail() won't truncate */
printf
(
"
\n
Done.
\n
"
);
return
(
0
);
printf
(
"
\n
Done.
\n
"
);
return
(
0
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment