Skip to content

Commit

Permalink
generator: Sort most output.
Browse files Browse the repository at this point in the history
Look for use of external_functions and fish_functions and replace with
use of external_functions_sorted and fish_functions_sorted where
possible.  This ensures that the output of the generator is sorted as
far as possible.

I also checked for uses of internal_functions and documented_functions
but those are not used.  The *_sorted versions are always used
instead.
  • Loading branch information
rwmjones committed Feb 15, 2014
1 parent bbfb9f9 commit 6cc521d
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 93 deletions.
6 changes: 3 additions & 3 deletions generator/fish.ml
Expand Up @@ -80,7 +80,7 @@ let generate_fish_cmds () =
fun { name = name } ->
pr "static int run_%s (const char *cmd, size_t argc, char *argv[]);\n"
name
) fish_functions;
) fish_functions_sorted;

pr "\n";

Expand Down Expand Up @@ -170,7 +170,7 @@ Guestfish will prompt for these separately."
pr " .run = run_%s\n" name;
pr "};\n";
pr "\n";
) fish_functions;
) fish_functions_sorted;

(* list_commands function, which implements guestfish -h *)
pr "void\n";
Expand Down Expand Up @@ -657,7 +657,7 @@ Guestfish will prompt for these separately."
pr " return ret;\n";
pr "}\n";
pr "\n"
) fish_functions;
) fish_functions_sorted;

(* run_action function *)
pr "int\n";
Expand Down
6 changes: 3 additions & 3 deletions generator/gobject.ml
Expand Up @@ -116,7 +116,7 @@ let filenames =
function
| { style = _, _, (_::_) } -> true
| { style = _, _, [] } -> false
) external_functions
) external_functions_sorted
)

let header_start filename =
Expand Down Expand Up @@ -706,7 +706,7 @@ gboolean guestfs_session_close (GuestfsSession *session, GError **err);
fun ({ name = name; style = style } as f) ->
generate_gobject_proto name style f;
pr ";\n";
) external_functions;
) external_functions_sorted;

header_end filename

Expand Down Expand Up @@ -1293,4 +1293,4 @@ guestfs_session_close (GuestfsSession *session, GError **err)
);

pr "}\n";
) external_functions
) external_functions_sorted
4 changes: 2 additions & 2 deletions generator/haskell.ml
Expand Up @@ -60,7 +60,7 @@ module Guestfs (
List.iter (
fun { name = name; style = style } ->
if can_generate style then pr ",\n %s" name
) external_functions;
) external_functions_sorted;

pr "
) where
Expand Down Expand Up @@ -208,7 +208,7 @@ assocListOfHashtable (a:b:rest) = (a,b) : assocListOfHashtable rest
);
pr "\n";
)
) external_functions
) external_functions_sorted

and generate_haskell_prototype ~handle ?(hs = false) (ret, args, optargs) =
pr "%s -> " handle;
Expand Down
4 changes: 2 additions & 2 deletions generator/java.ml
Expand Up @@ -389,7 +389,7 @@ public class GuestFS {
generate_java_prototype ~privat:true ~native:true f.name f.style;
pr "\n";
pr "\n";
) external_functions;
) external_functions_sorted;

pr "}\n"

Expand Down Expand Up @@ -1114,7 +1114,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)

pr "}\n";
pr "\n"
) external_functions
) external_functions_sorted

and generate_java_struct_return typ jtyp cols =
pr " cl = (*env)->FindClass (env, \"com/redhat/et/libguestfs/%s\");\n" jtyp;
Expand Down
2 changes: 1 addition & 1 deletion generator/main.ml
Expand Up @@ -196,7 +196,7 @@ Run it from the top source directory using the command
output_to filename
(generate_gobject_optargs_source short name optargs f)
| { style = _, _, [] } -> ()
) external_functions;
) external_functions_sorted;
delete_except_generated "gobject/include/guestfs-gobject/optargs-*.h";
delete_except_generated "gobject/src/optargs-*.c";

Expand Down
2 changes: 1 addition & 1 deletion generator/perl.ml
Expand Up @@ -577,7 +577,7 @@ PREINIT:
);

pr "\n"
) external_functions
) external_functions_sorted

and generate_perl_struct_list_code typ cols name style n =
pr " if (r == NULL)\n";
Expand Down
6 changes: 3 additions & 3 deletions generator/python.ml
Expand Up @@ -518,7 +518,7 @@ put_table (char * const * const argv)
pr " return py_r;\n";
pr "}\n";
pr "\n"
) external_functions;
) external_functions_sorted;

(* Table of functions. *)
pr "static PyMethodDef methods[] = {\n";
Expand All @@ -534,7 +534,7 @@ put_table (char * const * const argv)
fun { name = name } ->
pr " { (char *) \"%s\", py_guestfs_%s, METH_VARARGS, NULL },\n"
name name
) external_functions;
) external_functions_sorted;
pr " { NULL, NULL, 0, NULL }\n";
pr "};\n";
pr "\n";
Expand Down Expand Up @@ -823,4 +823,4 @@ class GuestFS(object):
fun alias ->
pr " %s = %s\n\n" alias f.name
) f.non_c_aliases
) external_functions
) external_functions_sorted
4 changes: 2 additions & 2 deletions generator/ruby.ml
Expand Up @@ -743,7 +743,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)

pr "}\n";
pr "\n"
) external_functions;
) external_functions_sorted;

pr "\
extern void Init__guestfs (void); /* keep GCC warnings happy */
Expand Down Expand Up @@ -804,7 +804,7 @@ Init__guestfs (void)
pr " rb_define_method (c_guestfs, \"%s\",\n" alias;
pr " ruby_guestfs_%s, %d);\n" name nr_args
) non_c_aliases
) external_functions;
) external_functions_sorted;

pr "}\n"

Expand Down
152 changes: 76 additions & 76 deletions gobject/Makefile.inc
Expand Up @@ -43,58 +43,58 @@ guestfs_gobject_headers= \
include/guestfs-gobject/struct-utsname.h \
include/guestfs-gobject/struct-hivex_node.h \
include/guestfs-gobject/struct-hivex_value.h \
include/guestfs-gobject/optargs-internal_test.h \
include/guestfs-gobject/optargs-internal_test_only_optargs.h \
include/guestfs-gobject/optargs-internal_test_63_optargs.h \
include/guestfs-gobject/optargs-add_drive.h \
include/guestfs-gobject/optargs-add_domain.h \
include/guestfs-gobject/optargs-inspect_get_icon.h \
include/guestfs-gobject/optargs-mount_local.h \
include/guestfs-gobject/optargs-umount_local.h \
include/guestfs-gobject/optargs-add_drive.h \
include/guestfs-gobject/optargs-add_drive_scratch.h \
include/guestfs-gobject/optargs-disk_create.h \
include/guestfs-gobject/optargs-is_file.h \
include/guestfs-gobject/optargs-is_dir.h \
include/guestfs-gobject/optargs-umount.h \
include/guestfs-gobject/optargs-tar_in.h \
include/guestfs-gobject/optargs-tar_out.h \
include/guestfs-gobject/optargs-mkswap.h \
include/guestfs-gobject/optargs-grep.h \
include/guestfs-gobject/optargs-is_chardev.h \
include/guestfs-gobject/optargs-is_blockdev.h \
include/guestfs-gobject/optargs-is_fifo.h \
include/guestfs-gobject/optargs-is_socket.h \
include/guestfs-gobject/optargs-mkfs.h \
include/guestfs-gobject/optargs-mount_9p.h \
include/guestfs-gobject/optargs-ntfsresize.h \
include/guestfs-gobject/optargs-btrfs_filesystem_resize.h \
include/guestfs-gobject/optargs-compress_out.h \
include/guestfs-gobject/optargs-btrfs_fsck.h \
include/guestfs-gobject/optargs-compress_device_out.h \
include/guestfs-gobject/optargs-compress_out.h \
include/guestfs-gobject/optargs-copy_attributes.h \
include/guestfs-gobject/optargs-copy_device_to_device.h \
include/guestfs-gobject/optargs-copy_device_to_file.h \
include/guestfs-gobject/optargs-copy_file_to_device.h \
include/guestfs-gobject/optargs-copy_file_to_file.h \
include/guestfs-gobject/optargs-tune2fs.h \
include/guestfs-gobject/optargs-md_create.h \
include/guestfs-gobject/optargs-disk_create.h \
include/guestfs-gobject/optargs-e2fsck.h \
include/guestfs-gobject/optargs-ntfsfix.h \
include/guestfs-gobject/optargs-ntfsclone_out.h \
include/guestfs-gobject/optargs-mkfs_btrfs.h \
include/guestfs-gobject/optargs-set_e2attrs.h \
include/guestfs-gobject/optargs-btrfs_fsck.h \
include/guestfs-gobject/optargs-fstrim.h \
include/guestfs-gobject/optargs-xfs_growfs.h \
include/guestfs-gobject/optargs-rsync.h \
include/guestfs-gobject/optargs-rsync_in.h \
include/guestfs-gobject/optargs-rsync_out.h \
include/guestfs-gobject/optargs-xfs_admin.h \
include/guestfs-gobject/optargs-grep.h \
include/guestfs-gobject/optargs-hivex_open.h \
include/guestfs-gobject/optargs-xfs_repair.h \
include/guestfs-gobject/optargs-inspect_get_icon.h \
include/guestfs-gobject/optargs-internal_test.h \
include/guestfs-gobject/optargs-internal_test_63_optargs.h \
include/guestfs-gobject/optargs-internal_test_only_optargs.h \
include/guestfs-gobject/optargs-is_blockdev.h \
include/guestfs-gobject/optargs-is_chardev.h \
include/guestfs-gobject/optargs-is_dir.h \
include/guestfs-gobject/optargs-is_fifo.h \
include/guestfs-gobject/optargs-is_file.h \
include/guestfs-gobject/optargs-is_socket.h \
include/guestfs-gobject/optargs-md_create.h \
include/guestfs-gobject/optargs-mke2fs.h \
include/guestfs-gobject/optargs-mkfs.h \
include/guestfs-gobject/optargs-mkfs_btrfs.h \
include/guestfs-gobject/optargs-mkswap.h \
include/guestfs-gobject/optargs-mktemp.h \
include/guestfs-gobject/optargs-syslinux.h \
include/guestfs-gobject/optargs-mount_9p.h \
include/guestfs-gobject/optargs-mount_local.h \
include/guestfs-gobject/optargs-ntfsclone_out.h \
include/guestfs-gobject/optargs-ntfsfix.h \
include/guestfs-gobject/optargs-ntfsresize.h \
include/guestfs-gobject/optargs-remount.h \
include/guestfs-gobject/optargs-copy_attributes.h
include/guestfs-gobject/optargs-rsync.h \
include/guestfs-gobject/optargs-rsync_in.h \
include/guestfs-gobject/optargs-rsync_out.h \
include/guestfs-gobject/optargs-set_e2attrs.h \
include/guestfs-gobject/optargs-syslinux.h \
include/guestfs-gobject/optargs-tar_in.h \
include/guestfs-gobject/optargs-tar_out.h \
include/guestfs-gobject/optargs-tune2fs.h \
include/guestfs-gobject/optargs-umount.h \
include/guestfs-gobject/optargs-umount_local.h \
include/guestfs-gobject/optargs-xfs_admin.h \
include/guestfs-gobject/optargs-xfs_growfs.h \
include/guestfs-gobject/optargs-xfs_repair.h

guestfs_gobject_sources= \
src/session.c \
Expand All @@ -119,55 +119,55 @@ guestfs_gobject_sources= \
src/struct-utsname.c \
src/struct-hivex_node.c \
src/struct-hivex_value.c \
src/optargs-internal_test.c \
src/optargs-internal_test_only_optargs.c \
src/optargs-internal_test_63_optargs.c \
src/optargs-add_drive.c \
src/optargs-add_domain.c \
src/optargs-inspect_get_icon.c \
src/optargs-mount_local.c \
src/optargs-umount_local.c \
src/optargs-add_drive.c \
src/optargs-add_drive_scratch.c \
src/optargs-disk_create.c \
src/optargs-is_file.c \
src/optargs-is_dir.c \
src/optargs-umount.c \
src/optargs-tar_in.c \
src/optargs-tar_out.c \
src/optargs-mkswap.c \
src/optargs-grep.c \
src/optargs-is_chardev.c \
src/optargs-is_blockdev.c \
src/optargs-is_fifo.c \
src/optargs-is_socket.c \
src/optargs-mkfs.c \
src/optargs-mount_9p.c \
src/optargs-ntfsresize.c \
src/optargs-btrfs_filesystem_resize.c \
src/optargs-compress_out.c \
src/optargs-btrfs_fsck.c \
src/optargs-compress_device_out.c \
src/optargs-compress_out.c \
src/optargs-copy_attributes.c \
src/optargs-copy_device_to_device.c \
src/optargs-copy_device_to_file.c \
src/optargs-copy_file_to_device.c \
src/optargs-copy_file_to_file.c \
src/optargs-tune2fs.c \
src/optargs-md_create.c \
src/optargs-disk_create.c \
src/optargs-e2fsck.c \
src/optargs-ntfsfix.c \
src/optargs-ntfsclone_out.c \
src/optargs-mkfs_btrfs.c \
src/optargs-set_e2attrs.c \
src/optargs-btrfs_fsck.c \
src/optargs-fstrim.c \
src/optargs-xfs_growfs.c \
src/optargs-rsync.c \
src/optargs-rsync_in.c \
src/optargs-rsync_out.c \
src/optargs-xfs_admin.c \
src/optargs-grep.c \
src/optargs-hivex_open.c \
src/optargs-xfs_repair.c \
src/optargs-inspect_get_icon.c \
src/optargs-internal_test.c \
src/optargs-internal_test_63_optargs.c \
src/optargs-internal_test_only_optargs.c \
src/optargs-is_blockdev.c \
src/optargs-is_chardev.c \
src/optargs-is_dir.c \
src/optargs-is_fifo.c \
src/optargs-is_file.c \
src/optargs-is_socket.c \
src/optargs-md_create.c \
src/optargs-mke2fs.c \
src/optargs-mkfs.c \
src/optargs-mkfs_btrfs.c \
src/optargs-mkswap.c \
src/optargs-mktemp.c \
src/optargs-syslinux.c \
src/optargs-mount_9p.c \
src/optargs-mount_local.c \
src/optargs-ntfsclone_out.c \
src/optargs-ntfsfix.c \
src/optargs-ntfsresize.c \
src/optargs-remount.c \
src/optargs-copy_attributes.c
src/optargs-rsync.c \
src/optargs-rsync_in.c \
src/optargs-rsync_out.c \
src/optargs-set_e2attrs.c \
src/optargs-syslinux.c \
src/optargs-tar_in.c \
src/optargs-tar_out.c \
src/optargs-tune2fs.c \
src/optargs-umount.c \
src/optargs-umount_local.c \
src/optargs-xfs_admin.c \
src/optargs-xfs_growfs.c \
src/optargs-xfs_repair.c

0 comments on commit 6cc521d

Please sign in to comment.